public interface UnitConverter
Instances of this class are obtained through the Unit.getConverterTo(Unit)
method.
Modifier and Type | Method and Description |
---|---|
UnitConverter |
concatenate(UnitConverter converter)
Concatenates this converter with another converter.
|
double |
convert(double value)
Converts a
double value. |
Number |
convert(Number value)
Converts a
Number value. |
List<? extends UnitConverter> |
getConversionSteps()
Returns the steps of fundamental converters making up this converter or
this if the converter is a fundamental converter. |
UnitConverter |
inverse()
Returns the inverse of this converter.
|
boolean |
isIdentity()
Indicates if this converter is an identity converter.
|
boolean |
isLinear()
Indicates if this converter is linear.
|
boolean isIdentity()
convert(x) == x
).true
if this converter is an identity converter.boolean isLinear()
convert(u + v) == convert(u) + convert(v)
convert(r * u) == r * convert(u)
For linear converters the following property always hold:
[code] y1 = c1.convert(x1); y2 = c2.convert(x2); assert y1*y2 == c1.concatenate(c2).convert(x1*x2); [/code]true
if this converter is linear; false
otherwise.UnitConverter inverse()
x
is a valid value,
then x == inverse().convert(convert(x))
to within the accuracy
of computer arithmetic.Number convert(Number value)
Number
value.value
- the Number
value to convert.Number
value after conversion.double convert(double value)
double
value.value
- the numeric value to convert.double
value after conversion.UnitConverter concatenate(UnitConverter converter)
converter
- the other converter to concatenate with this converter.List<? extends UnitConverter> getConversionSteps()
Returns the steps of fundamental converters making up this converter or
this
if the converter is a fundamental converter.
For example, converter1.getConversionSteps()
returns {converter1} while {@code converter1.concatenate(converter2).getConversionSteps()} returns {@code {converter1, converter2}.
Copyright © 2014–2015 Jean-Marie Dautelle, Werner Keil, V2COM. All rights reserved.