T
- The subclass of Entity that this world model holds.public interface WorldModel<T extends Entity>
extends java.lang.Iterable<T>
Modifier and Type | Method and Description |
---|---|
void |
addEntities(java.util.Collection<? extends Entity> e)
Add a set of entities to the world.
|
void |
addEntity(Entity e)
Add an entity to the world.
|
void |
addWorldModelListener(WorldModelListener<? super T> l)
Add a listener for world model events.
|
java.util.Collection<T> |
getAllEntities()
Get all entities in the world.
|
T |
getEntity(EntityID id)
Look up an entity by ID.
|
void |
merge(ChangeSet changeSet)
Merge a set of changes into this world.
|
void |
merge(java.util.Collection<? extends Entity> toMerge)
Merge a set of entities into this world.
|
void |
removeAllEntities()
Remove all entities from the world.
|
void |
removeEntity(EntityID id)
Remove an entity from the world.
|
void |
removeEntity(T e)
Remove an entity from the world.
|
void |
removeWorldModelListener(WorldModelListener<? super T> l)
Remove a listener for world model events.
|
void addWorldModelListener(WorldModelListener<? super T> l)
l
- The listener to add.void removeWorldModelListener(WorldModelListener<? super T> l)
l
- The listener to remove.java.util.Collection<T> getAllEntities()
void addEntity(Entity e)
e
- The entity to add.void addEntities(java.util.Collection<? extends Entity> e)
e
- The entities to add.void removeEntity(T e)
e
- The entity to remove.void removeEntity(EntityID id)
id
- The entityID to remove.void removeAllEntities()
T getEntity(EntityID id)
id
- The EntityID to look up.void merge(java.util.Collection<? extends Entity> toMerge)
toMerge
- The set of entities to merge into this world model.void merge(ChangeSet changeSet)
merge(Collection)
method because an undefined value inside a ChangeSet means that the property value has become undefined, whereas in the other version of merge an undefined property means there is no value for that property.changeSet
- The set of changes to merge into this world model.