Package gaiasky.scene
Class Index
java.lang.Object
gaiasky.scene.Index
-
Field Summary
Modifier and TypeFieldDescriptionprotected Archetypes
The archetypes container.Map from integer to position with all Hipparcos stars, for the constellations.Quick lookup map. -
Constructor Summary
ConstructorDescriptionIndex
(Archetypes archetypes, int numberEntities) Creates a new index with the given archetypes and initial number of entities. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToHipMap
(com.badlogic.ashley.core.Entity entity) boolean
addToIndex
(com.badlogic.ashley.core.Entity entity) Adds the given node to the index.boolean
containsEntity
(String name) Checks whether the index contains an entity with the given name.com.badlogic.ashley.core.Entity
Returns the entity identified with the given name, or null if it is not found.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
.void
remove
(com.badlogic.ashley.core.Entity entity) Removes the given entity from the index.void
Removes the given key from the index.void
Removes the given keys from the index.void
Removes the entities in the given particle set from this index.
-
Field Details
-
index
Quick lookup map. Name to node. -
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. Returns false if it was not added due to a naming conflict (name already exists) with the same object (same class and same names).- Parameters:
entity
- The entity to add.- Returns:
- False if the object already exists.
-
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
. Theabort
atomic 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.
-