Class Index

java.lang.Object
gaiasky.scene.Index

public class Index extends Object
Index, which maintains dictionaries with name-object pairs.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    Represents a name conflict.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Archetypes
    The 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

    Constructors
    Constructor
    Description
    Index(Archetypes archetypes, int numberEntities)
    Creates a new index with the given archetypes and initial number of entities.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addToHipMapInit(com.badlogic.ashley.core.Entity entity)
     
    void
    addToHipMapSetUp(com.badlogic.ashley.core.Entity entity)
     
    boolean
    addToIndexInit(com.badlogic.ashley.core.Entity entity)
    Adds the given node to the index.
    void
    addToIndexSetUp(com.badlogic.ashley.core.Entity entity)
     
    boolean
    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.Entity
    Returns the entity identified with the given name, or null if it is not found.
    com.badlogic.gdx.utils.IntMap<IPosition>
     
    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 of maxResults.
    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 of maxResults.
    void
    remove(com.badlogic.ashley.core.Entity entity)
    Removes the given entity from the index.
    void
    Removes the given key from the index.
    void
    remove(String[] keys)
    Removes the given keys from the index.
    void
    Removes the entities in the given particle set from this index.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • index

      protected final FastStringObjectMap<com.badlogic.ashley.core.Entity> index
      Quick lookup map. Name to node.
    • conflicts

      protected final com.badlogic.gdx.utils.Array<Index.NameConflict> conflicts
      Index name conflicts for the current session, stored as pairs of entities with additional metadata.
    • hipMap

      protected final com.badlogic.gdx.utils.IntMap<IPosition> hipMap
      Map from integer to position with all Hipparcos stars, for the constellations.
    • archetypes

      protected Archetypes archetypes
      The archetypes' container.
  • Constructor Details

    • Index

      public Index(Archetypes archetypes, int numberEntities)
      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

      public com.badlogic.ashley.core.Entity getEntity(String name)
      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

      public boolean containsEntity(String name)
      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.
    • addToIndexInit

      public boolean addToIndexInit(com.badlogic.ashley.core.Entity entity)
      Adds the given node to the index. This only adds to index entities in the scene graph, it does not descend onto particles in particle sets.
      Parameters:
      entity - The entity to add.
      Returns:
      True if at least one entry has been added to the index for this entity, false otherwise.
    • addToIndexSetUp

      public void addToIndexSetUp(com.badlogic.ashley.core.Entity entity)
    • getHipMap

      public com.badlogic.gdx.utils.IntMap<IPosition> getHipMap()
    • addToHipMapInit

      public void addToHipMapInit(com.badlogic.ashley.core.Entity entity)
    • addToHipMapSetUp

      public void addToHipMapSetUp(com.badlogic.ashley.core.Entity entity)
    • remove

      public void remove(String key)
      Removes the given key from the index.
    • remove

      public void remove(String[] keys)
      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

      public void removeFromIndex(ParticleSet set)
      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 of maxResults. The abort 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.
    • 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 of maxResults. The abort 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.
    • getConflicts

      public com.badlogic.gdx.utils.Array<Index.NameConflict> getConflicts()
      Gets the name conflicts list for this session.
      Returns:
      The name conflicts.