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.UnitConverter
The first unit converter to apply.private final javax.measure.UnitConverter
The second unit converter to apply, afterc1
.private ConcatenatedConverter
The inverse of this unit converter.private static final long
For 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.UnitConverter
concatenate
(javax.measure.UnitConverter converter) Concatenates this converter with another converter.double
convert
(double value) Applies the linear conversion on the given IEEE 754 floating-point value.Applies the linear conversion on the given value.double
derivative
(double value) Returns the derivative of the conversion function at the given value, orNaN
if unknown.boolean
Compares this converter with the given object for equality.boolean
equals
(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.int
hashCode()
Returns a hash code value for this unit converter.javax.measure.UnitConverter
inverse()
Returns the inverse of this unit converter.boolean
Returnstrue
if the two unit converters are identity converters.boolean
isLinear()
Returnstrue
if 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 accordingc1
first, thenc2
.
-
-
Method Details
-
isIdentity
public boolean isIdentity()Returnstrue
if the two unit converters are identity converters. Should always befalse
, otherwise we would not have created aConcatenatedConverter
.- Specified by:
isIdentity
in interfacejavax.measure.UnitConverter
- Overrides:
isIdentity
in classAbstractConverter
-
isLinear
public boolean isLinear()Returnstrue
if the two unit converters are linear converters. Should always befalse
, otherwise we would not have created aConcatenatedConverter
.- Specified by:
isLinear
in interfacejavax.measure.UnitConverter
- Overrides:
isLinear
in classAbstractConverter
-
inverse
public javax.measure.UnitConverter inverse()Returns the inverse of this unit converter.- Specified by:
inverse
in interfacejavax.measure.UnitConverter
-
convert
public double convert(double value) Applies the linear conversion on the given IEEE 754 floating-point value.- Specified by:
convert
in interfacejavax.measure.UnitConverter
-
convert
Applies the linear conversion on the given value.- Specified by:
convert
in interfacejavax.measure.UnitConverter
- Overrides:
convert
in classAbstractConverter
-
derivative
public double derivative(double value) Returns the derivative of the conversion function at the given value, orNaN
if unknown.- Specified by:
derivative
in 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:
concatenate
in interfacejavax.measure.UnitConverter
- Overrides:
concatenate
in classAbstractConverter
-
getConversionSteps
Returns the steps of fundamental converters making up this converter. For example,c1.getConversionSteps()
returnsc1
whilec1.concatenate(c2).getConversionSteps()
returnsc1, c2
.- Specified by:
getConversionSteps
in interfacejavax.measure.UnitConverter
- Overrides:
getConversionSteps
in 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:
equals
in interfaceLenientComparable
- Overrides:
equals
in classObject
- Parameters:
other
- the object to compare tothis
.- Returns:
true
if both objects are strictly equal.- See Also:
-
equals
Compares this converter with the given object for equality, optionally ignoring rounding errors.- Specified by:
equals
in interfaceLenientComparable
- Parameters:
other
- the object to compare tothis
.mode
- the strictness level of the comparison.- Returns:
true
if both objects are equal according the given comparison mode.- See Also:
-