Class RadianCoordinate
java.lang.Object
ch.tocco.nice2.types.spi.geolocation.RadianCoordinate
- All Implemented Interfaces:
Coordinate
,Serializable
,Comparable<Coordinate>
Abstract Coordinate implemenation that stores coordinate values
normalized to RADIAN measure.
- See Also:
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
RadianCoordinate
(String value, Unit unit, int rangePrecision) protected
RadianCoordinate
(BigDecimal value, Unit unit, int rangePrecision) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkRange
(int precision) Checks the value if it fits in the range of a coordinate.int
double
boolean
protected abstract BigDecimal
protected abstract BigDecimal
Returns the minimum value for this coordinate.getValue()
protected static boolean
greaterMaximumRange
(BigDecimal value, int precision, BigDecimal maxVal) Returnstrue
, if the specified value is out of range for this coordinate.int
hashCode()
protected boolean
isInRange
(BigDecimal value, int precision) protected boolean
isMaxium
(int precision) protected boolean
isMinimum
(int precision) protected static boolean
lowerMinimumRange
(BigDecimal value, int precision, BigDecimal minVal) double
protected BigDecimal
transformPhase
(BigDecimal arg, int precision) Transforms the argument into an argument with the same value inside the valid range of this coordinate.protected boolean
valueEquals
(BigDecimal value, int precision)
-
Field Details
-
DEFAULT_RANGE_PRECISION
protected static final int DEFAULT_RANGE_PRECISION- See Also:
-
value
-
-
Constructor Details
-
RadianCoordinate
-
RadianCoordinate
-
-
Method Details
-
getMinValue
Returns the minimum value for this coordinate.- Returns:
- minimum coordinate value
-
getMaxValue
- Returns:
- the maximum value for this coordinate
-
getValue
- Specified by:
getValue
in interfaceCoordinate
-
radianValue
public double radianValue()- Specified by:
radianValue
in interfaceCoordinate
-
degreeValue
public double degreeValue()- Specified by:
degreeValue
in interfaceCoordinate
-
checkRange
Checks the value if it fits in the range of a coordinate. If a value very close (specified byprecision
) to the limit is encountered, the range limit is set as new value.- Parameters:
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- Throws:
IllegalArgumentException
- if value is too much out of range
-
isInRange
-
greaterMaximumRange
Returnstrue
, if the specified value is out of range for this coordinate. -
lowerMinimumRange
-
isMaxium
protected boolean isMaxium(int precision) -
isMinimum
protected boolean isMinimum(int precision) -
transformPhase
Transforms the argument into an argument with the same value inside the valid range of this coordinate.
- Parameters:
arg
- an angle argument in RADprecision
- the precision for which an argument is considered equal with its maximum/minimum values- Returns:
- the same coordinate within minuxm-maximum range
-
valueEquals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Coordinate>
-
equals
-
hashCode
public int hashCode()
-