Interface IContext<TEntity extends IEntity>

  • Type Parameters:
    TEntity - the entity template
    All Known Implementing Classes:
    Context

    public interface IContext<TEntity extends IEntity>
    A context is used to manage all relative entities and components.
    Author:
    kong
    • Method Detail

      • createEntity

        TEntity createEntity()
        Create new entity
        Returns:
        the entity by the corresponding entity template
      • getEntity

        TEntity getEntity​(java.lang.String entityId)
        Retrieves an entity by entity id
        Parameters:
        entityId - the entity id
        Returns:
        the corresponding entity
      • hasEntity

        boolean hasEntity​(TEntity entity)
        Check if the entity is existed by entity id
        Parameters:
        entity - the entity
        Returns:
        true if this entity is existed in the current context, false otherwise
      • destroyEntity

        void destroyEntity​(TEntity entity)
        Remove this entity from the current context
        Parameters:
        entity - the corresponding entity
      • getEntities

        java.util.Map<java.lang.String,​TEntity> getEntities()
        Retrieves all entities of the current context
        Returns:
        the map of entities
      • getEntitesCount

        int getEntitesCount()
        Retrieves the number of entities
        Returns:
        the entities count
      • destroyAllEntities

        void destroyAllEntities()
        Remove all context's entities
      • reset

        void reset()
        Reset the current context