Package com.graphhopper.routing.ev
Interface DecimalEncodedValue
- All Superinterfaces:
EncodedValue
- All Known Implementing Classes:
DecimalEncodedValueImpl
This class defines how and where to store an unsigned decimal value. It is important to note that:
1. the range of the number is highly limited (unlike the Java 32bit float or 64bit double values)
so that the storable part of it fits into the specified number of bits (maximum 32 at the moment
for all implementations) and 2. the default value is always 0.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.graphhopper.routing.ev.EncodedValue
EncodedValue.InitializerConfig
-
Method Summary
Modifier and TypeMethodDescriptiondouble
getDecimal
(boolean reverse, int edgeId, EdgeIntAccess edgeIntAccess) double
double
The maximum double value this EncodedValue accepts for setDecimal without throwing an exception.double
The minimum double value this EncodedValue accepts for setDecimal without throwing an exception.double
getNextStorableValue
(double value) double
void
setDecimal
(boolean reverse, int edgeId, EdgeIntAccess edgeIntAccess, double value) This method stores the specified double value (rounding with a previously defined factor) into the IntsRef.Methods inherited from interface com.graphhopper.routing.ev.EncodedValue
getName, init, isStoreTwoDirections
-
Method Details
-
setDecimal
This method stores the specified double value (rounding with a previously defined factor) into the IntsRef.- See Also:
-
getDecimal
-
getMaxStorableDecimal
double getMaxStorableDecimal()The maximum double value this EncodedValue accepts for setDecimal without throwing an exception. -
getMinStorableDecimal
double getMinStorableDecimal()The minimum double value this EncodedValue accepts for setDecimal without throwing an exception. -
getMaxOrMaxStorableDecimal
double getMaxOrMaxStorableDecimal()- See Also:
-
getNextStorableValue
double getNextStorableValue(double value) - Returns:
- the smallest decimal value that is larger or equal to the given value and that can be stored exactly,
i.e. for which
getDecimal(boolean, int, com.graphhopper.routing.ev.EdgeIntAccess)
returns the same value that we put in usingsetDecimal(boolean, int, com.graphhopper.routing.ev.EdgeIntAccess, double)
. For example if the internal scaling factor is 3 calling getDecimal after setDecimal(reverse, ref, 5) will return 6 not 5! The value returned by this method is guaranteed to be storable without such a modification.
-
getSmallestNonZeroValue
double getSmallestNonZeroValue()
-