Class RadianCoordinate

All Implemented Interfaces:
Coordinate, Serializable, Comparable<Coordinate>
Direct Known Subclasses:
Latitude, Longitude

public abstract class RadianCoordinate extends Object implements Coordinate, Serializable
Abstract Coordinate implemenation that stores coordinate values normalized to RADIAN measure.
See Also:
  • Field Details

  • Constructor Details

    • RadianCoordinate

      protected RadianCoordinate(String value, Unit unit, int rangePrecision)
    • RadianCoordinate

      protected RadianCoordinate(BigDecimal value, Unit unit, int rangePrecision)
  • Method Details

    • getMinValue

      protected abstract BigDecimal getMinValue()
      Returns the minimum value for this coordinate.
      minimum coordinate value
    • getMaxValue

      protected abstract BigDecimal getMaxValue()
      the maximum value for this coordinate
    • getValue

      public BigDecimal getValue()
      Specified by:
      getValue in interface Coordinate
    • radianValue

      public double radianValue()
      Specified by:
      radianValue in interface Coordinate
    • degreeValue

      public double degreeValue()
      Specified by:
      degreeValue in interface Coordinate
    • checkRange

      protected void checkRange(int precision) throws IllegalArgumentException
      Checks the value if it fits in the range of a coordinate. If a value very close (specified by precision) to the limit is encountered, the range limit is set as new value.
      precision - the number of scale digits that has to be equal. is the value exceeds a range limit by more than "precision" digits, the max (resp. min) is set
      IllegalArgumentException - if value is too much out of range
    • isInRange

      protected boolean isInRange(BigDecimal value, int precision)
    • greaterMaximumRange

      protected static boolean greaterMaximumRange(BigDecimal value, int precision, BigDecimal maxVal)
      Returns true, if the specified value is out of range for this coordinate.
    • lowerMinimumRange

      protected static boolean lowerMinimumRange(BigDecimal value, int precision, BigDecimal minVal)
    • isMaxium

      protected boolean isMaxium(int precision)
    • isMinimum

      protected boolean isMinimum(int precision)
    • transformPhase

      protected BigDecimal transformPhase(BigDecimal arg, int precision)

      Transforms the argument into an argument with the same value inside the valid range of this coordinate.

      arg - an angle argument in RAD
      precision - the precision for which an argument is considered equal with its maximum/minimum values
      the same coordinate within minuxm-maximum range
    • valueEquals

      protected boolean valueEquals(BigDecimal value, int precision)
    • compareTo

      public int compareTo(Coordinate o)
      Specified by:
      compareTo in interface Comparable<Coordinate>
    • equals

      public boolean equals(Object o)
      equals in class Object
    • hashCode

      public int hashCode()
      hashCode in class Object