Q
- The type of the quantity measured by this unit.public final class AnnotatedUnit<Q extends javax.measure.Quantity<Q>> extends AbstractUnit<Q>
This class represents an annotated unit.
Instances of this class are created through the AbstractUnit.annotate(String)
method.
Modifier and Type | Field and Description |
---|---|
private AbstractUnit<Q> |
actualUnit
Holds the actual unit.
|
private java.lang.String |
annotation
Holds the annotation.
|
private static long |
serialVersionUID |
name, ONE, SYMBOL_TO_UNIT
Constructor and Description |
---|
AnnotatedUnit(AbstractUnit<Q> actualUnit,
java.lang.String annotation)
Creates an annotated unit equivalent to the specified unit.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
AbstractUnit<Q> |
getActualUnit()
Returns the actual unit of this annotated unit (never an annotated unit itself).
|
java.lang.String |
getAnnotation()
Returns the annotqtion of this annotated unit.
|
java.util.Map<? extends javax.measure.Unit<?>,java.lang.Integer> |
getBaseUnits() |
javax.measure.Dimension |
getDimension() |
java.lang.String |
getSymbol() |
javax.measure.UnitConverter |
getSystemConverter()
Returns the converter from this unit to its unscaled
System Unit unit. |
int |
hashCode() |
AbstractUnit<Q> |
toSystemUnit()
Returns the unscaled
SI unit from which this unit is derived. |
alternate, annotate, asType, compareTo, divide, divide, divide, getActualType, getConverterTo, getConverterToAny, getName, getSystemUnit, inverse, isCompatible, isSystemUnit, multiply, multiply, multiply, parse, pow, root, setName, setSymbol, shift, toString, transform
private static final long serialVersionUID
private final AbstractUnit<Q extends javax.measure.Quantity<Q>> actualUnit
private final java.lang.String annotation
public AnnotatedUnit(AbstractUnit<Q> actualUnit, java.lang.String annotation)
actualUnit
- the unit to be annotated.annotation
- the annotation.public AbstractUnit<Q> getActualUnit()
public java.lang.String getAnnotation()
public java.lang.String getSymbol()
public java.util.Map<? extends javax.measure.Unit<?>,java.lang.Integer> getBaseUnits()
getBaseUnits
in interface javax.measure.Unit<Q extends javax.measure.Quantity<Q>>
getBaseUnits
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
public AbstractUnit<Q> toSystemUnit()
AbstractUnit
SI
unit from which this unit is derived.
They SI unit can be be used to identify a quantity given the unit. For example:[code] static boolean isAngularVelocity(AbstractUnit> unit) {
return unit.toSI().equals(RADIAN.divide(SECOND)); } assert(REVOLUTION.divide(MINUTE).isAngularVelocity()); // Returns true. [/code]toSystemUnit
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
public javax.measure.Dimension getDimension()
getDimension
in interface javax.measure.Unit<Q extends javax.measure.Quantity<Q>>
getDimension
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
public javax.measure.UnitConverter getSystemConverter()
AbstractUnit
System Unit
unit.getSystemConverter
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
getConverterTo(this.toSystemUnit())
#toSI
public int hashCode()
hashCode
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
public boolean equals(java.lang.Object obj)
equals
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>