Class: LRUHash::Node
- Inherits:
-
Struct
- Object
- Struct
- LRUHash::Node
- Defined in:
- lib/bio/system/lruhash.rb
Overview
A single node in the doubly linked LRU list of nodes
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#pred ⇒ Object
Returns the value of attribute pred.
-
#succ ⇒ Object
Returns the value of attribute succ.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key
201 202 203 |
# File 'lib/bio/system/lruhash.rb', line 201 def key @key end |
#pred ⇒ Object
Returns the value of attribute pred
201 202 203 |
# File 'lib/bio/system/lruhash.rb', line 201 def pred @pred end |
#succ ⇒ Object
Returns the value of attribute succ
201 202 203 |
# File 'lib/bio/system/lruhash.rb', line 201 def succ @succ end |
#value ⇒ Object
Returns the value of attribute value
201 202 203 |
# File 'lib/bio/system/lruhash.rb', line 201 def value @value end |
Instance Method Details
#insert_after(node) ⇒ Object
209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/bio/system/lruhash.rb', line 209 def insert_after(node) raise 'Cannot insert after self' if equal? node return self if node.succ.equal? self unlink self.succ = node.succ self.pred = node node.succ.pred = self if node.succ node.succ = self self end |
#unlink ⇒ Object
202 203 204 205 206 207 |
# File 'lib/bio/system/lruhash.rb', line 202 def unlink pred.succ = succ if pred succ.pred = pred if succ self.succ = self.pred = nil self end |