/** * Removes 'head' from list and returns it. Returns null if list is empty. * @return current head element, next element becomes head. */ public Node pop() { if (head == null) return null; Node nde = head; remove(nde); return nde; }
/** * Removes 'head' from list and returns it. Returns null if list is empty. * @return current head element, next element becomes head. */ public Node pop() { if (head == null) return null; Node nde = head; remove(nde); return nde; }
/** * Removes 'head' from list and returns it. Returns null if list is empty. * @return current head element, next element becomes head. */ public Node pop() { if (head == null) return null; Node nde = head; remove(nde); return nde; }
/** * Removes 'tail' from list and returns it. Returns null if list is empty. * @return current tail element. */ public Node unpush() { if (head == null) return null; Node nde = getTail(); remove(nde); return nde; }
/** * Removes 'tail' from list and returns it. Returns null if list is empty. * @return current tail element. */ public Node unpush() { if (head == null) return null; Node nde = getTail(); remove(nde); return nde; }
/** * Removes 'tail' from list and returns it. Returns null if list is empty. * @return current tail element. */ public Node unpush() { if (head == null) return null; Node nde = getTail(); remove(nde); return nde; }
public synchronized void remove(LRUObj obj) { LRUNode nde = obj.lruGet(); if (nde == null) return; used.remove(nde); nde.setObj(null); free.add(nde); }
public synchronized void remove(LRUObj obj) { LRUNode nde = obj.lruGet(); if (nde == null) return; used.remove(nde); nde.setObj(null); free.add(nde); }
public synchronized void remove(LRUObj obj) { LRUNode nde = obj.lruGet(); if (nde == null) return; used.remove(nde); nde.setObj(null); free.add(nde); }
public synchronized void setSize(int newSz) { if (maxSize < newSz) { // list grew... for (int i=maxSize; i<newSz; i++) free.add(new LRUNode()); } else if (maxSize > newSz) { for (int i=used.getSize(); i>newSz; i--) { LRUNode nde = (LRUNode)used.getTail(); used.remove(nde); nde.setObj(null); } } maxSize = newSz; }
public synchronized void setSize(int newSz) { if (maxSize < newSz) { // list grew... for (int i=maxSize; i<newSz; i++) free.add(new LRUNode()); } else if (maxSize > newSz) { for (int i=used.getSize(); i>newSz; i--) { LRUNode nde = (LRUNode)used.getTail(); used.remove(nde); nde.setObj(null); } } maxSize = newSz; }
public synchronized void setSize(int newSz) { if (maxSize < newSz) { // list grew... for (int i=maxSize; i<newSz; i++) free.add(new LRUNode()); } else if (maxSize > newSz) { for (int i=used.getSize(); i>newSz; i--) { LRUNode nde = (LRUNode)used.getTail(); used.remove(nde); nde.setObj(null); } } maxSize = newSz; }