Package repast.simphony.space.grid
Class AbstractGridPointTranslator
java.lang.Object
repast.simphony.space.grid.AbstractGridPointTranslator
- All Implemented Interfaces:
GridPointTranslator
- Direct Known Subclasses:
BouncyBorders
,StickyBorders
,StrictBorders
Implements transform according to default grid moveTo semantics. Namely, transform will throw
a SpatialException if the target location is off the grid.
- Version:
- $Revision$ $Date$
- Author:
- Nick Collier
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
boundsCheck
(int i, int value) void
init
(GridDimensions dimensions) Initializes this with the given dimensions.void
transform
(int[] transformedLocation, int... targetLocation) Transform the given targetLocation according to default moveTo semantics.void
Transform the given targetLocation according to default moveTo semantics.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.grid.GridPointTranslator
isToroidal, translate
-
Field Details
-
dimensions
-
-
Constructor Details
-
AbstractGridPointTranslator
public AbstractGridPointTranslator()
-
-
Method Details
-
init
Initializes this with the given dimensions.- Specified by:
init
in interfaceGridPointTranslator
- Parameters:
dimensions
- the dimensions of the space
-
transform
Transform the given targetLocation according to default moveTo semantics. Namely, if the target location is within the grid dimensions then that location becomes the new transformedLocation. Otherwise, this will throw a SpatialException.- Specified by:
transform
in interfaceGridPointTranslator
- Parameters:
transformedLocation
- the coordinates once they have been transformed by this GridPointTranslatortargetLocation
- the new target location whose coordinates will be transformed- Throws:
SpatialException
- if the transform is invalid. For example, if the new location is outside of the grid.
-
boundsCheck
protected void boundsCheck(int i, int value) -
transform
Transform the given targetLocation according to default moveTo semantics. Namely, if the target location is within the grid dimensions then that location becomes the new transformedLocation. Otherwise, this will throw a SpatialException.- Specified by:
transform
in interfaceGridPointTranslator
- Parameters:
transformedLocation
- the coordinates once they have been transformed by this GridPointTranslatortargetLocation
- the new target location whose coordinates will be transformed- Throws:
SpatialException
- if the transform is invalid. For example, if the new location is outside of the grid.
-