public final class LargeDefinitionStore extends HashMap<String,IDefinitionSet> implements IDefinitionStore
IDefinitionStore for large numbers of definitions.
This implementation extends HashMap, instead of having a HashMap, in order to save memory. The keys of the map are the base names of the definitions. The values of the map are definition sets containing definitions with the same base name.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
LargeDefinitionStore()
Constructor.
|
LargeDefinitionStore(SmallDefinitionStore8 store)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(IDefinition definition)
Adds a definition to this store.
|
IDefinitionStore |
createLargerStore()
Creates another definition store with a greater capacity.
|
Collection<IDefinition> |
getAllDefinitions()
Gets all the definitions in this store.
|
Collection<IDefinitionSet> |
getAllDefinitionSets()
Gets all the definitions sets in this store.
|
Collection<String> |
getAllNames()
Gets the base names of all the definition sets in this store.
|
int |
getCapacity()
Gets the maximum number of definition sets that this
definition store can hold.
|
IDefinitionSet |
getDefinitionSetByName(String baseName)
Gets the set of definitions in this store that have a specified base name.
|
void |
putDefinitionSetByName(String baseName,
IDefinitionSet set)
Puts a specified set of definitions with a specified base name
into this store.
|
boolean |
remove(IDefinition definition)
Removes a definition from this store.
|
String |
toString()
For debugging only.
|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, valuesequals, hashCodepublic LargeDefinitionStore()
public LargeDefinitionStore(SmallDefinitionStore8 store)
public int getCapacity()
IDefinitionStoregetCapacity in interface IDefinitionStorepublic IDefinitionStore createLargerStore()
IDefinitionStore
When a call to IDefinitionStore.add(org.apache.flex.compiler.definitions.IDefinition)() on this store returns false
(because the store has reached its capacity), call this method
to create a larger store and then call add()) on it.
The second add() is guaranteed to succeed.
createLargerStore in interface IDefinitionStoreIDefinitionStore with a greater capacity.public boolean add(IDefinition definition)
IDefinitionStoreadd in interface IDefinitionStoredefinition - The IDefinition to add.IDefinitionStore have limited storage capacity, as a memory
optimization.public boolean remove(IDefinition definition)
IDefinitionStoreremove in interface IDefinitionStoredefinition - The IDefinition to remove.public IDefinitionSet getDefinitionSetByName(String baseName)
IDefinitionStoreThis method is called very frequently as part of name resolution. All implementations should be fast and avoid creating temporary objects.
getDefinitionSetByName in interface IDefinitionStorebaseName - The base name of the definitions you want to retrieve
from the store.IDefinitionSet containing the definition with that
base name, or null if there are none.public void putDefinitionSetByName(String baseName, IDefinitionSet set)
IDefinitionStoreThis is only used when a project scope has to replace a definition set in its store because it has converted definition promises in the set to actual definitions.
putDefinitionSetByName in interface IDefinitionStorebaseName - The base name of the definitions in the set.set - The IDefinitionSet of definitions to put
into the store.public Collection<String> getAllNames()
IDefinitionStoregetAllNames in interface IDefinitionStorepublic Collection<IDefinitionSet> getAllDefinitionSets()
IDefinitionStoregetAllDefinitionSets in interface IDefinitionStoreIDefinitionSet objects.public Collection<IDefinition> getAllDefinitions()
IDefinitionStoregetAllDefinitions in interface IDefinitionStoreIDefinition objects.public String toString()
toString in class AbstractMap<String,IDefinitionSet>Copyright © 2016 The Apache Software Foundation. All rights reserved.