Class Index
java.lang.Object
gaiasky.scene.Index
Index, which maintains dictionaries with name-object pairs.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a name conflict. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ArchetypesThe archetypes' container.protected final com.badlogic.gdx.utils.Array<Index.NameConflict> Index name conflicts for the current session, stored as pairs of entities with additional metadata.protected final com.badlogic.gdx.utils.IntMap<IPosition> Map from integer to position with all Hipparcos stars, for the constellations.protected final FastStringObjectMap<com.badlogic.ashley.core.Entity> Quick lookup map. -
Constructor Summary
ConstructorsConstructorDescriptionIndex(Archetypes archetypes, int numberEntities) Creates a new index with the given archetypes and initial number of entities. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToHipMap(com.badlogic.ashley.core.Entity entity) booleanaddToIndex(com.badlogic.ashley.core.Entity entity) Adds the given node to the index.booleancontainsEntity(String name) Checks whether the index contains an entity with the given name.com.badlogic.gdx.utils.Array<Index.NameConflict> Gets the name conflicts list for this session.com.badlogic.ashley.core.EntityReturns the entity identified with the given name, or null if it is not found.com.badlogic.gdx.utils.IntMap<IPosition> voidmatchingFocusableNodes(String name, SortedSet<String> results, int maxResults, AtomicBoolean abort) Returns focus entities in this index matching the given string by name, to a maximum ofmaxResults.voidmatchingNodes(String name, SortedSet<String> results, int maxResults, AtomicBoolean abort) Returns entities in this index matching the given string by name, to a maximum ofmaxResults.voidremove(com.badlogic.ashley.core.Entity entity) Removes the given entity from the index.voidRemoves the given key from the index.voidRemoves the given keys from the index.voidRemoves the entities in the given particle set from this index.
-
Field Details
-
index
Quick lookup map. Name to node. -
conflicts
Index name conflicts for the current session, stored as pairs of entities with additional metadata. -
hipMap
Map from integer to position with all Hipparcos stars, for the constellations. -
archetypes
The archetypes' container.
-
-
Constructor Details
-
Index
Creates a new index with the given archetypes and initial number of entities.- Parameters:
archetypes- The archetypes.numberEntities- The initial number of entities in the index.
-
-
Method Details
-
getEntity
Returns the entity identified with the given name, or null if it is not found.- Parameters:
name- The name of the entity.- Returns:
- The entity, or null if it does not exist.
-
containsEntity
Checks whether the index contains an entity with the given name.- Parameters:
name- The name of the entity.- Returns:
- True if the index contains an entity with the given name. False otherwise.
-
addToIndex
public boolean addToIndex(com.badlogic.ashley.core.Entity entity) Adds the given node to the index.- Parameters:
entity- The entity to add.- Returns:
- True if at least one entry has been added to the index for this entity, false otherwise.
-
getHipMap
-
addToHipMap
public void addToHipMap(com.badlogic.ashley.core.Entity entity) -
remove
Removes the given key from the index. -
remove
Removes the given keys from the index. -
remove
public void remove(com.badlogic.ashley.core.Entity entity) Removes the given entity from the index.- Parameters:
entity- The entity to remove.
-
removeFromIndex
Removes the entities in the given particle set from this index. -
matchingFocusableNodes
public void matchingFocusableNodes(String name, SortedSet<String> results, int maxResults, AtomicBoolean abort) Returns focus entities in this index matching the given string by name, to a maximum ofmaxResults. Theabortatomic boolean can be used to stop the computation.- Parameters:
name- The name.results- The set where the results are to be stored.maxResults- The maximum number of results.abort- To enable abortion mid-computation.
-
matchingNodes
public void matchingNodes(String name, SortedSet<String> results, int maxResults, AtomicBoolean abort) Returns entities in this index matching the given string by name, to a maximum ofmaxResults. Theabortatomic boolean can be used to stop the computation.- Parameters:
name- The name.results- The set where the results are to be stored.maxResults- The maximum number of results.abort- To enable abortion mid-computation.
-
getConflicts
Gets the name conflicts list for this session.- Returns:
- The name conflicts.
-