public abstract class UnitsConverter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
UnitsConverter.Appended |
static class |
UnitsConverter.ScaleOffset |
Modifier and Type | Field and Description |
---|---|
static UnitsConverter |
CENTI |
static UnitsConverter |
GIGA |
static UnitsConverter |
IDENTITY
No conversion, where convert trivially returns the value.
|
protected UnitsConverter |
inverse |
static UnitsConverter |
KILO |
static UnitsConverter |
LOOSE_IDENTITY
Allow conversion, but this is a flag that indicates the result
should be dimensionless because the Ratiometric units were
not convertible.
|
static UnitsConverter |
MEGA |
static UnitsConverter |
MICRO |
static UnitsConverter |
MILLI |
static UnitsConverter |
NANO |
static UnitsConverter |
PICO |
static UnitsConverter |
TERA |
Modifier | Constructor and Description |
---|---|
protected |
UnitsConverter() |
protected |
UnitsConverter(UnitsConverter inverse) |
Modifier and Type | Method and Description |
---|---|
UnitsConverter |
append(UnitsConverter that) |
abstract double |
convert(double value)
convert the value in the source units to the target units.
|
java.lang.Number |
convert(java.lang.Number number)
convert the value in the source units to the target units,
preserving the data type.
|
static UnitsConverter |
getConverter(Units fromUnits,
Units toUnits)
lookup the UnitsConverter object that takes numbers from fromUnits to toUnits.
|
abstract UnitsConverter |
getInverse() |
public static final UnitsConverter IDENTITY
public static final UnitsConverter LOOSE_IDENTITY
public static final UnitsConverter TERA
public static final UnitsConverter GIGA
public static final UnitsConverter MEGA
public static final UnitsConverter KILO
public static final UnitsConverter MILLI
public static final UnitsConverter CENTI
public static final UnitsConverter MICRO
public static final UnitsConverter NANO
public static final UnitsConverter PICO
protected UnitsConverter inverse
protected UnitsConverter()
protected UnitsConverter(UnitsConverter inverse)
public abstract UnitsConverter getInverse()
public abstract double convert(double value)
value
- value in source units.public java.lang.Number convert(java.lang.Number number)
number
- value in source units.public UnitsConverter append(UnitsConverter that)
public static UnitsConverter getConverter(Units fromUnits, Units toUnits)
fromUnits
- toUnits
- InconvertibleUnitsException
- when the conversion is not possible.