Class AnnotatedUnit<Q extends javax.measure.Quantity<Q>>

  • Type Parameters:
    Q - The type of the quantity measured by this unit.
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<javax.measure.Unit<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 AbstractUnit.annotate(String) method.

    Since:
    1.0
    Version:
    1.3.2, Dezember 27, 2017
    See Also:
    Serialized Form
    • Field Detail

      • actualUnit

        private final AbstractUnit<Q extends javax.measure.Quantity<Q>> actualUnit
        Holds the actual unit.
      • annotation

        private final java.lang.String annotation
        Holds the annotation.
    • Constructor Detail

      • AnnotatedUnit

        public AnnotatedUnit​(AbstractUnit<Q> actualUnit,
                             java.lang.String annotation)
        Creates an annotated unit equivalent to the specified unit.
        Parameters:
        actualUnit - the unit to be annotated.
        annotation - the annotation.
    • Method Detail

      • getActualUnit

        public AbstractUnit<Q> getActualUnit()
        Returns the actual unit of this annotated unit (never an annotated unit itself).
        Returns:
        the actual unit.
      • getAnnotation

        public java.lang.String getAnnotation()
        Returns the annotation of this annotated unit.
        Returns:
        the annotation.
      • getSymbol

        public java.lang.String getSymbol()
        Specified by:
        getSymbol in interface javax.measure.Unit<Q extends javax.measure.Quantity<Q>>
        Overrides:
        getSymbol in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
      • getBaseUnits

        public java.util.Map<? extends javax.measure.Unit<?>,​java.lang.Integer> getBaseUnits()
        Specified by:
        getBaseUnits in interface javax.measure.Unit<Q extends javax.measure.Quantity<Q>>
        Specified by:
        getBaseUnits in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
      • toSystemUnit

        public javax.measure.Unit<Q> toSystemUnit()
        Description copied from class: AbstractUnit
        Returns the unscaled 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.
        Specified by:
        toSystemUnit in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
        Returns:
        the unscaled metric unit from which this unit is derived.
      • getDimension

        public javax.measure.Dimension getDimension()
        Specified by:
        getDimension in interface javax.measure.Unit<Q extends javax.measure.Quantity<Q>>
        Specified by:
        getDimension in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
      • getSystemConverter

        public javax.measure.UnitConverter getSystemConverter()
        Description copied from class: AbstractUnit
        Returns the converter from this unit to its unscaled System Unit unit.
        Specified by:
        getSystemConverter in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
        Returns:
        getConverterTo(this.toSystemUnit())
        See Also:
        AbstractUnit.toSystemUnit()
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in class AbstractUnit<Q extends javax.measure.Quantity<Q>>
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in class AbstractUnit<Q extends javax.measure.Quantity<Q>>