public class Entity extends java.lang.Object implements ComponentStore
| Constructor and Description |
|---|
Entity()
Creates a new
Entity with a generated ID and a DefaultComponentStore |
Entity(ComponentStore componentStore)
Creates a new
Entity with a generated ID with a specific ComponentStore implementaton |
Entity(int id)
Creates a new
Entity with a specific ID and a DefaultComponentStore |
Entity(int id,
ComponentStore componentStore)
Creates a new
Entity with a specific ID and ComponentStore implementation |
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(Entity child) |
void |
addComponent(Component component)
|
void |
addEntityListener(EntityListener listener)
Adds an
EntityListener to this Entity |
void |
destroy()
Destroys this
Entity and deallocates its ID |
java.util.List<Entity> |
getChildren() |
<T> T |
getComponent(java.lang.Class<T> clazz) |
<T> T |
getComponent(int componentTypeId) |
<T extends Component> |
getComponent(java.lang.String name,
java.lang.Class<T> clazz) |
<T extends Component> |
getComponent(java.lang.String name,
int componentTypeId) |
<T extends Component> |
getComponentInDescendants(java.lang.Class<T> clazz) |
<T extends Component> |
getComponentInDescendants(int componentTypeId) |
<T extends Component> |
getComponentInDescendants(java.lang.String name,
java.lang.Class<T> clazz) |
<T extends Component> |
getComponentInDescendants(java.lang.String name,
int componentTypeId) |
<T> java.util.SortedSet<T> |
getComponents(java.lang.Class<T> clazz)
Returns all
Components that implement the specified the class or
interface |
<T> java.util.SortedSet<T> |
getComponents(int componentTypeId)
Returns all
Components that implement the specified the class or
interface |
<T extends Component> |
getComponentsInDescendants(java.lang.Class<T> clazz) |
<T extends Component> |
getComponentsInDescendants(int componentTypeId) |
int |
getId() |
java.util.UUID |
getUUID() |
<T extends Component> |
removeAllComponentsOfType(java.lang.Class<T> clazz)
Removes all
Components that implement a specific type |
<T extends Component> |
removeAllComponentsOfType(int componentTypeId)
Removes all
Components that implement a specific type |
void |
removeChild(Entity child) |
void |
removeComponent(Component component)
|
void |
removeEntityListener(EntityListener listener)
Removes an
EntityListener from this Entity |
public Entity()
Entity with a generated ID and a DefaultComponentStorepublic Entity(int id)
Entity with a specific ID and a DefaultComponentStoreid - The ID to allocate this Entitypublic Entity(ComponentStore componentStore)
Entity with a generated ID with a specific ComponentStore implementatoncomponentStore - The ComponentStore implementation to usepublic Entity(int id,
ComponentStore componentStore)
Entity with a specific ID and ComponentStore implementationid - The ID to allocate this EntitycomponentStore - The ComponentStore implementation to usepublic void destroy()
Entity and deallocates its IDpublic void addChild(Entity child)
public void removeChild(Entity child)
public java.util.List<Entity> getChildren()
public <T> T getComponent(java.lang.Class<T> clazz)
getComponent in interface ComponentStorepublic <T extends Component> T getComponent(java.lang.String name, java.lang.Class<T> clazz)
getComponent in interface ComponentStorepublic <T extends Component> T getComponent(java.lang.String name, int componentTypeId)
getComponent in interface ComponentStorepublic void addComponent(Component component)
addComponent in interface ComponentStorecomponent - An instance of Componentpublic <T> java.util.SortedSet<T> getComponents(java.lang.Class<T> clazz)
Components that implement the specified the class or
interfacegetComponents in interface ComponentStoreclazz - The Class to search forList if no such Components are attached
to this Entitypublic void removeComponent(Component component)
removeComponent in interface ComponentStorecomponent - The Component to removepublic <T extends Component> java.util.SortedSet<T> removeAllComponentsOfType(java.lang.Class<T> clazz)
Components that implement a specific typeremoveAllComponentsOfType in interface ComponentStoreclazz - The Class to search forpublic <T> T getComponent(int componentTypeId)
getComponent in interface ComponentStorepublic <T> java.util.SortedSet<T> getComponents(int componentTypeId)
ComponentStoreComponents that implement the specified the class or
interfacegetComponents in interface ComponentStorecomponentTypeId - The unique identifier of the component typeList if no such Components are attached
to this Entitypublic <T extends Component> java.util.SortedSet<T> removeAllComponentsOfType(int componentTypeId)
ComponentStoreComponents that implement a specific typeremoveAllComponentsOfType in interface ComponentStorecomponentTypeId - The unique identifier of the component typepublic <T extends Component> T getComponentInDescendants(java.lang.Class<T> clazz)
public <T extends Component> T getComponentInDescendants(int componentTypeId)
public <T extends Component> T getComponentInDescendants(java.lang.String name, java.lang.Class<T> clazz)
public <T extends Component> T getComponentInDescendants(java.lang.String name, int componentTypeId)
public <T extends Component> java.util.SortedSet<T> getComponentsInDescendants(java.lang.Class<T> clazz)
public <T extends Component> java.util.SortedSet<T> getComponentsInDescendants(int componentTypeId)
public void addEntityListener(EntityListener listener)
EntityListener to this Entitylistener - The EntityListener to addpublic void removeEntityListener(EntityListener listener)
EntityListener from this Entitylistener - The EntityListener to be removedpublic java.util.UUID getUUID()
public int getId()