Package tech.units.indriya
Class AbstractSystemOfUnits
- java.lang.Object
-
- tech.units.indriya.AbstractSystemOfUnits
-
- All Implemented Interfaces:
javax.measure.spi.SystemOfUnits,tech.uom.lib.common.function.Nameable
- Direct Known Subclasses:
Units
public abstract class AbstractSystemOfUnits extends Object implements javax.measure.spi.SystemOfUnits, tech.uom.lib.common.function.Nameable
An abstract base class for unit systems.
- Since:
- 1.0
- Version:
- 2.0, Feb 18, 2020
- Author:
- Werner Keil
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractSystemOfUnits.Helper
-
Field Summary
Fields Modifier and Type Field Description protected static doubleEThe natural logarithm.protected static Loggerloggerprotected Map<Class<? extends javax.measure.Quantity>,javax.measure.Unit>quantityToUnitHolds the mapping quantity to unit.protected Set<javax.measure.Unit<?>>unitsHolds the units.
-
Constructor Summary
Constructors Constructor Description AbstractSystemOfUnits()
-
Method Summary
Modifier and Type Method Description abstract StringgetName()<Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q>getUnit(Class<Q> quantityType)javax.measure.Unit<?>getUnit(String string)javax.measure.Unit<?>getUnit(String string, UnitStyle style)javax.measure.Unit<?>getUnit(String string, UnitStyle style, boolean ignoreCase)Set<javax.measure.Unit<?>>getUnits()Set<? extends javax.measure.Unit<?>>getUnits(javax.measure.Dimension dimension)
-
-
-
Field Detail
-
E
protected static final double E
The natural logarithm.- See Also:
- Constant Field Values
-
quantityToUnit
protected final Map<Class<? extends javax.measure.Quantity>,javax.measure.Unit> quantityToUnit
Holds the mapping quantity to unit.
-
-
Constructor Detail
-
AbstractSystemOfUnits
public AbstractSystemOfUnits()
-
-
Method Detail
-
getName
public abstract String getName()
- Specified by:
getNamein interfacetech.uom.lib.common.function.Nameable- Specified by:
getNamein interfacejavax.measure.spi.SystemOfUnits
-
getUnits
public Set<javax.measure.Unit<?>> getUnits()
- Specified by:
getUnitsin interfacejavax.measure.spi.SystemOfUnits
-
getUnits
public Set<? extends javax.measure.Unit<?>> getUnits(javax.measure.Dimension dimension)
- Specified by:
getUnitsin interfacejavax.measure.spi.SystemOfUnits
-
getUnit
public <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> getUnit(Class<Q> quantityType)
- Specified by:
getUnitin interfacejavax.measure.spi.SystemOfUnits
-
getUnit
public javax.measure.Unit<?> getUnit(String string)
- Specified by:
getUnitin interfacejavax.measure.spi.SystemOfUnits
-
getUnit
public javax.measure.Unit<?> getUnit(String string, UnitStyle style, boolean ignoreCase)
Returns a unit with the given string representation in a particular style or
nullif none is found in this unit system and requested style.NOTE: Use
ignoreCasecarefully, as it will find the FIRST unit for a particular string, e.g. the symbol ofSECONDandSIEMENSwould be the same without case, but the UPPERCASE letter sorted first.- Parameters:
string- the string representation of a unit, notnull.style- the style of unit representation.ignoreCase- ignore the case or not?- Returns:
- the unit with the given string representation.
- Since:
- 2.0
-
getUnit
public javax.measure.Unit<?> getUnit(String string, UnitStyle style)
Returns a unit with the given string representation in a particular style ornullif none is found in this unit system and requested style.- Parameters:
string- the string representation of a unit, notnull.style- the style of unit representation.- Returns:
- the unit with the given string representation.
- Since:
- 2.0
-
-