This class represents units used in expressions to distinguish between quantities of a different nature but of the same dimensions.
Examples of alternate units:
Unit<Angle> RADIAN = AlternateUnit.of(ONE, "rad").asType(Angle.class);
Unit<Force> NEWTON = AlternateUnit.of(METRE.multiply(KILOGRAM).divide(SECOND.pow(2)), "N").asType(Force.class);
Unit<Pressure> PASCAL = AlternateUnit.of(NEWTON.divide(METRE.pow(2), "Pa").asType(Pressure.class);
| Modifier and Type | Field and Description |
|---|---|
| private final Unit | parentUnit
Holds the parent unit (a system unit). |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | AlternateUnit(Unit<?>
the system unit from which this alternate unit is derived. parentUnit, String the symbol for this alternate unit. symbol)Creates an alternate unit for the specified system unit identified by the specified name and symbol. |
| pack-priv | AlternateUnit(Unit<?>
the system unit from which this alternate unit is derived. parentUnit, String the symbol for this alternate unit. symbol, String the name for this alternate unit. name)Creates an alternate unit for the specified system unit identified by the specified name and symbol. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. obj)Implements abstract tech. Indicates whether some other object is "equal to" this one. |
| public Map | getBaseUnits()
Implements abstract tech. Implements javax. Returns the base units and their exponent whose product is this unit, or |
| public Dimension | getDimension()
Implements abstract tech. Implements javax. Returns the dimension of this unit. |
| public Unit | Returns: the parent unit.Returns the parent unit of this alternate unit, always a system unit and never an alternate unit. |
| public UnitConverter | getSystemConverter()
Implements abstract tech. Returns the converter from this unit to its unscaled |
| public int | hashCode()
Implements abstract tech. Returns a hash code value for this object. |
| public static <Q extends Quantity | |
| public static <Q extends Quantity | |
| public Unit | toSystemUnit()
Implements abstract tech. Returns the unscaled |
| parentUnit | back to summary |
|---|---|
| private final Unit<?> parentUnit Holds the parent unit (a system unit). | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| AlternateUnit | back to summary |
|---|---|
| public AlternateUnit(Unit<?> parentUnit, String symbol) Creates an alternate unit for the specified system unit identified by the specified name and symbol.
| |
| AlternateUnit | back to summary |
|---|---|
| pack-priv AlternateUnit(Unit<?> parentUnit, String symbol, String name) Creates an alternate unit for the specified system unit identified by the specified name and symbol.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Implements abstract tech. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| getBaseUnits | back to summary |
|---|---|
| public Map Implements abstract tech. Implements javax. Doc from javax. Returns the base units and their exponent whose product is this unit, or | |
| getDimension | back to summary |
|---|---|
| public Dimension getDimension() Implements abstract tech. Implements javax. Doc from javax. Returns the dimension of this unit. Two units | |
| getParentUnit | back to summary |
|---|---|
| public Unit Returns the parent unit of this alternate unit, always a system unit and never an alternate unit.
| |
| getSystemConverter | back to summary |
|---|---|
| public UnitConverter getSystemConverter() Implements abstract tech. Doc from tech. Returns the converter from this unit to its unscaled
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Implements abstract tech. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| of | back to summary |
|---|---|
| public static <Q extends Quantity Creates an alternate unit for the specified system unit identified by the specified name and symbol.
| |
| of | back to summary |
|---|---|
| public static <Q extends Quantity Creates an alternate unit for the specified system unit identified by the specified name and symbol.
| |
| toSystemUnit | back to summary |
|---|---|
| public Unit Implements abstract tech. Doc from tech. Returns the unscaled | |