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, values
equals, hashCode
public LargeDefinitionStore()
public LargeDefinitionStore(SmallDefinitionStore8 store)
public int getCapacity()
IDefinitionStore
getCapacity
in interface IDefinitionStore
public 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 IDefinitionStore
IDefinitionStore
with a greater capacity.public boolean add(IDefinition definition)
IDefinitionStore
add
in interface IDefinitionStore
definition
- The IDefinition
to add.IDefinitionStore
have limited storage capacity, as a memory
optimization.public boolean remove(IDefinition definition)
IDefinitionStore
remove
in interface IDefinitionStore
definition
- The IDefinition
to remove.public IDefinitionSet getDefinitionSetByName(String baseName)
IDefinitionStore
This method is called very frequently as part of name resolution. All implementations should be fast and avoid creating temporary objects.
getDefinitionSetByName
in interface IDefinitionStore
baseName
- 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)
IDefinitionStore
This 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 IDefinitionStore
baseName
- The base name of the definitions in the set.set
- The IDefinitionSet
of definitions to put
into the store.public Collection<String> getAllNames()
IDefinitionStore
getAllNames
in interface IDefinitionStore
public Collection<IDefinitionSet> getAllDefinitionSets()
IDefinitionStore
getAllDefinitionSets
in interface IDefinitionStore
IDefinitionSet
objects.public Collection<IDefinition> getAllDefinitions()
IDefinitionStore
getAllDefinitions
in interface IDefinitionStore
IDefinition
objects.public String toString()
toString
in class AbstractMap<String,IDefinitionSet>
Copyright © 2016 The Apache Software Foundation. All rights reserved.