Class Index

java.lang.Object
gaiasky.scene.Index

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

    Fields
    Modifier and Type
    Field
    Description
    protected Archetypes
    The archetypes' container.
    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
    addToHipMap(com.badlogic.ashley.core.Entity entity)
     
    boolean
    addToIndex(com.badlogic.ashley.core.Entity entity)
    Adds the given node to the index.
    boolean
    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.
    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
    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 java.lang.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.
    • 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.
    • 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

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

      public void addToHipMap(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.