Class: CodeTools::Compiler::LRUCache::Entry
- Inherits:
-
Object
- Object
- CodeTools::Compiler::LRUCache::Entry
- Defined in:
- lib/rubinius/code/compiler/compiler.rb
Instance Attribute Summary collapse
-
#hits ⇒ Object
readonly
Returns the value of attribute hits.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#next_entry ⇒ Object
Returns the value of attribute next_entry.
-
#prev_entry ⇒ Object
Returns the value of attribute prev_entry.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #become_first! ⇒ Object
- #detach! ⇒ Object
- #inc! ⇒ Object
-
#initialize(key, value) ⇒ Entry
constructor
A new instance of Entry.
- #insert_after(entry) ⇒ Object
- #insert_before(entry) ⇒ Object
Constructor Details
#initialize(key, value) ⇒ Entry
Returns a new instance of Entry.
134 135 136 137 138 139 140 |
# File 'lib/rubinius/code/compiler/compiler.rb', line 134 def initialize(key, value) @key = key @value = value @hits = 0 @next_entry = nil @prev_entry = nil end |
Instance Attribute Details
#hits ⇒ Object (readonly)
Returns the value of attribute hits.
131 132 133 |
# File 'lib/rubinius/code/compiler/compiler.rb', line 131 def hits @hits end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
131 132 133 |
# File 'lib/rubinius/code/compiler/compiler.rb', line 131 def key @key end |
#next_entry ⇒ Object
Returns the value of attribute next_entry.
132 133 134 |
# File 'lib/rubinius/code/compiler/compiler.rb', line 132 def next_entry @next_entry end |
#prev_entry ⇒ Object
Returns the value of attribute prev_entry.
132 133 134 |
# File 'lib/rubinius/code/compiler/compiler.rb', line 132 def prev_entry @prev_entry end |
#value ⇒ Object
Returns the value of attribute value.
132 133 134 |
# File 'lib/rubinius/code/compiler/compiler.rb', line 132 def value @value end |
Instance Method Details
#become_first! ⇒ Object
170 171 172 |
# File 'lib/rubinius/code/compiler/compiler.rb', line 170 def become_first! @prev_entry = nil end |
#detach! ⇒ Object
162 163 164 165 166 167 168 |
# File 'lib/rubinius/code/compiler/compiler.rb', line 162 def detach! @next_entry.prev_entry = @prev_entry if @next_entry @prev_entry.next_entry = @next_entry if @prev_entry @next_entry = nil @prev_entry = nil end |
#inc! ⇒ Object
174 175 176 |
# File 'lib/rubinius/code/compiler/compiler.rb', line 174 def inc! @hits += 1 end |
#insert_after(entry) ⇒ Object
142 143 144 145 146 147 148 149 150 |
# File 'lib/rubinius/code/compiler/compiler.rb', line 142 def insert_after(entry) nxt = entry.next_entry @prev_entry = entry @next_entry = nxt entry.next_entry = self nxt.prev_entry = self if nxt end |
#insert_before(entry) ⇒ Object
152 153 154 155 156 157 158 159 160 |
# File 'lib/rubinius/code/compiler/compiler.rb', line 152 def insert_before(entry) prev = entry.prev_entry @prev_entry = prev @next_entry = entry entry.prev_entry = self prev.next_entry = self if prev end |