public class SegmentConstantPoolArrayCache extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected class |
SegmentConstantPoolArrayCache.CachedArray
CachedArray keeps track of the last known size of an array as well as a HashMap that knows the mapping from
element values to the indices of the array which contain that value.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.IdentityHashMap |
knownArrays |
protected java.lang.String[] |
lastArray |
protected java.util.List |
lastIndexes |
protected java.lang.String |
lastKey |
Constructor and Description |
---|
SegmentConstantPoolArrayCache() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
arrayIsCached(java.lang.String[] array)
Given a String array, answer true if the array is correctly cached.
|
protected void |
cacheArray(java.lang.String[] array)
Cache the array passed in as the argument
|
java.util.List |
indexesForArrayKey(java.lang.String[] array,
java.lang.String key)
Answer the indices for the given key in the given array.
|
protected java.util.IdentityHashMap knownArrays
protected java.util.List lastIndexes
protected java.lang.String[] lastArray
protected java.lang.String lastKey
public SegmentConstantPoolArrayCache()
public java.util.List indexesForArrayKey(java.lang.String[] array, java.lang.String key)
array
- String[] array to search for the valuekey
- String value for which to searchprotected boolean arrayIsCached(java.lang.String[] array)
array
- of Stringprotected void cacheArray(java.lang.String[] array)
array
- String[] to cache