Class: Rubinius::ToolSet.current::TS::Compiler::LRUCache::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/rubinius/compiler/compiler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, value) ⇒ Entry

Returns a new instance of Entry.



136
137
138
139
140
141
142
# File 'lib/rubinius/compiler/compiler.rb', line 136

def initialize(key, value)
  @key = key
  @value = value
  @hits = 0
  @next_entry = nil
  @prev_entry = nil
end

Instance Attribute Details

#hitsObject (readonly)

Returns the value of attribute hits.



133
134
135
# File 'lib/rubinius/compiler/compiler.rb', line 133

def hits
  @hits
end

#keyObject (readonly)

Returns the value of attribute key.



133
134
135
# File 'lib/rubinius/compiler/compiler.rb', line 133

def key
  @key
end

#next_entryObject

Returns the value of attribute next_entry.



134
135
136
# File 'lib/rubinius/compiler/compiler.rb', line 134

def next_entry
  @next_entry
end

#prev_entryObject

Returns the value of attribute prev_entry.



134
135
136
# File 'lib/rubinius/compiler/compiler.rb', line 134

def prev_entry
  @prev_entry
end

#valueObject

Returns the value of attribute value.



134
135
136
# File 'lib/rubinius/compiler/compiler.rb', line 134

def value
  @value
end

Instance Method Details

#become_first!Object



172
173
174
# File 'lib/rubinius/compiler/compiler.rb', line 172

def become_first!
  @prev_entry = nil
end

#detach!Object



164
165
166
167
168
169
170
# File 'lib/rubinius/compiler/compiler.rb', line 164

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



176
177
178
# File 'lib/rubinius/compiler/compiler.rb', line 176

def inc!
  @hits += 1
end

#insert_after(entry) ⇒ Object



144
145
146
147
148
149
150
151
152
# File 'lib/rubinius/compiler/compiler.rb', line 144

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



154
155
156
157
158
159
160
161
162
# File 'lib/rubinius/compiler/compiler.rb', line 154

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