Interface DecimalEncodedValue

All Superinterfaces:
EncodedValue
All Known Implementing Classes:
DecimalEncodedValueImpl

public interface DecimalEncodedValue extends EncodedValue
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:
  • Method Details

    • setDecimal

      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.
      See Also:
    • getDecimal

      double getDecimal(boolean reverse, int edgeId, EdgeIntAccess edgeIntAccess)
    • 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 using setDecimal(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()