Class KlvIntegerEncodedFloatingPoint
java.lang.Object
org.codice.ddf.libs.klv.KlvDataElement<T>
org.codice.ddf.libs.klv.data.numerical.KlvNumericalDataElement<Double>
org.codice.ddf.libs.klv.data.numerical.KlvIntegerEncodedFloatingPoint
Represents a KLV element containing a floating-point value that has been encoded as an integer
value.
-
Field Summary
Fields inherited from class org.codice.ddf.libs.klv.data.numerical.KlvNumericalDataElement
errorIndicatorValueFields inherited from class org.codice.ddf.libs.klv.KlvDataElement
key, keyBytes, name, value -
Constructor Summary
ConstructorsConstructorDescriptionKlvIntegerEncodedFloatingPoint(KlvNumericalDataElement<?> klvRawDataValue, long encodedRangeMin, long encodedRangeMax, double actualRangeMin, double actualRangeMax) Constructs aKlvIntegerEncodedFloatingPointrepresenting a KLV element containing a floating-point value that has been encoded as an integer value.KlvIntegerEncodedFloatingPoint(KlvNumericalDataElement<?> klvRawDataValue, long encodedRangeMin, long encodedRangeMax, double actualRangeMin, double actualRangeMax, Optional<Double> errorIndicatorValue) Constructs aKlvIntegerEncodedFloatingPointrepresenting a KLV element containing a floating-point value that has been encoded as an integer value. -
Method Summary
Modifier and TypeMethodDescriptionprotected KlvIntegerEncodedFloatingPointcopy()protected voiddecodeValue(Klv klv) booleanIf there is a floating point error indicator, then use it.Methods inherited from class org.codice.ddf.libs.klv.KlvDataElement
getKey, getKeyAsString, getName, getValue
-
Constructor Details
-
KlvIntegerEncodedFloatingPoint
public KlvIntegerEncodedFloatingPoint(KlvNumericalDataElement<?> klvRawDataValue, long encodedRangeMin, long encodedRangeMax, double actualRangeMin, double actualRangeMax) Constructs aKlvIntegerEncodedFloatingPointrepresenting a KLV element containing a floating-point value that has been encoded as an integer value.The value returned by this
KlvIntegerEncodedFloatingPointis calculated as follows:- The value returned by
klvRawDataValueis converted to a long- Scale the value by calculating: (value -
encodedRangeMin) / (encodedRangeMax-encodedRangeMin)- Apply the scaled value to the actual range: scaled value * (
actualRangeMax-actualRangeMin) +actualRangeMin- Parameters:
klvRawDataValue- theKlvNumericalDataElementthat retrieves the raw numerical valueencodedRangeMin- the minimum integer-encoded valueencodedRangeMax- the maximum integer-encoded valueactualRangeMin- the minimum decoded floating-point valueactualRangeMax- the maximum decoded floating-point value
- The value returned by
-
KlvIntegerEncodedFloatingPoint
public KlvIntegerEncodedFloatingPoint(KlvNumericalDataElement<?> klvRawDataValue, long encodedRangeMin, long encodedRangeMax, double actualRangeMin, double actualRangeMax, Optional<Double> errorIndicatorValue) Constructs aKlvIntegerEncodedFloatingPointrepresenting a KLV element containing a floating-point value that has been encoded as an integer value.The value returned by this
KlvIntegerEncodedFloatingPointis calculated as follows:- The value returned by
klvRawDataValueis converted to a long- Scale the value by calculating: (value -
encodedRangeMin) / (encodedRangeMax-encodedRangeMin)- Apply the scaled value to the actual range: scaled value * (
actualRangeMax-actualRangeMin) +actualRangeMin- Parameters:
klvRawDataValue- theKlvNumericalDataElementthat retrieves the raw numerical valueencodedRangeMin- the minimum integer-encoded valueencodedRangeMax- the maximum integer-encoded valueactualRangeMin- the minimum decoded floating-point valueactualRangeMax- the maximum decoded floating-point valueerrorIndicatorValue- value that indicates an encoded error
- The value returned by
-
-
Method Details
-
decodeValue
- Specified by:
decodeValuein classKlvNumericalDataElement<Double>
-
copy
- Specified by:
copyin classKlvNumericalDataElement<Double>
-
isErrorIndicated
public boolean isErrorIndicated()If there is a floating point error indicator, then use it. Otherwise, check the raw data for an error indicator.- Overrides:
isErrorIndicatedin classKlvNumericalDataElement<Double>- Returns:
- true if an error indicator is encoded
-