Class AlternateUnit<Q extends javax.measure.Quantity<Q>>
java.lang.Object
tech.units.indriya.AbstractUnit<Q>
tech.units.indriya.unit.AlternateUnit<Q>
- All Implemented Interfaces:
Serializable, Comparable<javax.measure.Unit<Q>>, javax.measure.Unit<Q>, ComparableUnit<Q>
This class represents units used in expressions to distinguish between quantities of a different nature but of the same dimensions.
- Since:
- 1.0
- Version:
- 1.3.1, August 06, 2017
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractUnit
AbstractUnit.Equalizer -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final javax.measure.Unit<?> Holds the parent unit (a system unit).private static final longprivate final StringHolds the symbol for this unit.Fields inherited from class AbstractUnit
name, ONE, SYMBOL_TO_UNIT -
Constructor Summary
ConstructorsConstructorDescriptionAlternateUnit(javax.measure.Unit<?> parentUnit, String symbol) Creates an alternate unit for the specified system unit identified by the specified name and symbol. -
Method Summary
Modifier and TypeMethodDescriptionbooleanjavax.measure.Dimensionjavax.measure.Unit<?> Returns the parent unit of this alternate unit, always a system unit and never an alternate unit.javax.measure.UnitConverterReturns the converter from this unit to its unscaledunit.invalid reference
System UnitinthashCode()javax.measure.Unit<Q> Returns the unscaledunit from which this unit is derived.invalid reference
SIMethods inherited from class 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:
-
parentUnit
private final javax.measure.Unit<?> parentUnitHolds the parent unit (a system unit). -
symbol
Holds the symbol for this unit.
-
-
Constructor Details
-
AlternateUnit
Creates an alternate unit for the specified system unit identified by the specified name and symbol.- Parameters:
symbol- the symbol for this alternate unit.parent- the system unit from which this alternate unit is derived.- Throws:
IllegalArgumentException- if the specified parent unit is not ansystem unit
-
-
Method Details
-
getParentUnit
public javax.measure.Unit<?> getParentUnit()Returns the parent unit of this alternate unit, always a system unit and never an alternate unit.- Returns:
- the parent unit.
-
getSymbol
-
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>>
-
getSystemConverter
public javax.measure.UnitConverter 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())- See Also:
-
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.
-
getBaseUnits
- Specified by:
getBaseUnitsin interfacejavax.measure.Unit<Q extends javax.measure.Quantity<Q>>- Specified by:
getBaseUnitsin classAbstractUnit<Q extends javax.measure.Quantity<Q>>
-
hashCode
public int hashCode()- Specified by:
hashCodein classAbstractUnit<Q extends javax.measure.Quantity<Q>>
-
equals
- Specified by:
equalsin classAbstractUnit<Q extends javax.measure.Quantity<Q>>
-