Serializable, Comparable<javax.measure.UnitConverter>, javax.measure.UnitConverter, tech.uom.lib.common.function.Converter<Number,Number>AbstractConverter.Pair, AddConverter, ExpConverter, LogConverter, PowerOfIntConverter, RationalConverterpublic abstract class AbstractConverter extends Object implements javax.measure.UnitConverter, tech.uom.lib.common.function.Converter<Number,Number>, Serializable, Comparable<javax.measure.UnitConverter>
The base class for our UnitConverter implementations.
| Modifier and Type | Class | Description |
|---|---|---|
static class |
AbstractConverter.Pair |
This class represents converters made up of two or more separate converters
(in matrix notation
[pair] = [left] x [right]). |
| Modifier and Type | Field | Description |
|---|---|---|
protected List<? extends javax.measure.UnitConverter> |
conversionSteps |
memorization for getConversionSteps
|
static AbstractConverter |
IDENTITY |
Default identity converter implementing AbstractConverter.
|
static ConverterCompositionHandler |
UNIT_COMPOSITION_HANDLER |
Allows for plug in of a custom UnitCompositionHandler.
|
| Modifier | Constructor | Description |
|---|---|---|
protected |
AbstractConverter() |
DefaultQuantityFactory constructor.
|
| Modifier and Type | Method | Description |
|---|---|---|
protected abstract boolean |
canReduceWith(AbstractConverter that) |
Non-API
Guard for
reduce(AbstractConverter) |
javax.measure.UnitConverter |
concatenate(javax.measure.UnitConverter converter) |
|
double |
convert(double value) |
|
Number |
convert(Number value) |
|
protected abstract Number |
convertWhenNotIdentity(Number value) |
Non-API
|
abstract boolean |
equals(Object cvtr) |
|
List<? extends javax.measure.UnitConverter> |
getConversionSteps() |
|
abstract int |
hashCode() |
|
AbstractConverter |
inverse() |
|
protected abstract AbstractConverter |
inverseWhenNotIdentity() |
Non-API
|
Optional<Number> |
linearFactor() |
Even though transformations may be composed of addition and multiplication, the first
derivative might just be a linear function.
|
protected AbstractConverter |
reduce(AbstractConverter that) |
Non-API
Guarded by
canReduceWith(AbstractConverter) |
String |
toString() |
|
protected abstract String |
transformationLiteral() |
Non-API
|
compareTopublic static final AbstractConverter IDENTITY
Note: Checking whether a UnitConverter is an identity operator should be done with
UnitConverter.isIdentity() rather than checking for object identity
unitConverter == AbstractConverter.IDENTITY.
public static ConverterCompositionHandler UNIT_COMPOSITION_HANDLER
protected List<? extends javax.measure.UnitConverter> conversionSteps
protected AbstractConverter()
protected abstract String transformationLiteral()
Returns a String describing the transformation that is represented by this converter.
Contributes to converter's toString method. If null or empty
toString output becomes simplified.
protected abstract AbstractConverter inverseWhenNotIdentity()
Returns an AbstractConverter that represents the inverse transformation of this converter, for cases where the transformation is not the identity transformation.
public final AbstractConverter inverse()
inverse in interface javax.measure.UnitConverterprotected abstract boolean canReduceWith(AbstractConverter that)
reduce(AbstractConverter)that - that is possible, such
that no additional conversion steps are required, with respect to the steps already
in place by this converterprotected AbstractConverter reduce(AbstractConverter that)
canReduceWith(AbstractConverter)that - public final javax.measure.UnitConverter concatenate(javax.measure.UnitConverter converter)
concatenate in interface javax.measure.UnitConverterpublic final List<? extends javax.measure.UnitConverter> getConversionSteps()
getConversionSteps in interface javax.measure.UnitConverterprotected abstract Number convertWhenNotIdentity(Number value)
value - public final double convert(double value)
convert in interface javax.measure.UnitConverterpublic final Number convert(Number value)
convert in interface tech.uom.lib.common.function.Converter<Number,Number>convert in interface javax.measure.UnitConverterIllegalArgumentException - if the value is null.public Optional<Number> linearFactor()
Copyright © 2005–2023 Units of Measurement project. All rights reserved.