|
JSR-275 - Measurements and Units Specification | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.measure.unit.Unit<Q>
javax.measure.unit.DerivedUnit<Q>
javax.measure.unit.TransformedUnit<Q>
public final class TransformedUnit<Q extends Quantity>
This class represents the units derived from other units using
converters
.
Examples of transformed units:
CELSIUS = KELVIN.add(273.15);
FOOT = METER.multiply(0.3048);
MILLISECOND = MILLI(SECOND);
Transformed units have no label. But like any other units,
they may have labels attached to them:
or aliases:
UnitFormat.getStandardInstance().label(FOOT, "ft");
UnitFormat.getStandardInstance().alias(CENTI(METER)), "centimeter");
UnitFormat.getStandardInstance().alias(CENTI(METER)), "centimetre");
Unit.plus(double)
,
Unit.times(double)
,
Unit.transform(UnitConverter)
,
UnitFormat
,
Serialized FormField Summary |
---|
Fields inherited from class javax.measure.unit.Unit |
---|
ONE |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object that)
Indicates if this transformed unit is considered equals to the specified object (both are transformed units with equal parent unit and equal converter to parent unit). |
Unit<Q> |
getParentUnit()
Returns the parent unit for this unit. |
Unit<? super Q> |
getSystemUnit()
Returns the base unit , alternate
unit or product of base units and alternate units this unit is derived
from. |
int |
hashCode()
Returns the hash code for this unit. |
UnitConverter |
toParentUnit()
Returns the converter to the parent unit. |
UnitConverter |
toSystemUnit()
Returns the converter from this unit to its system unit. |
Methods inherited from class javax.measure.unit.Unit |
---|
asType, compound, divide, divide, divide, getConverterTo, getDimension, inverse, isCompatible, plus, pow, root, times, times, times, toString, transform, valueOf |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public Unit<Q> getParentUnit()
public UnitConverter toParentUnit()
public boolean equals(java.lang.Object that)
equals
in class Unit<Q extends Quantity>
that
- the object to compare for equality.
true
if this
and that
are considered equals; false
otherwise.public int hashCode()
Unit
hashCode
in class Unit<Q extends Quantity>
public Unit<? super Q> getSystemUnit()
Unit
base unit
, alternate
unit
or product of base units and alternate units this unit is derived
from. The system unit identifies the "type" of
quantity
for which this unit is employed.
For example:
boolean isAngularVelocity(Unit<?> u) {
return u.getSystemUnit().equals(RADIAN.divide(SECOND));
}
assert(REVOLUTION.divide(MINUTE).isAngularVelocity());
Note: Having the same system unit is not sufficient to ensure that a converter exists between the two units (e.g. °C/m and K/m).
getSystemUnit
in class Unit<Q extends Quantity>
public UnitConverter toSystemUnit()
Unit
toSystemUnit
in class Unit<Q extends Quantity>
this.getConverterTo(this.getSystemUnit())
|
JSR-275 - Measurements and Units Specification | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |