Class VerboseElementCache<K extends IJavaElement & IOpenable>
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.util.LRUCache<K, JavaElementInfo>
org.aspectj.org.eclipse.jdt.internal.core.OverflowingLRUCache<K, JavaElementInfo>
org.aspectj.org.eclipse.jdt.internal.core.ElementCache<K>
org.aspectj.org.eclipse.jdt.internal.core.VerboseElementCache<K>
- All Implemented Interfaces:
Cloneable
-
Nested Class Summary
Nested classes/interfaces inherited from class LRUCache
LRUCache.LRUCacheEntry<K,V>, LRUCache.Stats Modifier and TypeClassDescriptionstatic classThis type is used internally by the LRUCache to represent entries stored in the cache.class -
Field Summary
Fields inherited from class OverflowingLRUCache
loadFactor, overflow, timestampsOnModifier and TypeFieldDescriptionprotected doubleIndicates how much space should be reclaimed when the cache overflows.protected intIndicates if the cache has been over filled and by how much.protected booleanIndicates whether or not timestamps should be updatedFields inherited from class LRUCache
currentSpace, DEFAULT_SPACELIMIT, entryQueue, entryQueueTail, entryTable, spaceLimit, timestampCounterModifier and TypeFieldDescriptionprotected intAmount of cache space used so farprotected static final intDefault amount of space in the cacheprotected LRUCache.LRUCacheEntry<K, JavaElementInfo> Start of queue (most recently used entry)protected LRUCache.LRUCacheEntry<K, JavaElementInfo> End of queue (least recently used entry)protected Hashtable<K, LRUCache.LRUCacheEntry<K, JavaElementInfo>> Hash table for fast random access to cache entriesprotected intMaximum space allowed in cacheprotected intCounter for handing out sequential timestamps -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanmakeSpace(int space) Ensures there is the specified amount of free space in the receiver, by removing old entries if necessary.put(K key, JavaElementInfo value) Sets the value in the cache at the given key.Methods inherited from class ElementCache
close, ensureSpaceLimit, newInstance, resetSpaceLimitModifier and TypeMethodDescriptionprotected booleanclose(LRUCache.LRUCacheEntry<K, JavaElementInfo> entry) Returns true if the element is successfully closed and removed from the cache, otherwise false.protected voidensureSpaceLimit(JavaElementInfo info, IJavaElement parent) protected ElementCache<K> newInstance(int size, int newOverflow) Returns a new instance of the reciever.protected voidresetSpaceLimit(IJavaElement parent) Methods inherited from class OverflowingLRUCache
clone, elements, fillingRatio, getEntryTable, getLoadFactor, getOverflow, printStats, privateRemoveEntry, privateRemoveEntry, remove, setLoadFactor, setSpaceLimit, shrink, toString, updateTimestampModifier and TypeMethodDescriptionclone()Returns a new cache containing the same contents.elements()Returns an enumerator of the values in the cache with the most recently used first.doubleFor internal testing only.doubleReturns the load factor for the cache.intvoidFor testing purposes onlyprotected voidprivateRemoveEntry(LRUCache.LRUCacheEntry<K, JavaElementInfo> entry, boolean shuffle) Removes the entry from the entry queue.protected voidprivateRemoveEntry(LRUCache.LRUCacheEntry<K, JavaElementInfo> entry, boolean shuffle, boolean external) Removes the entry from the entry queue.Removes and returns the value in the cache for the given key.voidsetLoadFactor(double newLoadFactor) Sets the load factor for the cache.voidsetSpaceLimit(int limit) Sets the maximum amount of space that the cache can storebooleanshrink()Attempts to shrink the cache if it has overflown.toString()Returns a String that represents the value of this object.protected voidUpdates the timestamp for the given entry, ensuring that the queue is kept in correct order.Methods inherited from class LRUCache
flush, flush, get, getCurrentSpace, getKey, getNewestTimestampCounter, getOldestElement, getOldestTimestampCounter, getSpaceLimit, keys, keysAndValues, newInstance, peek, privateAdd, privateAddEntry, removeKey, spaceFor, toStringContents, toStringFillingRationModifier and TypeMethodDescriptionvoidflush()Flushes all entries from the cache.voidFlushes the given entry from the cache.Answers the value in the cache at the given key.intReturns the amount of space that is current used in the cache.intReturns the timestamps of the most recently used element in the cache.Returns the lest recently used element in the cache, can returnnullintReturns the timestamps of the least recently used element in the cache.intReturns the maximum amount of space available in the cache.keys()Returns an Enumeration of the keys currently in the cache.Returns an enumeration that iterates over all the keys and values currently in the cache.protected LRUCache<K, JavaElementInfo> newInstance(int size) Returns a new LRUCache instanceAnswers the value in the cache at the given key.protected voidprivateAdd(K key, JavaElementInfo value, int space) Adds an entry for the given key/value/space.protected voidprivateAddEntry(LRUCache.LRUCacheEntry<K, JavaElementInfo> entry, boolean shuffle) Adds the given entry from the receiver.Removes and returns the value in the cache for the given key.protected intspaceFor(JavaElementInfo value) Returns the space taken by the given value.protected StringReturns a String that represents the contents of this object.toStringFillingRation(String cacheName)
-
Constructor Details
-
VerboseElementCache
-
-
Method Details
-
makeSpace
protected boolean makeSpace(int space) Description copied from class:OverflowingLRUCacheEnsures there is the specified amount of free space in the receiver, by removing old entries if necessary. Returns true if the requested space was made available, false otherwise. May not be able to free enough space since some elements cannot be removed until they are saved.- Overrides:
makeSpacein classOverflowingLRUCache<K extends IJavaElement & IOpenable, JavaElementInfo>- Parameters:
space- Amount of space to free up
-
put
Description copied from class:LRUCacheSets the value in the cache at the given key. Returns the value.- Overrides:
putin classOverflowingLRUCache<K extends IJavaElement & IOpenable, JavaElementInfo>- Parameters:
key- Key of object to add.value- Value of object to add.- Returns:
- added value.
-