Class EntityNameCache

java.lang.Object
technology.sola.ecs.cache.EntityNameCache

@NullMarked public class EntityNameCache extends Object
The EntityNameCache class handles caching Entity by their name for quicker searching by name.
  • Constructor Details

    • EntityNameCache

      public EntityNameCache()
  • Method Details

    • get

      public @Nullable Entity get(String name)
      Returns the Entity with desired name or null if not found.
      Parameters:
      name - the name to check the cache for
      Returns:
      the desired Entity or null
    • update

      public void update(Entity entity, @Nullable String previousName)
      Updates the cache for an Entity using its previous name as reference. This will remove the entity from its previous name and add it for its new one.
      Parameters:
      entity - the Entity to update the cache for
      previousName - the previous name of the Entity
    • remove

      public void remove(@Nullable String name)
      Removes an Entity from the cache by its name.
      Parameters:
      name - the name of the Entity to remove