public final class SmallDefinitionStore8 extends SmallDefinitionStoreBase
IDefinitionStore
for storing
up to 8 definitions using 8 fields rather than a map.
Many scopes contain only a handful of definitions.
The methods of this class are optimized to use unrolled loops.
EMPTY_STRING_ARRAY
Constructor and Description |
---|
SmallDefinitionStore8()
Constructor.
|
SmallDefinitionStore8(SmallDefinitionStore4 other)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
IDefinitionStore |
createLargerStore()
Creates another definition store with a greater capacity.
|
protected int |
findAvailableIndex()
Returns the index of the first null field where a new definition set
can be stored.
|
protected int |
findIndexForBaseName(String baseName)
Returns the index of the field storing a definition set with the
specified base name, or -1 if there is no such field.
|
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 number of fields for storing definition sets.
|
protected IDefinitionSet |
getDefinitionSet(int i)
Gets the definition set stored in the specified field.
|
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.
|
protected void |
setDefinitionSet(int i,
IDefinitionSet definitionSet)
Sets the specified definition set into the specified field.
|
add, addBaseNameToList, addDefinitionSetToList, addDefinitionsToList, addDefinitionToSet, getBaseName, remove, removeDefinitionFromSet, toString
public SmallDefinitionStore8()
public SmallDefinitionStore8(SmallDefinitionStore4 other)
public int getCapacity()
SmallDefinitionStoreBase
getCapacity
in interface IDefinitionStore
getCapacity
in class SmallDefinitionStoreBase
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.
IDefinitionStore
with a greater capacity.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
getDefinitionSetByName
in class SmallDefinitionStoreBase
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.
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
public Collection<IDefinitionSet> getAllDefinitionSets()
IDefinitionStore
IDefinitionSet
objects.public Collection<IDefinition> getAllDefinitions()
IDefinitionStore
IDefinition
objects.protected int findIndexForBaseName(String baseName)
SmallDefinitionStoreBase
findIndexForBaseName
in class SmallDefinitionStoreBase
baseName
- The base name to look for.protected int findAvailableIndex()
SmallDefinitionStoreBase
findAvailableIndex
in class SmallDefinitionStoreBase
protected IDefinitionSet getDefinitionSet(int i)
SmallDefinitionStoreBase
getDefinitionSet
in class SmallDefinitionStoreBase
i
- The index of the field.IDefinitionSet
store there.protected void setDefinitionSet(int i, IDefinitionSet definitionSet)
SmallDefinitionStoreBase
setDefinitionSet
in class SmallDefinitionStoreBase
i
- The index of the field.definitionSet
- The IDefinitionSet
to store there.Copyright © 2016 The Apache Software Foundation. All rights reserved.