public 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 and 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 and Description |
|---|---|
protected List<? extends javax.measure.UnitConverter> |
conversionSteps
memoization for getConversionSteps
|
static AbstractConverter |
IDENTITY
Holds identity converter.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractConverter()
DefaultQuantityFactory constructor.
|
| Modifier and Type | Method and Description |
|---|---|
javax.measure.UnitConverter |
concatenate(javax.measure.UnitConverter converter) |
double |
convert(double value) |
Number |
convert(Number value) |
protected abstract BigDecimal |
convertWhenNotIdentity(BigDecimal value,
MathContext ctx)
Non-API
|
protected Number |
convertWhenNotIdentity(BigInteger value,
MathContext ctx)
Non-API
|
protected abstract double |
convertWhenNotIdentity(double 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
|
protected abstract boolean |
isSimpleCompositionWith(AbstractConverter that)
Non-API
Guard for
simpleCompose(AbstractConverter) |
static javax.measure.UnitConverter |
of(javax.measure.Prefix prefix)
Creates a converter with the specified Prefix.
|
protected AbstractConverter |
simpleCompose(AbstractConverter that)
Non-API
Guarded by
isSimpleCompositionWith(AbstractConverter) |
String |
toString() |
protected abstract String |
transformationLiteral()
Non-API
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcompareTopublic static final AbstractConverter IDENTITY
protected List<? extends javax.measure.UnitConverter> conversionSteps
protected AbstractConverter()
public static javax.measure.UnitConverter of(javax.measure.Prefix prefix)
prefix - the prefix for the factor.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 isSimpleCompositionWith(AbstractConverter that)
simpleCompose(AbstractConverter)that - protected AbstractConverter simpleCompose(AbstractConverter that)
isSimpleCompositionWith(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 double convertWhenNotIdentity(double value)
value - protected Number convertWhenNotIdentity(BigInteger value, MathContext ctx)
value - ctx - protected abstract BigDecimal convertWhenNotIdentity(BigDecimal value, MathContext ctx)
value - ctx - public final double convert(double value)
convert in interface javax.measure.UnitConverterCopyright © 2005–2018 Units of Measurement project. All rights reserved.