CompoundUnit
javax.measure.unit

Class CompoundUnit<Q extends Quantity>

  • All Implemented Interfaces:
    Serializable


    public final class CompoundUnit<Q extends Quantity>extends DerivedUnit<Q>

    This class represents the multi-radix units (such as "hour:min:sec"). Instances of this class are created using the Unit.compound method.

    Examples of compound units:

         Unit<Duration> HOUR_MINUTE_SECOND = HOUR.compound(MINUTE).compound(SECOND);     Unit<Angle> DEGREE_MINUTE_ANGLE = DEGREE_ANGLE.compound(MINUTE_ANGLE);     

    See Also:
    Serialized Form
    • Method Detail

      • getLower

        public Unit<Q> getLower()
        Returns the lower unit of this compound unit.
        Returns:
        the lower unit.
      • getHigher

        public Unit<Q> getHigher()
        Returns the higher unit of this compound unit.
        Returns:
        the higher unit.
      • equals

        public boolean equals(Object that)
        Indicates if this compound unit is considered equals to the specified object (both are compound units with same composing units in the same order).
        Specified by:
        equals in class Unit<Q extends Quantity>
        Parameters:
        that - the object to compare for equality.
        Returns:
        true if this and that are considered equals; falseotherwise.
      • hashCode

        public int hashCode()
        Description copied from class: Unit
        Returns the hash code for this unit.
        Specified by:
        hashCode in class Unit<Q extends Quantity>
        Returns:
        this unit hashcode value.
      • getStandardUnit

        public Unit<? super Q> getStandardUnit()
        Description copied from class: Unit
        Returns the base unit, alternate unit or product of base units and alternate units this unit is derived from. The standard unit identifies the "type" of quantity for which this unit is employed. For example:
            boolean isAngularVelocity(Unit<?> u) {       return u.getStandardUnit().equals(RADIAN.divide(SECOND));    }    assert(REVOLUTION.divide(MINUTE).isAngularVelocity());   

        Note: Having the same system unit is not sufficient to ensure that a converter exists between the two units (e.g. \xc2\xb0C/m and K/m).

        Specified by:
        getStandardUnit in class Unit<Q extends Quantity>
        Returns:
        the system unit this unit is derived from.
      • toStandardUnit

        public UnitConverter toStandardUnit()
        Description copied from class: Unit
        Returns the converter from this unit to its system unit.
        Specified by:
        toStandardUnit in class Unit<Q extends Quantity>
        Returns:
        this.getConverterTo(this.getSystemUnit())

SCaVis 2.0 © jWork.ORG