public class DefaultEntityData extends java.lang.Object implements ObservableEntityData
Constructor and Description |
---|
DefaultEntityData() |
DefaultEntityData(EntityIdGenerator idGenerator) |
Modifier and Type | Method and Description |
---|---|
void |
addEntityComponentListener(EntityComponentListener l) |
void |
close() |
EntityId |
createEntity() |
protected DefaultEntitySet |
createSet(ComponentFilter filter,
java.lang.Class... types) |
protected void |
entityChange(EntityChange change) |
java.util.Set<EntityId> |
findEntities(ComponentFilter filter,
java.lang.Class... types) |
EntityId |
findEntity(ComponentFilter filter,
java.lang.Class... types) |
protected EntityId |
findSingleEntity(ComponentFilter filter) |
protected ComponentFilter |
forType(ComponentFilter filter,
java.lang.Class type) |
<T extends EntityComponent> |
getComponent(EntityId entityId,
java.lang.Class<T> type) |
EntitySet |
getEntities(java.lang.Class... types) |
EntitySet |
getEntities(ComponentFilter filter,
java.lang.Class... types) |
Entity |
getEntity(EntityId entityId,
java.lang.Class... types) |
protected java.util.Set<EntityId> |
getEntityIds(java.lang.Class type) |
protected java.util.Set<EntityId> |
getEntityIds(java.lang.Class type,
ComponentFilter filter) |
protected <T extends EntityComponent> |
getHandler(java.lang.Class type) |
StringIndex |
getStrings() |
protected <T extends EntityComponent> |
hasHandler(java.lang.Class<T> type)
Returns true if a handler has already been resolved for the specified
type.
|
protected <T extends EntityComponent> |
lookupDefaultHandler(java.lang.Class<T> type)
When no specific type handler exists, this attempts to
find an appropriate handler.
|
protected <T extends EntityComponent> |
registerComponentHandler(java.lang.Class<T> type,
ComponentHandler<T> handler) |
protected void |
releaseEntitySet(EntitySet entities) |
<T extends EntityComponent> |
removeComponent(EntityId entityId,
java.lang.Class<T> type) |
void |
removeEntity(EntityId entityId) |
void |
removeEntityComponentListener(EntityComponentListener l) |
protected void |
replace(Entity e,
EntityComponent oldValue,
EntityComponent newValue) |
<T extends EntityComponent> |
setComponent(EntityId entityId,
T component) |
void |
setComponents(EntityId entityId,
EntityComponent... components) |
protected void |
setIdGenerator(EntityIdGenerator idGenerator) |
protected void |
setStringIndex(StringIndex stringIndex) |
WatchedEntity |
watchEntity(EntityId id,
java.lang.Class... types) |
public DefaultEntityData()
public DefaultEntityData(EntityIdGenerator idGenerator)
protected void setIdGenerator(EntityIdGenerator idGenerator)
protected void setStringIndex(StringIndex stringIndex)
protected <T extends EntityComponent> void registerComponentHandler(java.lang.Class<T> type, ComponentHandler<T> handler)
public void addEntityComponentListener(EntityComponentListener l)
addEntityComponentListener
in interface ObservableEntityData
public void removeEntityComponentListener(EntityComponentListener l)
removeEntityComponentListener
in interface ObservableEntityData
public void close()
close
in interface EntityData
public EntityId createEntity()
createEntity
in interface EntityData
public void removeEntity(EntityId entityId)
removeEntity
in interface EntityData
public StringIndex getStrings()
getStrings
in interface EntityData
protected <T extends EntityComponent> ComponentHandler<T> lookupDefaultHandler(java.lang.Class<T> type)
protected <T extends EntityComponent> boolean hasHandler(java.lang.Class<T> type)
protected <T extends EntityComponent> ComponentHandler<T> getHandler(java.lang.Class type)
public <T extends EntityComponent> T getComponent(EntityId entityId, java.lang.Class<T> type)
getComponent
in interface EntityData
public <T extends EntityComponent> void setComponent(EntityId entityId, T component)
setComponent
in interface EntityData
public <T extends EntityComponent> boolean removeComponent(EntityId entityId, java.lang.Class<T> type)
removeComponent
in interface EntityData
protected EntityId findSingleEntity(ComponentFilter filter)
protected java.util.Set<EntityId> getEntityIds(java.lang.Class type)
protected java.util.Set<EntityId> getEntityIds(java.lang.Class type, ComponentFilter filter)
protected DefaultEntitySet createSet(ComponentFilter filter, java.lang.Class... types)
protected void replace(Entity e, EntityComponent oldValue, EntityComponent newValue)
public void setComponents(EntityId entityId, EntityComponent... components)
setComponents
in interface EntityData
public Entity getEntity(EntityId entityId, java.lang.Class... types)
getEntity
in interface EntityData
public EntitySet getEntities(java.lang.Class... types)
getEntities
in interface EntityData
protected ComponentFilter forType(ComponentFilter filter, java.lang.Class type)
public EntityId findEntity(ComponentFilter filter, java.lang.Class... types)
findEntity
in interface EntityData
public java.util.Set<EntityId> findEntities(ComponentFilter filter, java.lang.Class... types)
findEntities
in interface EntityData
public EntitySet getEntities(ComponentFilter filter, java.lang.Class... types)
getEntities
in interface EntityData
public WatchedEntity watchEntity(EntityId id, java.lang.Class... types)
watchEntity
in interface EntityData
protected void releaseEntitySet(EntitySet entities)
protected void entityChange(EntityChange change)