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>,tech.uom.lib.common.function.Nameable,tech.uom.lib.common.function.PrefixOperator<Q>,tech.uom.lib.common.function.SymbolSupplier
public final class BaseUnit<Q extends javax.measure.Quantity<Q>> extends AbstractUnit<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:
- 2.0, February 7, 2020
- Author:
- Jean-Marie Dautelle, Werner Keil
- See Also:
- Wikipedia: SI base unit, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class tech.units.indriya.AbstractUnit
AbstractUnit.Equalizer
-
-
Field Summary
-
Fields inherited from class tech.units.indriya.AbstractUnit
name, ONE, SYMBOL_TO_UNIT
-
-
Constructor Summary
Constructors Constructor Description BaseUnit(String symbol)Creates a base unit having the specified symbol.BaseUnit(String symbol, String name)Creates a base unit having the specified symbol and name.BaseUnit(String symbol, String name, javax.measure.Dimension dimension)Creates a base unit having the specified symbol, name and dimension.BaseUnit(String symbol, javax.measure.Dimension dimension)Creates a base unit having the specified symbol and dimension.
-
Method Summary
Modifier and Type Method Description booleanequals(Object obj)Map<? extends AbstractUnit<Q>,Integer>getBaseUnits()javax.measure.DimensiongetDimension()javax.measure.UnitConvertergetSystemConverter()Returns the converter from this unit to its unscaledSystem Unitunit.inthashCode()javax.measure.Unit<Q>toSystemUnit()Returns the unscaledSIunit from which this unit is derived.-
Methods inherited from class tech.units.indriya.AbstractUnit
alternate, annotate, asType, compareTo, divide, divide, divide, divide, getActualType, getConverterTo, getConverterToAny, getName, getSymbol, getSystemUnit, internalGetConverterTo, inverse, isCompatible, isEquivalentTo, isSystemUnit, multiply, multiply, multiply, multiply, parse, pow, prefix, root, setName, setSymbol, shift, shift, toString, transform
-
-
-
-
Constructor Detail
-
BaseUnit
public BaseUnit(String symbol, javax.measure.Dimension dimension)
Creates a base unit having the specified symbol and dimension.- Parameters:
symbol- the symbol of this base unit.
-
BaseUnit
public BaseUnit(String symbol)
Creates a base unit having the specified symbol.- Parameters:
symbol- the symbol of this base unit.
-
BaseUnit
public BaseUnit(String symbol, String name)
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.
-
BaseUnit
public BaseUnit(String symbol, String name, javax.measure.Dimension dimension)
Creates a base unit having the specified symbol, name and dimension.- 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.- Since:
- 2.0
-
-
Method Detail
-
toSystemUnit
public javax.measure.Unit<Q> toSystemUnit()
Description copied from class:AbstractUnitReturns the unscaledSIunit from which this unit is derived. The SI unit can be be used to identify a quantity given the unit. For example:static boolean isAngularVelocity(AbstractUnit> 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
public javax.measure.UnitConverter getSystemConverter() throws UnsupportedOperationException
Description copied from interface:ComparableUnitReturns the converter from this unit to its unscaledSystem Unitunit.- Returns:
getConverterTo(this.toSystemUnit())- Throws:
UnsupportedOperationException- See Also:
#toSystemUnit
-
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>>
-
hashCode
public int hashCode()
- Specified by:
hashCodein classAbstractUnit<Q extends javax.measure.Quantity<Q>>
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin classAbstractUnit<Q extends javax.measure.Quantity<Q>>
-
getBaseUnits
public Map<? extends AbstractUnit<Q>,Integer> getBaseUnits()
- Specified by:
getBaseUnitsin interfacejavax.measure.Unit<Q extends javax.measure.Quantity<Q>>- Specified by:
getBaseUnitsin classAbstractUnit<Q extends javax.measure.Quantity<Q>>
-
-