Package org.apache.sis.measure
Class ConcatenatedConverter
java.lang.Object
org.apache.sis.measure.AbstractConverter
org.apache.sis.measure.ConcatenatedConverter
- All Implemented Interfaces:
Serializable,javax.measure.UnitConverter,LenientComparable
The concatenation of two unit converters where at least one of them is not linear.
- Since:
- 0.8
- Version:
- 0.8
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final javax.measure.UnitConverterThe first unit converter to apply.private final javax.measure.UnitConverterThe second unit converter to apply, afterc1.private ConcatenatedConverterThe inverse of this unit converter.private static final longFor cross-version compatibility. -
Constructor Summary
ConstructorsConstructorDescriptionConcatenatedConverter(javax.measure.UnitConverter c1, javax.measure.UnitConverter c2) Creates a new concatenation of the given unit converters. -
Method Summary
Modifier and TypeMethodDescriptionjavax.measure.UnitConverterconcatenate(javax.measure.UnitConverter converter) Concatenates this converter with another converter.doubleconvert(double value) Applies the linear conversion on the given IEEE 754 floating-point value.Applies the linear conversion on the given value.doublederivative(double value) Returns the derivative of the conversion function at the given value, orNaNif unknown.booleanCompares this converter with the given object for equality.booleanequals(Object other, ComparisonMode mode) Compares this converter with the given object for equality, optionally ignoring rounding errors.List<javax.measure.UnitConverter>Returns the steps of fundamental converters making up this converter.inthashCode()Returns a hash code value for this unit converter.javax.measure.UnitConverterinverse()Returns the inverse of this unit converter.booleanReturnstrueif the two unit converters are identity converters.booleanisLinear()Returnstrueif the two unit converters are linear converters.Methods inherited from class org.apache.sis.measure.AbstractConverter
coefficients, derivative, doubleValue, epsilonEquals, scale
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
c1
private final javax.measure.UnitConverter c1The first unit converter to apply. -
c2
private final javax.measure.UnitConverter c2The second unit converter to apply, afterc1. -
inverse
The inverse of this unit converter. Computed when first needed and stored in order to avoid rounding error if the user asks for the inverse of the inverse.
-
-
Constructor Details
-
ConcatenatedConverter
ConcatenatedConverter(javax.measure.UnitConverter c1, javax.measure.UnitConverter c2) Creates a new concatenation of the given unit converters. Values will be converted accordingc1first, thenc2.
-
-
Method Details
-
isIdentity
public boolean isIdentity()Returnstrueif the two unit converters are identity converters. Should always befalse, otherwise we would not have created aConcatenatedConverter.- Specified by:
isIdentityin interfacejavax.measure.UnitConverter- Overrides:
isIdentityin classAbstractConverter
-
isLinear
public boolean isLinear()Returnstrueif the two unit converters are linear converters. Should always befalse, otherwise we would not have created aConcatenatedConverter.- Specified by:
isLinearin interfacejavax.measure.UnitConverter- Overrides:
isLinearin classAbstractConverter
-
inverse
public javax.measure.UnitConverter inverse()Returns the inverse of this unit converter.- Specified by:
inversein interfacejavax.measure.UnitConverter
-
convert
public double convert(double value) Applies the linear conversion on the given IEEE 754 floating-point value.- Specified by:
convertin interfacejavax.measure.UnitConverter
-
convert
Applies the linear conversion on the given value.- Specified by:
convertin interfacejavax.measure.UnitConverter- Overrides:
convertin classAbstractConverter
-
derivative
public double derivative(double value) Returns the derivative of the conversion function at the given value, orNaNif unknown.- Specified by:
derivativein classAbstractConverter- Parameters:
value- the point at which to compute the derivative. Ignored (can beDouble.NaN) if the conversion is linear.
-
concatenate
public javax.measure.UnitConverter concatenate(javax.measure.UnitConverter converter) Concatenates this converter with another converter. The resulting converter is equivalent to first converting by the specified converter (right converter), and then converting by this converter (left converter).- Specified by:
concatenatein interfacejavax.measure.UnitConverter- Overrides:
concatenatein classAbstractConverter
-
getConversionSteps
Returns the steps of fundamental converters making up this converter. For example,c1.getConversionSteps()returnsc1whilec1.concatenate(c2).getConversionSteps()returnsc1, c2.- Specified by:
getConversionStepsin interfacejavax.measure.UnitConverter- Overrides:
getConversionStepsin classAbstractConverter
-
hashCode
public int hashCode()Returns a hash code value for this unit converter. -
equals
Compares this converter with the given object for equality.- Specified by:
equalsin interfaceLenientComparable- Overrides:
equalsin classObject- Parameters:
other- the object to compare tothis.- Returns:
trueif both objects are strictly equal.- See Also:
-
equals
Compares this converter with the given object for equality, optionally ignoring rounding errors.- Specified by:
equalsin interfaceLenientComparable- Parameters:
other- the object to compare tothis.mode- the strictness level of the comparison.- Returns:
trueif both objects are equal according the given comparison mode.- See Also:
-