Package gaiasky.scene

Class Index

java.lang.Object
gaiasky.scene.Index

public class Index extends Object
  • Field Details

    • index

      protected final Map<String,com.badlogic.ashley.core.Entity> index
      Quick lookup map. Name to node.
    • hipMap

      protected final Map<Integer,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 Map<Integer,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.