public class Grid2D extends Space2D
Space2D.KdTreeProcessAbstractEnvironmentSpace.AtomicCounter| Modifier and Type | Field and Description | 
|---|---|
| static java.lang.String | DEFAULT_NAMEThe default ID for this space. | 
| static java.lang.String | NEIGHBORHOOD_MOOREThe moore neighborhood. | 
| static java.lang.String | NEIGHBORHOOD_VON_NEUMANNThe von neumann neighborhood. | 
| protected MultiCollection<IVector2,ISpaceObject> | objectsygridposAll simobject id's accessible per position. | 
| static java.lang.String | PROPERTY_NEIGHBORHOODThe neighborhood property. | 
areasize, BORDER_RELAXED, BORDER_STRICT, BORDER_TORUS, kdTrees, PROPERTY_BORDER, PROPERTY_POSITIONactionlist, actions, avatarmappings, classloader, config, dataconsumers, dataproviders, dataviewmappings, exta, fetcher, ia, initialavatars, listeners, objectidcounter, objecttypes, objecttypesMeta, observercenters, perceptgenerators, perceptlist, perceptprocessors, percepttypes, pfetcher, processes, processtypes, spaceobjects, spaceobjectsbyowner, spaceobjectsbytype, taskidcounter, tasktypes, views, zombieobjectsmonitorpcs, properties| Constructor and Description | 
|---|
| Grid2D()Creates a new  ContinuousSpace2Dwith the default name. | 
| Grid2D(IVector2 areasize)Creates a new  ContinuousSpace2Dwith the default name. | 
| Grid2D(java.lang.Object name,
      IVector2 areasize)Creates a new  ContinuousSpace2Dwith a special ID. | 
| Modifier and Type | Method and Description | 
|---|---|
| IVector1 | calculateDistance(IVector1 dx,
                 IVector1 dy)Calculate the distance in the space. | 
| boolean | destroyAndVerifySpaceObject(java.lang.Object id)Destroys an object in this space. | 
| void | destroySpaceObject(java.lang.Object id)Destroys an object in this space. | 
| IVector2 | getEmptyGridPosition()Get an empty position in the grid. | 
| java.util.Set<ISpaceObject> | getNearGridObjects(IVector2 position,
                  int range,
                  java.lang.String[] types) | 
| java.util.Set<ISpaceObject> | getNearObjects(IVector2 position,
              IVector1 distance,
              java.lang.String type)Retrieve all objects in the distance for a position. | 
| java.lang.String | getNeighborhood()Get the neighborhood. | 
| IVector2 | getRandomGridPosition(IVector2 distance)Retrieves a random position within the simulation area with a minimum
 distance from the edge. | 
| IVector1 | getShortestDirection(IVector1 pos1,
                    IVector1 pos2,
                    boolean isx)Get the shortest (direct) direction between two coordinates. | 
| java.util.Collection<ISpaceObject> | getSpaceObjectsByGridPosition(IVector2 position,
                             java.lang.Object type)Get all SimObjects from a specific type at a specific grid position | 
| void | initSpaceObject(ISpaceObject ret)Init an object in this space. | 
| void | setAreaSize(IVector2 areasize)Set the area size. | 
| void | setPosition(java.lang.Object id,
           IVector2 pos)Set the position of an object. | 
