Class StickyBorders

java.lang.Object
repast.simphony.space.continuous.AbstractPointTranslator
repast.simphony.space.continuous.StickyBorders
All Implemented Interfaces:
PointTranslator
Direct Known Subclasses:
InfiniteBorders

public class StickyBorders extends AbstractPointTranslator
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
  • Constructor Details

    • StickyBorders

      public StickyBorders()
  • Method Details

    • init

      public void init(Dimensions dimensions)
      Initializes this with the given dimensions.
      Specified by:
      init in interface PointTranslator
      Overrides:
      init in class AbstractPointTranslator
      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 location
      displacement - the amount of displacement.
    • translate

      public void translate(NdPoint location, double[] newLocation, double... displacement)
      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 location
      newLocation - holds the new location after the method completes
      displacement - the amount of displacement.
    • isPeriodic

      public boolean isPeriodic()
      Description copied from interface: PointTranslator
      True 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.