T - The subclass of Entity that this world model holds.public abstract class AbstractWorldModel<T extends Entity> extends java.lang.Object implements WorldModel<T>
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractWorldModel()
Construct a new abstract world model.
|
| 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.
|
protected abstract void |
addEntityImpl(T t)
Subclasses should provide their implementation of addEntity here.
|
void |
addWorldModelListener(WorldModelListener<? super T> l)
Add a listener for world model events.
|
protected void |
fireEntityAdded(T e)
Notify listeners that an entity has been added.
|
protected void |
fireEntityRemoved(T e)
Notify listeners that an entity has been removed.
|
protected boolean |
isAllowed(Entity e)
Find out if a particular Entity is allowed into this world model.
|
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.
|
protected void |
registerAllowedClass(java.lang.Class<? extends T> clazz)
Register an allowed class.
|
void |
removeEntity(T e)
Remove an entity from the world.
|
void |
removeWorldModelListener(WorldModelListener<? super T> l)
Remove a listener for world model events.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAllEntities, getEntity, removeAllEntities, removeEntityprotected AbstractWorldModel()
public final void addWorldModelListener(WorldModelListener<? super T> l)
WorldModeladdWorldModelListener in interface WorldModel<T extends Entity>l - The listener to add.public final void removeWorldModelListener(WorldModelListener<? super T> l)
WorldModelremoveWorldModelListener in interface WorldModel<T extends Entity>l - The listener to remove.public final void addEntity(Entity e)
WorldModeladdEntity in interface WorldModel<T extends Entity>e - The entity to add.public final void addEntities(java.util.Collection<? extends Entity> e)
WorldModeladdEntities in interface WorldModel<T extends Entity>e - The entities to add.public final void removeEntity(T e)
WorldModelremoveEntity in interface WorldModel<T extends Entity>e - The entity to remove.protected abstract void addEntityImpl(T t)
t - The entity to add.public void merge(java.util.Collection<? extends Entity> toMerge)
WorldModelmerge in interface WorldModel<T extends Entity>toMerge - The set of entities to merge into this world model.public void merge(ChangeSet changeSet)
WorldModelWorldModel.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.merge in interface WorldModel<T extends Entity>changeSet - The set of changes to merge into this world model.protected final void fireEntityAdded(T e)
e - The new entity.protected final void fireEntityRemoved(T e)
e - The entity that has been removed.protected boolean isAllowed(Entity e)
registerAllowedClass(Class).e - The entity to check.protected void registerAllowedClass(java.lang.Class<? extends T> clazz)
clazz - The subclass of Entity that is allowed in this world model.