A
- Component type to map.public class ComponentMapper<A extends Component> extends BaseComponentMapper<A>
type
Constructor and Description |
---|
ComponentMapper(Class<A> type,
World world) |
Modifier and Type | Method and Description |
---|---|
A |
create(int entityId)
Create component for this entity.
|
A |
get(int entityId)
Fast but unsafe retrieval of a component for this entity.
|
boolean |
has(int entityId)
Checks if the entity has this type of component.
|
A |
internalCreate(int entityId) |
protected void |
internalRemove(int entityId) |
void |
remove(int entityId)
Remove component from entity.
|
public A get(int entityId) throws ArrayIndexOutOfBoundsException
No bounding checks, so this could throw an
ArrayIndexOutOfBoundsException
, however in most scenarios you
already know the entity possesses this component.
get
in class BaseComponentMapper<A extends Component>
entityId
- the entity that should possess the componentArrayIndexOutOfBoundsException
public boolean has(int entityId)
has
in class BaseComponentMapper<A extends Component>
entityId
- the id of entity to checkpublic void remove(int entityId)
remove
in class BaseComponentMapper<A extends Component>
entityId
- protected void internalRemove(int entityId)
internalRemove
in class BaseComponentMapper<A extends Component>
public A create(int entityId)
create
in class BaseComponentMapper<A extends Component>
entityId
- the entity that should possess the componentpublic A internalCreate(int entityId)
internalCreate
in class BaseComponentMapper<A extends Component>
Copyright © 2016. All rights reserved.