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 factor,
boolean defaultIsInfinity,
boolean storeTwoDirections) |
DecimalEncodedValueImpl(String name,
int bits,
double minValue,
double factor,
boolean defaultIsInfinity,
boolean negateReverseDirection,
boolean storeTwoDirections,
boolean useMaximumAsInfinity) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
double |
getDecimal(boolean reverse,
IntsRef ref) |
double |
getMaxDecimal()
The maximum double value this EncodedValue accepts for setDecimal without throwing an exception.
|
double |
getNextStorableValue(double value) |
int |
getVersion()
The return value represents the state of this EncodedValue and it can be assumed that two JVMs return the
same version when the EncodedValue has the same state unlike the hashCode method.
|
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, getMaxInt, getName, hashCode, init, isStoreTwoDirections, setInt, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetName, init, isStoreTwoDirectionspublic DecimalEncodedValueImpl(String name, int bits, double factor, boolean storeTwoDirections)
public DecimalEncodedValueImpl(String name, int bits, double factor, boolean defaultIsInfinity, boolean storeTwoDirections)
public DecimalEncodedValueImpl(String name, int bits, double minValue, double factor, boolean defaultIsInfinity, 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.minValue - the minimum value. Use e.g. 0 if no negative values are needed.factor - the precision factor, i.e. store = (int) Math.round(value / factor)defaultIsInfinity - true if default should be Double.Infinity. False if 0 should be default.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.getMaxDecimal()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 getMaxDecimal()
DecimalEncodedValuegetMaxDecimal in interface DecimalEncodedValuepublic boolean equals(Object o)
equals in class IntEncodedValueImplpublic int getVersion()
EncodedValuegetVersion in interface EncodedValuegetVersion in class IntEncodedValueImplCopyright © 2012–2022. All rights reserved.