Q
- The type of the quantity measured by this unit.Serializable
, Comparable<Q>
, javax.measure.Unit<Q>
, ComparableUnit<Q>
, tech.uom.lib.common.function.UnitConverterSupplier
public final class TransformedUnit<Q extends javax.measure.Quantity<Q>> extends AbstractUnit<Q> implements tech.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.
AbstractUnit.Equalizer
name, ONE, SYMBOL_TO_UNIT
Constructor | Description |
---|---|
TransformedUnit(String symbol,
javax.measure.Unit<Q> parentUnit,
javax.measure.Unit<Q> sysUnit,
javax.measure.UnitConverter unitConverter) |
Creates a transformed unit from the specified parent and system unit.
|
TransformedUnit(String symbol,
javax.measure.Unit<Q> parentUnit,
javax.measure.UnitConverter unitConverter) |
Creates a transformed unit from the specified parent unit.
|
TransformedUnit(javax.measure.Unit<Q> parentUnit,
javax.measure.UnitConverter unitConverter) |
Creates a transformed unit from the specified system unit.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object obj) |
|
Map<? extends javax.measure.Unit<?>,Integer> |
getBaseUnits() |
|
javax.measure.UnitConverter |
getConverter() |
Returns the converter to the parent unit.
|
javax.measure.Dimension |
getDimension() |
|
javax.measure.Unit<Q> |
getParentUnit() |
Returns the parent unit for this unit.
|
javax.measure.UnitConverter |
getSystemConverter() |
Returns the converter from this unit to its unscaled
System Unit unit. |
int |
hashCode() |
|
protected javax.measure.Unit<Q> |
toSystemUnit() |
Returns the unscaled
SI unit from which this unit is derived. |
alternate, annotate, asType, compareTo, divide, divide, divide, divide, getActualType, getConverterTo, getConverterToAny, getName, getSymbol, getSystemUnit, internalGetConverterTo, inverse, isCompatible, isEquivalentTo, isSystemUnit, multiply, multiply, multiply, multiply, parse, pow, prefix, root, setName, setSymbol, shift, shift, toString, transform
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.public TransformedUnit(String symbol, javax.measure.Unit<Q> parentUnit, javax.measure.UnitConverter unitConverter)
symbol
- the symbol to use with this transformed unit.parentUnit
- the parent unit from which this unit is derived.unitConverter
- the converter to the parent units.public TransformedUnit(String symbol, javax.measure.Unit<Q> parentUnit, javax.measure.Unit<Q> sysUnit, javax.measure.UnitConverter unitConverter)
parentUnit
- the parent unit from which this unit is derived.sysUnit
- the system unit which this unit is based on.converter
- the converter to the parent units.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()
ComparableUnit
System Unit
unit.getSystemConverter
in interface ComparableUnit<Q extends javax.measure.Quantity<Q>>
getConverterTo(this.toSystemUnit())
#toSystemUnit
public javax.measure.UnitConverter getConverter()
getConverter
in interface tech.uom.lib.common.function.UnitConverterSupplier
protected javax.measure.Unit<Q> toSystemUnit()
AbstractUnit
SI
unit from which this unit is derived.
The SI unit can be be used to identify a quantity given the unit. For
example: static boolean isAngularVelocity(AbstractUnit> unit) {
return unit.toSystemUnit().equals(RADIAN.divide(SECOND)); } assert(REVOLUTION.divide(MINUTE).isAngularVelocity()); // Returns true.
toSystemUnit
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
public Map<? extends javax.measure.Unit<?>,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(Object obj)
equals
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
public javax.measure.Unit<Q> getParentUnit()
Copyright © 2005–2020 Units of Measurement project. All rights reserved.