Package tech.units.indriya.unit
Class BaseUnit<Q extends javax.measure.Quantity<Q>>
java.lang.Object
tech.units.indriya.AbstractUnit<Q>
tech.units.indriya.unit.BaseUnit<Q>
- All Implemented Interfaces:
Serializable,Comparable<javax.measure.Unit<Q>>,javax.measure.Unit<Q>,ComparableUnit<Q>
This class represents the building blocks on top of which all others physical units are created. Base units are always unscaled SI units.
When using the standard model, all seven SI base units are dimensionally independent.
- Since:
- 1.0
- Version:
- 1.2, August 06, 2017
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class tech.units.indriya.AbstractUnit
AbstractUnit.Equalizer -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final javax.measure.DimensionHolds the base unit dimension.private Qprivate static final longprivate final StringHolds the symbol.Fields inherited from class tech.units.indriya.AbstractUnit
name, ONE, SYMBOL_TO_UNIT -
Constructor Summary
ConstructorsConstructorDescriptionCreates a base unit having the specified symbol.Creates a base unit having the specified symbol and name.Creates a base unit having the specified symbol and dimension.Creates a base unit having the specified symbol and dimension. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanMap<? extends AbstractUnit<Q>, Integer> javax.measure.Dimensionprotected Qjavax.measure.UnitConverterReturns the converter from this unit to its unscaledunit.invalid reference
System Unitfinal inthashCode()javax.measure.Unit<Q> Returns the unscaledunit from which this unit is derived.invalid reference
SIMethods inherited from class tech.units.indriya.AbstractUnit
alternate, annotate, asType, compareTo, divide, divide, divide, getActualType, getConverterTo, getConverterToAny, getName, getSystemUnit, inverse, isCompatible, isEquivalentOf, isSystemUnit, multiply, multiply, multiply, parse, pow, prefix, root, setName, setSymbol, shift, toString, transform
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
symbol
Holds the symbol. -
dimension
private final javax.measure.Dimension dimensionHolds the base unit dimension. -
quantityType
-
-
Constructor Details
-
BaseUnit
Creates a base unit having the specified symbol and dimension.- Parameters:
symbol- the symbol of this base unit.
-
BaseUnit
Creates a base unit having the specified symbol and dimension.- Parameters:
symbol- the symbol of this base unit.
-
BaseUnit
Creates a base unit having the specified symbol.- Parameters:
symbol- the symbol of this base unit.
-
BaseUnit
Creates a base unit having the specified symbol and name.- Parameters:
symbol- the symbol of this base unit.name- the name of this base unit.- Throws:
IllegalArgumentException- if the specified symbol is associated to a different unit.
-
-
Method Details
-
getQuantityType
-
getSymbol
-
toSystemUnit
Description copied from class:AbstractUnitReturns the unscaledunit from which this unit is derived. The SI unit can be be used to identify a quantity given the unit. For example:invalid reference
SIstatic boolean isAngularVelocity(AbstractUnitinvalid input: '<'?> unit) { return unit.toSystemUnit().equals(RADIAN.divide(SECOND)); } assert(REVOLUTION.divide(MINUTE).isAngularVelocity()); // Returns true.- Specified by:
toSystemUnitin classAbstractUnit<Q extends javax.measure.Quantity<Q>>- Returns:
- the unscaled metric unit from which this unit is derived.
-
getSystemConverter
Description copied from class:AbstractUnitReturns the converter from this unit to its unscaledunit.invalid reference
System Unit- Specified by:
getSystemConverterin classAbstractUnit<Q extends javax.measure.Quantity<Q>>- Returns:
getConverterTo(this.toSystemUnit())- Throws:
UnsupportedOperationException- See Also:
-
getDimension
public javax.measure.Dimension getDimension()- Specified by:
getDimensionin interfacejavax.measure.Unit<Q extends javax.measure.Quantity<Q>>- Specified by:
getDimensionin classAbstractUnit<Q extends javax.measure.Quantity<Q>>
-
equals
- Specified by:
equalsin classAbstractUnit<Q extends javax.measure.Quantity<Q>>
-
hashCode
public final int hashCode()- Specified by:
hashCodein classAbstractUnit<Q extends javax.measure.Quantity<Q>>
-
getBaseUnits
- Specified by:
getBaseUnitsin interfacejavax.measure.Unit<Q extends javax.measure.Quantity<Q>>- Specified by:
getBaseUnitsin classAbstractUnit<Q extends javax.measure.Quantity<Q>>
-