public final class EmptyDefinitionStore extends Object implements IDefinitionStore
IDefinitionStore
that stores no definitions.
Many scopes do not need to store any definitions.
(For example, consider a typical getter.)
If scopes always have a non-null store, it makes the code simpler.
However, every empty store behaves the same and therefore scopes with
empty stores all share the singleton instance provided by
EmptyDefinitionStore.SINGLETON
.
Modifier and Type | Field and Description |
---|---|
static IDefinitionStore |
SINGLETON
The singleton instance of this class.
|
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.
|
public static final IDefinitionStore SINGLETON
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.Copyright © 2016 The Apache Software Foundation. All rights reserved.