Class Measure

  • All Implemented Interfaces:
    Serializable

    public final class Measure
    extends Number
    A scalar with an unit.
    Since:
    2.1
    Author:
    Martin Desruisseaux (PMO, IRD)
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Measure​(double value, Unit<?> unit)
      Creates a new measure with the specified value and unit.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte byteValue()
      Returns the scalar value.
      double doubleValue()
      Returns the scalar value.
      boolean equals​(Object object)
      Compares this measure with the specified object for equality.
      float floatValue()
      Returns the scalar value.
      Unit<?> getUnit()
      Returns the unit.
      int hashCode()
      Returns a hash code value for this measure.
      int intValue()
      Returns the scalar value.
      long longValue()
      Returns the scalar value.
      short shortValue()
      Returns the scalar value.
      String toString()
      Returns a string representation of this measure.
      • Methods inherited from class Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Measure

        public Measure​(double value,
                       Unit<?> unit)
        Creates a new measure with the specified value and unit.
        Parameters:
        value - The value.
        unit - The unit of measurement for the given value.
    • Method Detail

      • doubleValue

        public double doubleValue()
        Returns the scalar value.
        Specified by:
        doubleValue in class Number
      • floatValue

        public float floatValue()
        Returns the scalar value.
        Specified by:
        floatValue in class Number
      • longValue

        public long longValue()
        Returns the scalar value.
        Specified by:
        longValue in class Number
      • intValue

        public int intValue()
        Returns the scalar value.
        Specified by:
        intValue in class Number
      • shortValue

        public short shortValue()
        Returns the scalar value.
        Overrides:
        shortValue in class Number
      • byteValue

        public byte byteValue()
        Returns the scalar value.
        Overrides:
        byteValue in class Number
      • getUnit

        public Unit<?> getUnit()
        Returns the unit.
        Returns:
        The unit of measurement.
      • hashCode

        public int hashCode()
        Returns a hash code value for this measure.
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(Object object)
        Compares this measure with the specified object for equality.
        Overrides:
        equals in class Object
        Parameters:
        object - The object to compare with this measure.
        Returns:
        true if the given object is equals to this measure.
      • toString

        public String toString()
        Returns a string representation of this measure.
        Overrides:
        toString in class Object