addSpaceObjectType, adjustPosition, disableKdTree, enableKdTree, getAreaSize, getBorderMode, getDistance, getDistance, getNearestObject, getNearObjects, getNearObjects, getNearObjects, getRandomPosition, getSpaceObjectsaddAvatarMappings, addDataConsumer, addDataProvider, addDataView, addDataViewMapping, addEnvironmentListener, addInitialAvatar, addObjectTaskType, addPerceptGenerator, addPerceptProcessor, addPerceptType, addSpaceAction, addSpaceProcessType, addTaskListener, cancelSpaceAction, componentAdded, componentRemoved, createAvatar, createObjectTask, createPercept, createSpaceObject, createSpaceObjectZombie, createSpaceProcess, fireEnvironmentEvent, fireObjectEvent, getAvatar, getAvatar, getAvatarMapping, getAvatars, getClassLoader, getComponentActionList, getComponents, getComponentType, getDataConsumer, getDataConsumers, getDataProvider, getDataView, getDataViews, getExternalAccess, getFetcher, getOwner, getPerceptList, getPerceptType, getProcesses, getProperty, getSpaceAction, getSpaceObject, getSpaceObject0, getSpaceObjectsByType, getSpaceObjectsCollection, getSpaceObjectType, getSpaceProcess, getSpaceProcessNames, getViews, init, initSpace, mergeProperties, mergeProperties, performSpaceAction, performSpaceAction, removeAvatarMappings, removeDataView, removeEnvironmentListener, removeObjectTask, removeObjectTaskType, removePerceptGenerator, removePerceptProcessor, removePerceptType, removeSpaceAction, removeSpaceObjectType, removeSpaceProcess, removeSpaceProcessType, removeTaskListener, setFetcher, setInitData, setOwner, terminate, waitForTaskaddPropertyChangeListener, getMonitor, getPropertyNames, hasProperty, removePropertyChangeListener, setPropertygetMetaData, getMetaDatasgetProperties, setProperties, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetPropertyNames, hasProperty, setPropertypublic static final java.lang.String DEFAULT_NAME
public static final java.lang.String NEIGHBORHOOD_MOORE
public static final java.lang.String NEIGHBORHOOD_VON_NEUMANN
public static final java.lang.String PROPERTY_NEIGHBORHOOD
protected MultiCollection<IVector2,ISpaceObject> objectsygridpos
public Grid2D()
ContinuousSpace2D with the default name.clockService - the clock servicetimeCoefficient - the time coefficient for time differences.areaSize - the size of the 2D areapublic Grid2D(IVector2 areasize)
ContinuousSpace2D with the default name.actionexecutor - executor for component actionsareasize - the size of the 2D areapublic Grid2D(java.lang.Object name,
              IVector2 areasize)
ContinuousSpace2D with a special ID.name - the name of this spaceareasize - the size of the 2D areaactionexecutor - executor for component actionspublic void setAreaSize(IVector2 areasize)
setAreaSize in class Space2Dareasize - The area size.public java.lang.String getNeighborhood()
public java.util.Collection<ISpaceObject> getSpaceObjectsByGridPosition(IVector2 position, java.lang.Object type)
public IVector2 getEmptyGridPosition()
IVector2 position.public IVector2 getRandomGridPosition(IVector2 distance)
distance - minimum distance from the edge, null or zero for no distancepublic void setPosition(java.lang.Object id,
                        IVector2 pos)
setPosition in class Space2Did - The object id.pos - The object position.public void initSpaceObject(ISpaceObject ret)
initSpaceObject in class Space2Dpublic boolean destroyAndVerifySpaceObject(java.lang.Object id)
objectId - the object's IDpublic void destroySpaceObject(java.lang.Object id)
destroySpaceObject in interface IEnvironmentSpacedestroySpaceObject in class AbstractEnvironmentSpaceobjectId - the object's IDpublic java.util.Set<ISpaceObject> getNearGridObjects(IVector2 position, int range, java.lang.String[] types)
public java.util.Set<ISpaceObject> getNearObjects(IVector2 position, IVector1 distance, java.lang.String type)
getNearObjects in class Space2Dposition - The position.distance - The distance.type - The type (or null for all objects).public IVector1 calculateDistance(IVector1 dx, IVector1 dy)
calculateDistance in class Space2Ddx - The distance in x.dy - The distance in y.public IVector1 getShortestDirection(IVector1 pos1, IVector1 pos2, boolean isx)
pos1 - The first position.pos2 - The second position.isx - The flag indicating if x or y).