|
Java Units API Build 2004-02-06 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object Unit DerivedUnit TransformedUnit
This class represents a unit derived from another unit using
a Converter
.
Examples of transformed units:
CELSIUS = KELVIN.add(273.15); // Use label from unit database.
MILLISECOND = SECOND.multiply(1e-3); // Use label from unit database.
Transformed units have no intrinsic symbol. But like any other units, they may have labels attached to them:
FOOT = UnitFormat.label(METER.multiply(0.3048), "ft");
CENTIMETER = UnitFormat.label(METER.multiply(0.01), "cm");
CALENDAR_YEAR = UnitFormat.label(DAY.multiply(365), "year");
or aliases:
UnitFormat.alias(KELVIN.add(273.15), "Celsius");
UnitFormat.alias(METER.multiply(0.01), "centimeter");
UnitFormat.alias(METER.multiply(0.01), "centimetre");
Unit.add(double)
,
Unit.multiply(double)
,
UnitFormat
,
Serialized FormField Summary |
Fields inherited from class Unit |
ONE |
Method Summary | |
boolean |
equals(Object that)
Indicates if this unit is equal to the object specified. |
static Unit |
getInstance(Unit parent,
Converter toParent)
Returns the unit derived from the specified unit using the specified converter. |
Unit |
getSystemUnit()
Returns the system unit for this unit. |
Methods inherited from class Unit |
add, alternate, appendTo, divide, getConverterTo, getDimension, getInstance, getInstances, hashCode, isCompatible, isSystemUnit, multiply, multiply, pow, readResolve, root, searchSymbol, toString, valueOf |
Methods inherited from class Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
public static Unit getInstance(Unit parent, Converter toParent)
parent
- the unit from which this unit is derived.toParent
- the converter to the parent unit.
public Unit getSystemUnit()
Unit
Note: Having the same system units is not sufficient to ensure that a converter exists between the two units (e.g. °C/m and K/m).
getSystemUnit
in class Unit
Unit.isSystemUnit()
public boolean equals(Object that)
Unit
==
to test for equality.
equals
in class Unit
that
- the object to compare for equality.
true
if this unit and the specified object are
considered equal; false
otherwise.
|
Java Units API Build 2004-02-06 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Symbols, terms and definitions | JSR-108 project |