Package repast.simphony.space.grid
Interface GridPointTranslator
-
- All Known Subinterfaces:
GridPointTranslatorDecorator
- All Known Implementing Classes:
AbstractGridPointTranslator
,BouncyBorders
,InfiniteBorders
,StickyBorders
,StrictBorders
,WrapAroundBorders
public interface GridPointTranslator
Interface for classes that will translate a point by some specified amount.- Author:
- Nick Collier
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
init(GridDimensions dimensions)
Initializes this with the given dimensions.boolean
isToroidal()
True if this grid is toroidal (in the sense that moving off one border makes you appear on the other one), otherwise false.void
transform(int[] transformedLocation, int... targetLocation)
Transform the given targetLocation according to this GridPointTranslator's semantics.void
transform(GridPoint transformedLocation, int... targetLocation)
Transform the given targetLocation according to this GridPointTranslator's semantics.void
translate(int[] location, int... displacement)
Translate the specified location by the specified displacement.
-
-
-
Method Detail
-
init
void init(GridDimensions dimensions)
Initializes this with the given dimensions.- Parameters:
dimensions
- the dimensions of the space
-
translate
void translate(int[] location, int... displacement)
Translate the specified location by the specified displacement. The new location will stored in the location array. For example, if the location is (3, 4) and the displacement is (1, -2), the new location will be (4, 2).- Parameters:
location
- the current locationdisplacement
- the amount to translate
-
transform
void transform(int[] transformedLocation, int... targetLocation) throws SpatialException
Transform the given targetLocation according to this GridPointTranslator's semantics. The new transformed coordinates will be placed in the transformedTargetLocation.- 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.
-
transform
void transform(GridPoint transformedLocation, int... targetLocation) throws SpatialException
Transform the given targetLocation according to this GridPointTranslator's semantics. The new transformed coordinates will be placed in the transformedTargetLocation.- 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.
-
isToroidal
boolean isToroidal()
True if this grid is toroidal (in the sense that moving off one border makes you appear on the other one), otherwise false.- Returns:
- true if this grid is toroidal, otherwise false.
-
-