public interface IDefinitionStore
IDefinitionStore
is used by a scope to store a collection
of definitions, organized into sets of definition sthat have the same
base name.
The IDefinitionStore
is completely private to the scope
and is not exposed by any scope APIs.
Since many scopes contain only a few definitions, there are multiple implementations of this interface, optimized for storing 0, 1, 2, 4, 8, and an unlimited number of definitions.
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.
|
int getCapacity()
IDefinitionStore createLargerStore()
When a call to 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.boolean add(IDefinition definition)
definition
- The IDefinition
to add.IDefinitionStore
have limited storage capacity, as a memory
optimization.boolean remove(IDefinition definition)
definition
- The IDefinition
to remove.IDefinitionSet getDefinitionSetByName(String baseName)
This method is called very frequently as part of name resolution. All implementations should be fast and avoid creating temporary objects.
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.void putDefinitionSetByName(String baseName, IDefinitionSet set)
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.Collection<String> getAllNames()
Collection<IDefinitionSet> getAllDefinitionSets()
IDefinitionSet
objects.Collection<IDefinition> getAllDefinitions()
IDefinition
objects.Copyright © 2016 The Apache Software Foundation. All rights reserved.