<s> package org . eclipse . jdt . internal . core ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . JavaModelException ; import org . eclipse . jdt . internal . core . util . LRUCache ; public class ElementCache extends OverflowingLRUCache { IJavaElement spaceLimitParent = null ; public ElementCache ( int size ) { super ( size ) ; } public ElementCache ( int size , int overflow ) { super ( size , overflow ) ; } protected boolean close ( LRUCacheEntry entry ) { Openable element = ( Openable ) entry . key ; try { if ( ! element . canBeRemovedFromCache ( ) ) { return false ; } else { element . close ( ) ; return true ; } } catch ( JavaModelException npe ) { return false ; } } protected void ensureSpaceLimit ( Object info , IJavaElement parent ) { int childrenSize = ( ( JavaElementInfo ) info ) . getChildren ( ) . length ; int spaceNeeded = 1 + ( int ) ( ( 1 + this . loadFactor ) * ( childrenSize + this . overflow ) ) ; if ( this . spaceLimit < spaceNeeded ) { shrink ( ) ; setSpaceLimit ( spaceNeeded ) ; this . spaceLimitParent = parent ; } } protected LRUCache newInstance ( int size , int newOverflow ) { return new ElementCache ( size , newOverflow ) ; } protected void resetSpaceLimit ( int defaultLimit , IJavaElement parent ) { if ( parent . equals ( this . spaceLimitParent ) ) { setSpaceLimit ( defaultLimit ) ; this . spaceLimitParent = null ; } } } </s>