public interface IEntity extends ISerializable
| Modifier and Type | Method and Description |
|---|---|
default boolean |
addComponent(IComponent componentToAdd)
Attempt to add a component (non force).
|
default java.util.List<java.lang.Boolean> |
addComponents(IComponent... componentsToAdd)
Attempt to add a array/varargs of components (non force).
|
default java.util.List<java.lang.Boolean> |
addComponents(java.util.List<IComponent> componentsToAdd)
Attempt to add a list of components (non force).
|
void |
addGroupIDs(java.lang.String... groupIDs)
Adds groups IDs
|
boolean |
forceAddComponent(IComponent componentToAdd,
boolean forceAdd)
Force add a component regardless of specs (enable true forceAdd).
|
default java.util.List<java.lang.Boolean> |
forceAddComponents(boolean forceAdd,
IComponent... componentsToAdd)
Force add array/vargs of components regardless of specs (enable true
forceAdd).
|
default java.util.List<java.lang.Boolean> |
forceAddComponents(java.util.List<IComponent> componentsToAdd,
boolean forceAdd)
Force add list of components regardless of specs (enable true forceAdd).
|
java.util.Collection<IComponent> |
getAllComponents()
Get all the components of this entity.
|
default <T extends IComponent> |
getComponent(java.lang.Class<T> componentClass)
Get a single component of this type.
|
default <T extends IComponent> |
getComponent(java.lang.Class<T> componentClass,
int index)
Get a component of this type that was the index inserted.
|
java.util.Set<java.lang.Class<? extends IComponent>> |
getComponentClasses()
Return all the component classes this entity contains.
|
<T extends IComponent> |
getComponentList(java.lang.Class<T> componentClass)
Get a list of components of this component type.
|
java.util.Set<java.lang.String> |
getGroupIDs()
Gets the group IDs
|
java.lang.String |
getID()
Gets the unique id of this entity
|
java.lang.String |
getName()
Get this Entity's name.
|
default int |
getSpec(java.lang.Class<? extends IComponent> componentClass)
Get spec of a componentClass (how many components for this class).
|
java.util.Map<java.lang.Class<? extends IComponent>,java.lang.Integer> |
getSpecs()
Get the specs, which is a map of component classes to how many this
entity should have of each.
|
<T extends IComponent> |
hasComponent(java.lang.Class<T> componentClass)
Check if this entity has this component.
|
default boolean |
hasComponents(java.lang.Class<? extends IComponent>... componentClasses)
Check if this entity has this array/varargs of components.
|
default boolean |
hasComponents(java.util.List<java.lang.Class<? extends IComponent>> componentClasses)
Check if this entity has this list of components.
|
default void |
loadSpecsFromPropertiesFile(java.lang.String fileName)
Load the specs from a resource properties file.
|
default java.lang.Boolean |
removeAllComponents()
Remove all the components of this entity.
|
java.lang.Boolean |
removeComponent(java.lang.Class<? extends IComponent> componentClassToRemove)
Remove a component.
|
default java.util.List<java.lang.Boolean> |
removeComponents(java.lang.Class<? extends IComponent>... componentClassesToRemove)
Remove array/varargs of components
|
default java.util.List<java.lang.Boolean> |
removeComponents(java.util.List<java.lang.Class<? extends IComponent>> componentClassesToRemove)
Remove list of components
|
void |
setGroupIDs(java.util.Set<java.lang.String> groupIDs)
Sets the groups IDs
|
void |
setName(java.lang.String name)
Set this entity's name.
|
default <T extends IComponent> |
setSpec(java.lang.Class<T> componentClass,
int numToHave)
Add a spec.
|
default void |
setSpecs(java.util.Map<java.lang.Class<? extends IComponent>,java.lang.Integer> map)
Set specs with a map.
|
clone, serialize, serializeToStringjava.lang.String getName()
void setName(java.lang.String name)
name - this entity's new namejava.lang.String getID()
java.util.Set<java.lang.String> getGroupIDs()
void setGroupIDs(java.util.Set<java.lang.String> groupIDs)
groupIDs - the group IDsvoid addGroupIDs(java.lang.String... groupIDs)
groupIDs - additional group IDsjava.util.Collection<IComponent> getAllComponents()
<T extends IComponent> java.util.List<T> getComponentList(java.lang.Class<T> componentClass)
T - type of componentcomponentClass - the class of componentdefault <T extends IComponent> T getComponent(java.lang.Class<T> componentClass)
T - the type of componentcomponentClass - the class of componentdefault <T extends IComponent> T getComponent(java.lang.Class<T> componentClass, int index) throws java.lang.IllegalArgumentException
T - the type of componentcomponentClass - the class of componentindex - the component number that it was insertedjava.lang.IllegalArgumentException - if no such indexgetComponentList(Class)java.util.Set<java.lang.Class<? extends IComponent>> getComponentClasses()
<T extends IComponent> boolean hasComponent(java.lang.Class<T> componentClass)
T - type of componentcomponentClass - to checkdefault boolean hasComponents(java.util.List<java.lang.Class<? extends IComponent>> componentClasses)
componentClasses - list of components to checkhasComponent(Class)default boolean hasComponents(java.lang.Class<? extends IComponent>... componentClasses)
componentClasses - list of components to checkhasComponents(List)boolean forceAddComponent(IComponent componentToAdd, boolean forceAdd)
componentToAdd - the component to addforceAdd - whether to force add this componentdefault java.util.List<java.lang.Boolean> forceAddComponents(java.util.List<IComponent> componentsToAdd, boolean forceAdd)
componentsToAdd - the components to addforceAdd - whether to force add these componentsforceAddComponent(IComponent, boolean)default java.util.List<java.lang.Boolean> forceAddComponents(boolean forceAdd,
IComponent... componentsToAdd)
componentsToAdd - the components to addforceAdd - whether to force add these componentsforceAddComponents(List, boolean)default boolean addComponent(IComponent componentToAdd)
componentToAdd - the component to addforceAddComponent(IComponent, boolean)default java.util.List<java.lang.Boolean> addComponents(java.util.List<IComponent> componentsToAdd)
componentsToAdd - list of components to addforceAddComponents(List, boolean)default java.util.List<java.lang.Boolean> addComponents(IComponent... componentsToAdd)
componentsToAdd - array/varargs of components to addaddComponents(List)java.lang.Boolean removeComponent(java.lang.Class<? extends IComponent> componentClassToRemove)
T - type of componentcomponentClassToRemove - component class to removedefault java.util.List<java.lang.Boolean> removeComponents(java.util.List<java.lang.Class<? extends IComponent>> componentClassesToRemove)
componentClassesToRemove - list of component classes to removeremoveComponent(Class)default java.util.List<java.lang.Boolean> removeComponents(java.lang.Class<? extends IComponent>... componentClassesToRemove)
componentClassesToRemove - array/varargs of component classes to removeremoveComponents(List)default java.lang.Boolean removeAllComponents()
java.util.Map<java.lang.Class<? extends IComponent>,java.lang.Integer> getSpecs()
default void loadSpecsFromPropertiesFile(java.lang.String fileName)
fileName - the fileNamedefault void setSpecs(java.util.Map<java.lang.Class<? extends IComponent>,java.lang.Integer> map)
map - to set specs withgetSpecs()default int getSpec(java.lang.Class<? extends IComponent> componentClass)
componentClass - componentClass whose spec to getgetSpecs()default <T extends IComponent> void setSpec(java.lang.Class<T> componentClass, int numToHave)
T - type of componentcomponentClass - class of the componentnumToHave - how many this entity should have of this componentgetSpecs()