Package com.tenio.engine.ecs.base
Class Context<TEntity extends Entity>
- java.lang.Object
-
- com.tenio.engine.ecs.base.Context<TEntity>
-
-
Constructor Summary
Constructors Constructor Description Context(ContextInfo contextInfo, java.lang.Class<TEntity> clazz)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TEntity
createEntity()
Create new entityvoid
destroyAllEntities()
Remove all context's entitiesvoid
destroyEntity(TEntity entity)
Remove this entity from the current contextContextInfo
getContextInfo()
Retrieves the context informationint
getEntitesCount()
Retrieves the number of entitiesjava.util.Map<java.lang.String,TEntity>
getEntities()
Retrieves all entities of the current contextTEntity
getEntity(java.lang.String entityId)
Retrieves an entity by entity idboolean
hasEntity(TEntity entity)
Check if the entity is existed by entity idvoid
reset()
Reset the current context
-
-
-
Constructor Detail
-
Context
public Context(ContextInfo contextInfo, java.lang.Class<TEntity> clazz)
-
-
Method Detail
-
createEntity
public TEntity createEntity()
Description copied from interface:IContext
Create new entity- Specified by:
createEntity
in interfaceIContext<TEntity extends Entity>
- Returns:
- the entity by the corresponding entity template
-
getEntity
public TEntity getEntity(java.lang.String entityId)
Description copied from interface:IContext
Retrieves an entity by entity id
-
destroyEntity
public void destroyEntity(TEntity entity)
Description copied from interface:IContext
Remove this entity from the current context- Specified by:
destroyEntity
in interfaceIContext<TEntity extends Entity>
- Parameters:
entity
- the corresponding entity
-
hasEntity
public boolean hasEntity(TEntity entity)
Description copied from interface:IContext
Check if the entity is existed by entity id
-
getEntities
public java.util.Map<java.lang.String,TEntity> getEntities()
Description copied from interface:IContext
Retrieves all entities of the current context- Specified by:
getEntities
in interfaceIContext<TEntity extends Entity>
- Returns:
- the map of entities
-
getContextInfo
public ContextInfo getContextInfo()
Description copied from interface:IContext
Retrieves the context information- Specified by:
getContextInfo
in interfaceIContext<TEntity extends Entity>
- Returns:
- see
ContextInfo
-
getEntitesCount
public int getEntitesCount()
Description copied from interface:IContext
Retrieves the number of entities- Specified by:
getEntitesCount
in interfaceIContext<TEntity extends Entity>
- Returns:
- the entities count
-
destroyAllEntities
public void destroyAllEntities()
Description copied from interface:IContext
Remove all context's entities- Specified by:
destroyAllEntities
in interfaceIContext<TEntity extends Entity>
-
-