Package repast.simphony.space.continuous
Class StickyBorders
java.lang.Object
repast.simphony.space.continuous.AbstractPointTranslator
repast.simphony.space.continuous.StickyBorders
- All Implemented Interfaces:
PointTranslator
- Direct Known Subclasses:
InfiniteBorders
Border implementation where translates across the border limits are clamped to
the border coordinates. So, for example, the space goes from 0 to 10 and the translate
results in 11 you end up at 10 (when traveling to 11 you get stuck to the wall). Transforms
throw a SpatialException if the desired target location is outside of the space's
dimensions.
- Author:
- Jerry Vos
-
Field Summary
Fields inherited from class repast.simphony.space.continuous.AbstractPointTranslator
dimensions -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected doublegetNewCoord(int dimension, double coord) voidinit(Dimensions dimensions) Initializes this with the given dimensions.booleanTrue if this translator is periodic (in the sense that moving off one border makes you appear on the other one), otherwise false.voidtranslate(double[] location, double... displacement) Translates the specified location by the amount of displacement along each dimensions.voidTranslates the specified location by the amount of displacement along each dimensions.Methods inherited from class repast.simphony.space.continuous.AbstractPointTranslator
boundsCheck, minusEpsilon, transform, transform
-
Constructor Details
-
StickyBorders
public StickyBorders()
-
-
Method Details
-
init
Initializes this with the given dimensions.- Specified by:
initin interfacePointTranslator- Overrides:
initin classAbstractPointTranslator- Parameters:
dimensions- the dimensions of the space
-
getNewCoord
protected double getNewCoord(int dimension, double coord) -
translate
public void translate(double[] location, double... displacement) Translates the specified location by the amount of displacement along each dimensions. The results are clamped to the spaces's dimensions. The translated location is returned in the location array.- Parameters:
location- the current locationdisplacement- the amount of displacement.
-
translate
Translates the specified location by the amount of displacement along each dimensions. The results are clamped to the grid's dimensions. The translated location is returned in the newlocation array.- Parameters:
location- the current locationnewLocation- holds the new location after the method completesdisplacement- the amount of displacement.
-
isPeriodic
public boolean isPeriodic()Description copied from interface:PointTranslatorTrue if this translator is periodic (in the sense that moving off one border makes you appear on the other one), otherwise false.- Returns:
- true if this translator is periodic, otherwise false.
-