Class ContextGrid<T>
- java.lang.Object
-
- repast.simphony.space.projection.DefaultProjection<T>
-
- repast.simphony.space.grid.AbstractGrid<T,Map<GridPoint,Object>>
-
- repast.simphony.space.grid.DefaultGrid<T>
-
- repast.simphony.context.space.grid.ContextGrid<T>
-
- All Implemented Interfaces:
ContextListener<T>
,Grid<T>
,Projection<T>
public class ContextGrid<T> extends DefaultGrid<T> implements ContextListener<T>
Default implementation of an n-dimensional grid.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class repast.simphony.space.grid.AbstractGrid
AbstractGrid.PointHolder
-
-
Field Summary
-
Fields inherited from class repast.simphony.space.grid.AbstractGrid
accessor, adder, agentLocationMap, dimensions, locationStorage, ok, size, translator
-
Fields inherited from class repast.simphony.space.projection.DefaultProjection
listeners, name
-
-
Constructor Summary
Constructors Constructor Description ContextGrid(String name, GridAdder<T> adder, GridPointTranslator translator, CellAccessor<T,Map<GridPoint,Object>> accessor, int... size)
Constructs this space with the specified name, adder, translator, accessor and size.ContextGrid(String name, GridAdder<T> adder, GridPointTranslator translator, CellAccessor<T,Map<GridPoint,Object>> accessor, int[] size, int[] origin)
Constructs this space with the specified name, adder, translator, accessor, size, and origin.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addAll(Context<T> context)
protected void
addFromContext(T t)
void
eventOccured(ContextEvent<T> evt)
If the event is an add this will put the object at the (0, 0, ..., 0) location.-
Methods inherited from class repast.simphony.space.grid.DefaultGrid
createLocationStorage
-
Methods inherited from class repast.simphony.space.grid.AbstractGrid
evaluate, getAdder, getCellAccessor, getDimensions, getDistance, getDistanceSq, getGridPointTranslator, getLocation, getObjectAt, getObjects, getObjectsAt, getRandomObjectAt, getTransformedLocation, isPeriodic, moveByDisplacement, moveByVector, moveTo, remove, removeAll, setAdder, setGridPointTranslator, size
-
Methods inherited from class repast.simphony.space.projection.DefaultProjection
addProjectionListener, fireProjectionEvent, getName, getProjectionListeners, removeProjectionListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface repast.simphony.space.projection.Projection
addProjectionListener, getName, getProjectionListeners, removeProjectionListener
-
-
-
-
Constructor Detail
-
ContextGrid
public ContextGrid(String name, GridAdder<T> adder, GridPointTranslator translator, CellAccessor<T,Map<GridPoint,Object>> accessor, int... size)
Constructs this space with the specified name, adder, translator, accessor and size. The size is the size of the space meaning [3, 3] is a 3x3 space.- Parameters:
name
- the name of the spacesize
- the dimensions of the space
-
ContextGrid
public ContextGrid(String name, GridAdder<T> adder, GridPointTranslator translator, CellAccessor<T,Map<GridPoint,Object>> accessor, int[] size, int[] origin)
Constructs this space with the specified name, adder, translator, accessor, size, and origin. The size is the size of the space meaning [3, 3] is a 3x3 space. The origin is the offset on the space where the [0,0] grid point is.- Parameters:
name
- the name of the spacesize
- the dimensions of the spaceorigin
- the origin of the space
-
-
Method Detail
-
eventOccured
public void eventOccured(ContextEvent<T> evt)
If the event is an add this will put the object at the (0, 0, ..., 0) location. If it is a remove it will remove the object from its location map.- Specified by:
eventOccured
in interfaceContextListener<T>
- Parameters:
evt
- aContextEvent
that occurred to the context this is a part of
-
addFromContext
protected void addFromContext(T t)
-
-