public class StandardWorldModel extends DefaultWorldModel<StandardEntity>
| Constructor and Description |
|---|
StandardWorldModel()
Create a StandardWorldModel.
|
| Modifier and Type | Method and Description |
|---|---|
static StandardWorldModel |
createStandardWorldModel(WorldModel<? extends Entity> existing)
Create a StandardWorldModel that wraps an existing world model.
|
java.awt.geom.Rectangle2D |
getBounds()
Get the world bounds.
|
int |
getDistance(EntityID first,
EntityID second)
Get the distance between two entities.
|
int |
getDistance(StandardEntity first,
StandardEntity second)
Get the distance between two entities.
|
java.util.Collection<StandardEntity> |
getEntitiesOfType(StandardEntityURN... urns)
Get all entities of a set of types.
|
java.util.Collection<StandardEntity> |
getEntitiesOfType(StandardEntityURN urn)
Get all entities of a particular type.
|
java.util.Collection<StandardEntity> |
getObjectsInRange(EntityID entity,
int range)
Get objects within a certain range of an entity.
|
java.util.Collection<StandardEntity> |
getObjectsInRange(int x,
int y,
int range)
Get objects within a certain range of a location.
|
java.util.Collection<StandardEntity> |
getObjectsInRange(StandardEntity entity,
int range)
Get objects within a certain range of an entity.
|
java.util.Collection<StandardEntity> |
getObjectsInRectangle(int x1,
int y1,
int x2,
int y2)
Get objects inside a given rectangle.
|
Pair<Pair<java.lang.Integer,java.lang.Integer>,Pair<java.lang.Integer,java.lang.Integer>> |
getWorldBounds()
Get the world bounds.
|
void |
index()
Re-index the world model.
|
void |
indexClass(StandardEntityURN... urns)
Tell this index to remember a certain class of entities.
|
void |
merge(ChangeSet changeSet)
Merge a set of changes into this world.
|
addEntityImpl, create, getAllEntities, getEntity, iterator, removeAllEntities, removeEntityaddEntities, addEntity, addWorldModelListener, fireEntityAdded, fireEntityRemoved, isAllowed, merge, registerAllowedClass, removeEntity, removeWorldModelListenerpublic 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<StandardEntity>merge in class AbstractWorldModel<StandardEntity>changeSet - The set of changes to merge into this world model.public void indexClass(StandardEntityURN... urns)
urns - The type URNs to remember.public void index()
public java.util.Collection<StandardEntity> getObjectsInRange(EntityID entity, int range)
entity - The entity to centre the search on.range - The range to look up.public java.util.Collection<StandardEntity> getObjectsInRange(StandardEntity entity, int range)
entity - The entity to centre the search on.range - The range to look up.public java.util.Collection<StandardEntity> getObjectsInRange(int x, int y, int range)
x - The x coordinate of the location.y - The y coordinate of the location.range - The range to look up.public java.util.Collection<StandardEntity> getObjectsInRectangle(int x1, int y1, int x2, int y2)
x1 - The x coordinate of the top left corner.y1 - The y coordinate of the top left corner.x2 - The x coordinate of the bottom right corner.y2 - The y coordinate of the bottom right corner.public java.util.Collection<StandardEntity> getEntitiesOfType(StandardEntityURN urn)
urn - The type urn to look up.public java.util.Collection<StandardEntity> getEntitiesOfType(StandardEntityURN... urns)
urns - The type urns to look up.public int getDistance(EntityID first, EntityID second)
first - The ID of the first entity.second - The ID of the second entity.public int getDistance(StandardEntity first, StandardEntity second)
first - The first entity.second - The second entity.public java.awt.geom.Rectangle2D getBounds()
public Pair<Pair<java.lang.Integer,java.lang.Integer>,Pair<java.lang.Integer,java.lang.Integer>> getWorldBounds()
public static StandardWorldModel createStandardWorldModel(WorldModel<? extends Entity> existing)
existing - The existing world model to wrap. This may be null.