lots of stuff to move to linked lists

and remove the blocks
more position stuff coming, but the list part should be ok
This commit is contained in:
Torsten Ruger
2015-10-24 17:12:36 +03:00
parent 3774f8a5a2
commit 405a6935d4
8 changed files with 112 additions and 9 deletions

View File

@ -21,14 +21,33 @@ module Register
def to_ac labels = []
return [] if labels.include?(self)
labels << self
self.next.to_ac(labels)
super
end
def length labels = []
return 0 if labels.include?(self)
labels << self
1 + self.next.length(labels)
ret = 1
ret += self.next.length(labels) if self.next
ret
end
def byte_length
0
end
def total_byte_length labels = []
return 0 if labels.include?(self)
labels << self
self.next.length(labels)
end
# labels have the same position as their next
def set_position position , labels = []
return position if labels.include?(self)
labels << self
self.position = position
self.next.set_position(position,labels)
end
end
end