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,
int edgeId,
EdgeIntAccess edgeIntAccess) |
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,
int edgeId,
EdgeIntAccess edgeIntAccess,
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, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getName, init, isStoreTwoDirections
public 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, int edgeId, EdgeIntAccess edgeIntAccess, double value)
DecimalEncodedValue
setDecimal
in interface DecimalEncodedValue
DecimalEncodedValue.getMaxStorableDecimal()
public double getDecimal(boolean reverse, int edgeId, EdgeIntAccess edgeIntAccess)
getDecimal
in interface DecimalEncodedValue
public double getNextStorableValue(double value)
getNextStorableValue
in interface DecimalEncodedValue
DecimalEncodedValue.getDecimal(boolean, int, com.graphhopper.routing.ev.EdgeIntAccess)
returns the same value that we put in using DecimalEncodedValue.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.public double getSmallestNonZeroValue()
getSmallestNonZeroValue
in interface DecimalEncodedValue
public double getMaxStorableDecimal()
DecimalEncodedValue
getMaxStorableDecimal
in interface DecimalEncodedValue
public double getMinStorableDecimal()
DecimalEncodedValue
getMinStorableDecimal
in interface DecimalEncodedValue
public double getMaxOrMaxStorableDecimal()
getMaxOrMaxStorableDecimal
in interface DecimalEncodedValue
IntEncodedValue.getMaxOrMaxStorableInt()
Copyright © 2012–2023. All rights reserved.