Class Measure

Object
Number
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:
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    byte
    Returns the scalar value.
    double
    Returns the scalar value.
    boolean
    equals(Object object)
    Compares this measure with the specified object for equality.
    float
    Returns the scalar value.
    Unit<?>
    Returns the unit.
    int
    Returns a hash code value for this measure.
    int
    Returns the scalar value.
    long
    Returns the scalar value.
    short
    Returns the scalar value.
    Returns a string representation of this measure.

    Methods inherited from class Object

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

    • 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 Details

    • 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