Q
- The type of the quantity measured by this unit.Serializable
, Comparable<Q>
, javax.measure.Unit<Q>
, ComparableUnit<Q>
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 of(Unit, String)
method.
AbstractUnit.Equalizer
name, ONE, SYMBOL_TO_UNIT
Constructor | Description |
---|---|
AnnotatedUnit(javax.measure.Unit<Q> actualUnit,
String annotation) |
Creates an annotated unit equivalent to the specified unit.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object obj) |
|
javax.measure.Unit<Q> |
getActualUnit() |
Returns the actual unit of this annotated unit (never an annotated unit itself).
|
String |
getAnnotation() |
Returns the annotation of this annotated unit.
|
Map<? extends javax.measure.Unit<?>,Integer> |
getBaseUnits() |
|
javax.measure.Dimension |
getDimension() |
|
String |
getSymbol() |
|
javax.measure.UnitConverter |
getSystemConverter() |
Returns the converter from this unit to its unscaled
System Unit unit. |
int |
hashCode() |
|
static <Q extends javax.measure.Quantity<Q>> |
of(javax.measure.Unit<Q> actualUnit,
String annotation) |
Creates an annotated unit equivalent to the specified unit.
|
javax.measure.Unit<Q> |
toSystemUnit() |
Returns the unscaled
SI unit from which this unit is derived. |
alternate, annotate, asType, compareTo, divide, divide, divide, divide, getActualType, getConverterTo, getConverterToAny, getName, getSystemUnit, internalGetConverterTo, inverse, isCompatible, isEquivalentTo, isSystemUnit, multiply, multiply, multiply, multiply, parse, pow, prefix, root, setName, setSymbol, shift, shift, toString, transform
public AnnotatedUnit(javax.measure.Unit<Q> actualUnit, String annotation)
actualUnit
- the unit to be annotated.annotation
- the annotation.public javax.measure.Unit<Q> getActualUnit()
public String getAnnotation()
public Map<? extends javax.measure.Unit<?>,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 javax.measure.Unit<Q> toSystemUnit()
AbstractUnit
SI
unit 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.
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()
ComparableUnit
System Unit
unit.getConverterTo(this.toSystemUnit())
#toSystemUnit
public int hashCode()
hashCode
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
public boolean equals(Object obj)
equals
in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
public static <Q extends javax.measure.Quantity<Q>> AnnotatedUnit<Q> of(javax.measure.Unit<Q> actualUnit, String annotation)
actualUnit
- the unit to be annotated.annotation
- the annotation.Copyright © 2005–2020 Units of Measurement project. All rights reserved.