Package javax.measure.unit
Class AlternateUnit<Q extends Quantity>
java.lang.Object
javax.measure.unit.Unit<Q>
javax.measure.unit.DerivedUnit<Q>
javax.measure.unit.AlternateUnit<Q>
- All Implemented Interfaces:
Serializable
This class represents the units used in expressions to distinguish between quantities of a different nature but of the same dimensions.
Instances of this class are created through the
Unit.alternate(String)
method.
- See Also:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates if this alternate unit is considered equals to the specified object (both are alternate units with equal symbol, equal base units and equal converter to base units).Returns the parent unit from which this alternate unit is derived (a system unit itself).Returns thebase unit
,alternate unit
or product of base units and alternate units this unit is derived from.final String
Returns the symbol for this alternate unit.int
hashCode()
Returns the hash code for this unit.final UnitConverter
Returns the converter from this unit to its system unit.
-
Method Details
-
getSymbol
Returns the symbol for this alternate unit.- Returns:
- this alternate unit symbol.
-
getParent
Returns the parent unit from which this alternate unit is derived (a system unit itself).- Returns:
- the parent of the alternate unit.
-
getStandardUnit
Description copied from class:Unit
Returns thebase unit
,alternate unit
or product of base units and alternate units this unit is derived from. The standard unit identifies the "type" ofquantity
for which this unit is employed. For example:[code] boolean isAngularVelocity(Unit<?> u) { return u.getStandardUnit().equals(RADIAN.divide(SECOND)); } assert(REVOLUTION.divide(MINUTE).isAngularVelocity()); [/code]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).
- Specified by:
getStandardUnit
in classUnit<Q extends Quantity>
- Returns:
- the system unit this unit is derived from.
-
toStandardUnit
Description copied from class:Unit
Returns the converter from this unit to its system unit.- Specified by:
toStandardUnit
in classUnit<Q extends Quantity>
- Returns:
this.getConverterTo(this.getSystemUnit())
-
equals
Indicates if this alternate unit is considered equals to the specified object (both are alternate units with equal symbol, equal base units and equal converter to base units). -
hashCode
public int hashCode()Description copied from class:Unit
Returns the hash code for this unit.
-