public final class DecimalEncodedValueImpl extends IntEncodedValueImpl implements DecimalEncodedValue
EncodedValue.InitializerConfig| Constructor and Description |
|---|
DecimalEncodedValueImpl(String name,
int bits,
double factor,
boolean storeTwoDirections) |
DecimalEncodedValueImpl(String name,
int bits,
double minStorableValue,
double factor,
boolean negateReverseDirection,
boolean storeTwoDirections,
boolean useMaximumAsInfinity) |
| Modifier and Type | Method and Description |
|---|---|
double |
getDecimal(boolean reverse,
IntsRef ref) |
double |
getMaxOrMaxStorableDecimal() |
double |
getMaxStorableDecimal()
The maximum double value this EncodedValue accepts for setDecimal without throwing an exception.
|
double |
getMinStorableDecimal()
The minimum double value this EncodedValue accepts for setDecimal without throwing an exception.
|
double |
getNextStorableValue(double value) |
double |
getSmallestNonZeroValue() |
void |
setDecimal(boolean reverse,
IntsRef ref,
double value)
This method stores the specified double value (rounding with a previously defined factor) into the IntsRef.
|
getInt, getMaxOrMaxStorableInt, getMaxStorableInt, getMinStorableInt, getName, init, isStoreTwoDirections, setInt, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetName, init, isStoreTwoDirectionspublic DecimalEncodedValueImpl(String name, int bits, double factor, boolean storeTwoDirections)
public DecimalEncodedValueImpl(String name, int bits, double minStorableValue, double factor, boolean negateReverseDirection, boolean storeTwoDirections, boolean useMaximumAsInfinity)
name - the key to identify this EncodedValuebits - the bits that should be reserved for storing the integer value. This determines the
maximum value.minStorableValue - the minimum storable value. Use e.g. 0 if no negative values are needed.factor - the precision factor, i.e. store = (int) Math.round(value / factor)negateReverseDirection - true if the reverse direction should be always negative of the forward direction.
This is used to reduce space and store the value only once.storeTwoDirections - true if forward and backward direction of the edge should get two independent values.useMaximumAsInfinity - true if the maximum value should be treated as Double.Infinitypublic void setDecimal(boolean reverse,
IntsRef ref,
double value)
DecimalEncodedValuesetDecimal in interface DecimalEncodedValueDecimalEncodedValue.getMaxStorableDecimal()public double getDecimal(boolean reverse,
IntsRef ref)
getDecimal in interface DecimalEncodedValuepublic double getNextStorableValue(double value)
getNextStorableValue in interface DecimalEncodedValueDecimalEncodedValue.getDecimal(boolean, com.graphhopper.storage.IntsRef) returns the same value that we put in using DecimalEncodedValue.setDecimal(boolean, com.graphhopper.storage.IntsRef, 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.public double getSmallestNonZeroValue()
getSmallestNonZeroValue in interface DecimalEncodedValuepublic double getMaxStorableDecimal()
DecimalEncodedValuegetMaxStorableDecimal in interface DecimalEncodedValuepublic double getMinStorableDecimal()
DecimalEncodedValuegetMinStorableDecimal in interface DecimalEncodedValuepublic double getMaxOrMaxStorableDecimal()
getMaxOrMaxStorableDecimal in interface DecimalEncodedValueIntEncodedValue.getMaxOrMaxStorableInt()Copyright © 2012–2022. All rights reserved.