The Trunk: Collections-ul.620.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-ul.620.mcz

commits-2
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.620.mcz

==================== Summary ====================

Name: Collections-ul.620
Author: ul
Time: 13 April 2015, 5:37:50.831 am
UUID: 3f6f10ae-f7e2-4218-92cb-02ac39b1d25c
Ancestors: Collections-ul.619

Removed the migration code, and obsolete private methods from LRUCache.

=============== Diff against Collections-ul.619 ===============

Item was changed:
  ----- Method: LRUCache>>at: (in category 'accessing') -----
  at: aKey
  "answer the object for aKey, if not present in the cache creates it"
 
- head class == LRUCacheHeadNode ifFalse: [ self reset ].
  calls := calls + 1.
  ^map
  at: aKey
  ifPresent: [ :node |
  hits := hits + 1.
  head next == node ifFalse: [
  node
  unlink;
  linkAfter: head ].
  node value ]
  ifAbsent: [
  | node |
  map size = size
  ifTrue: [
  node := head previous.
  node unlink.
  map removeKey: node key. ]
  ifFalse: [ node := LRUCacheNode new ].
  node linkAfter: head.
  map at: aKey put: node.
  node
  key: aKey;
  value: (factory value: aKey);
  value ]!

Item was removed:
- ----- Method: LRUCache>>moveToFirst: (in category 'private') -----
- moveToFirst: node
- "Move node after head in the doubly-linked list. If the node is linked, it must be unlinked first."
-
- | next |
- next := head at: 1.
- next == node ifTrue: [ ^self ].
- node
- at: 1 put: next;
- at: 2 put: head.
- next at: 2 put: node.
- head at: 1 put: node!

Item was removed:
- ----- Method: LRUCache>>unlink: (in category 'private') -----
- unlink: node
- "Unlink the node from the doubly-linked list represented by head."
-
- | next previous |
- next := node at: 1.
- previous := node at: 2.
- next at: 2 put: previous.
- previous at: 1 put: next!