1 package org.gffs.cache;
16 abstract class CacheList<KeyType, DataType>
18 protected int _myRole;
20 protected RoleBasedCacheNode<KeyType, DataType> _head;
21 protected RoleBasedCacheNode<KeyType, DataType> _tail;
23 protected CacheList(
int role)
30 public abstract void insert(RoleBasedCacheNode<KeyType, DataType> node);
32 public RoleBasedCacheNode<KeyType, DataType> removeFirst()
37 RoleBasedCacheNode<KeyType, DataType> ret = _head;
39 _head = _head.getNext(_myRole);
41 _head.setPrevious(_myRole,
null);
45 ret.clearLinks(_myRole);
49 public RoleBasedCacheNode<KeyType, DataType> peekFirst()
57 public void remove(RoleBasedCacheNode<KeyType, DataType> node)
59 if (node.getPrevious(_myRole) ==
null)
60 _head = node.getNext(_myRole);
62 node.getPrevious(_myRole).setNext(_myRole, node.getNext(_myRole));
64 if (node.getNext(_myRole) ==
null)
65 _tail = node.getPrevious(_myRole);
67 node.getNext(_myRole).setPrevious(_myRole, node.getPrevious(_myRole));
69 node.clearLinks(_myRole);