Package tech.units.indriya.unit
Class BaseUnit<Q extends Quantity<Q>>
- java.lang.Object
-
- tech.units.indriya.AbstractUnit<Q>
-
- tech.units.indriya.unit.BaseUnit<Q>
-
- All Implemented Interfaces:
Serializable,Comparable<Unit<Q>>,Unit<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 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.2, October 3, 2024
- 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
ONE, scale, 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, Dimension dimension)Creates a base unit having the specified symbol, name and dimension.BaseUnit(String symbol, Dimension dimension)Creates a base unit having the specified symbol and dimension.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Map<? extends AbstractUnit<Q>,Integer>getBaseUnits()DimensiongetDimension()UnitConvertergetSystemConverter()Returns the converter from this unit to its unscaledSystem Unitunit.inthashCode()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, getActualType, getConverterTo, getConverterTo, getConverterToAny, getConverterToAny, getName, getSymbol, getSystemUnit, internalGetConverterTo, inverse, isCompatible, isEquivalentTo, isSystemUnit, multiply, multiply, multiply, parse, pow, prefix, root, setName, setSymbol, shift, shift, toString, transform
-
-
-
-
Constructor Detail
-
BaseUnit
public BaseUnit(String symbol, 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, 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 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 Quantity<Q>>- Returns:
- the unscaled metric unit from which this unit is derived.
-
getSystemConverter
public UnitConverter getSystemConverter() throws UnsupportedOperationException
Description copied from class:AbstractUnitReturns the converter from this unit to its unscaledSystem Unitunit.- Specified by:
getSystemConverterin classAbstractUnit<Q extends Quantity<Q>>- Returns:
getConverterTo(this.toSystemUnit())- Throws:
UnsupportedOperationException- See Also:
AbstractUnit.toSystemUnit()
-
getDimension
public Dimension getDimension()
- Specified by:
getDimensionin interfaceUnit<Q extends Quantity<Q>>- Specified by:
getDimensionin classAbstractUnit<Q extends Quantity<Q>>
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin classAbstractUnit<Q extends Quantity<Q>>
-
getBaseUnits
public Map<? extends AbstractUnit<Q>,Integer> getBaseUnits()
- Specified by:
getBaseUnitsin interfaceUnit<Q extends Quantity<Q>>- Specified by:
getBaseUnitsin classAbstractUnit<Q extends Quantity<Q>>
-
-