Q
- The type of the quantity measured by this unit.public final class TransformedUnit<Q extends javax.measure.Quantity<Q>> extends AbstractUnit<Q> implements tec.uom.lib.common.function.UnitConverterSupplier
This class represents the units derived from other units using converters.
Examples of transformed units:
CELSIUS = KELVIN.shift(273.15);
FOOT = METRE.multiply(3048).divide(10000);
MILLISECOND = MILLI(SECOND);
Transformed units have no symbol. But like any other units, they may have labels attached to them (see
UnitFormat.label
Instances of this class are created through the AbstractUnit.transform(javax.measure.UnitConverter)
method.
Modifier and Type | Field and Description |
---|---|
private javax.measure.UnitConverter |
converter
Holds the converter to the parent unit.
|
private AbstractUnit<Q> |
parentUnit
Holds the parent unit (always a system unit).
|
private static long |
serialVersionUID |
private java.lang.String |
symbol
Holds the symbol.
|
name, ONE, SYMBOL_TO_UNIT
Constructor and Description |
---|
TransformedUnit(java.lang.String symbol,
javax.measure.Unit<Q> parentUnit,
javax.measure.UnitConverter unitConverter) |
TransformedUnit(javax.measure.Unit<Q> parentUnit,
javax.measure.UnitConverter unitConverter)
Creates a transformed unit from the specified system unit.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.util.Map<? extends javax.measure.Unit<?>,java.lang.Integer> |
getBaseUnits() |
javax.measure.UnitConverter |
getConverter() |
javax.measure.Dimension |
getDimension() |
javax.measure.Unit<Q> |
getParentUnit() |
java.lang.String |
getSymbol() |
javax.measure.UnitConverter |
getSystemConverter()
Returns the converter from this unit to its unscaled
System Unit unit. |
int |
hashCode() |
AbstractUnit<Q> |
toSystemUnit()
Returns the unscaled
SI unit from which this unit is derived. |
alternate, annotate, asType, compareTo, divide, divide, divide, getActualType, getConverterTo, getConverterToAny, getName, getSystemUnit, inverse, isCompatible, isSystemUnit, multiply, multiply, multiply, parse, pow, root, setName, setSymbol, shift, toString, transform
private static final long serialVersionUID
private final AbstractUnit<Q extends javax.measure.Quantity<Q>> parentUnit
private final javax.measure.UnitConverter converter
private java.lang.String symbol
public TransformedUnit(javax.measure.Unit<Q> parentUnit, javax.measure.UnitConverter unitConverter)
parentUnit
- the system unit from which this unit is derived.converter
- the converter to the parent units.java.lang.IllegalArgumentException
- if the specified parent unit is not an system unit
public TransformedUnit(java.lang.String symbol, javax.measure.Unit<Q> parentUnit, javax.measure.UnitConverter unitConverter)
public javax.measure.Dimension getDimension()
getDimension
in interface javax.measure.Unit<Q extends javax.measure.Quantity<Q>>
getDimension
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
public javax.measure.UnitConverter getSystemConverter()
AbstractUnit
System Unit
unit.getSystemConverter
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
getConverterTo(this.toSystemUnit())
#toSI
public javax.measure.UnitConverter getConverter()
getConverter
in interface tec.uom.lib.common.function.UnitConverterSupplier
public AbstractUnit<Q> toSystemUnit()
AbstractUnit
SI
unit from which this unit is derived.
They SI unit can be be used to identify a quantity given the unit. For example:[code] static boolean isAngularVelocity(AbstractUnit> unit) {
return unit.toSI().equals(RADIAN.divide(SECOND)); } assert(REVOLUTION.divide(MINUTE).isAngularVelocity()); // Returns true. [/code]toSystemUnit
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
public java.util.Map<? extends javax.measure.Unit<?>,java.lang.Integer> getBaseUnits()
getBaseUnits
in interface javax.measure.Unit<Q extends javax.measure.Quantity<Q>>
getBaseUnits
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
public int hashCode()
hashCode
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
public boolean equals(java.lang.Object obj)
equals
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
public java.lang.String getSymbol()
public javax.measure.Unit<Q> getParentUnit()