Class BaseUnit<Q extends Quantity>
- All Implemented Interfaces:
Serializable
This class represents the building blocks on top of which all others
units are created. Base units are typically dimensionally independent.
The actual unit dimension is determinated by the current
model
. For example using the standard
model, SI.CANDELA
has the dimension of watt
:[code]
// Standard model.
BaseUnit
This class represents the "standard base units" which includes SI base
units and possibly others user-defined base units. It does not represent
the base units of any specific SystemOfUnits
(they would have
be base units accross all possible systems otherwise).
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates if this base unit is considered equals to the specified object (both are base units with equal symbol, standard dimension and standard transform).Returns thebase unit
,alternate unit
or product of base units and alternate units this unit is derived from.final String
Returns the unique symbol for this base unit.int
hashCode()
Returns the hash code for this unit.Returns the converter from this unit to its system unit.
-
Constructor Details
-
BaseUnit
Creates a base unit having the specified symbol.- Parameters:
symbol
- the symbol of this base unit.- Throws:
IllegalArgumentException
- if the specified symbol is associated to a different unit.
-
-
Method Details
-
getSymbol
Returns the unique symbol for this base unit.- Returns:
- this base unit symbol.
-
equals
Indicates if this base unit is considered equals to the specified object (both are base units with equal symbol, standard dimension and standard transform). -
hashCode
public int hashCode()Description copied from class:Unit
Returns the hash code for this 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())
-