Class Distance


  • @StableMinor(version="15.0",
                 sinceVersion="9.0")
    public class Distance
    extends java.lang.Object
    Represents a distance with an amount and a distance unit.
    Since:
    9.0.0
    Version:
    $Revision: 25303 $ $Date: 2022-10-22 22:48:02 -0300 (Sat, 22 Oct 2022) $
    • Constructor Summary

      Constructors 
      Constructor Description
      Distance​(double amount, DistanceUnit unit)
      Creates a new distance.
    • Constructor Detail

      • Distance

        public Distance​(double amount,
                        DistanceUnit unit)
        Creates a new distance.
        Parameters:
        amount - the amount of the distance. Must be a non-negative non-infinity number.
        unit - the distance unit. Must not be null.
        Since:
        9.0.0
    • Method Detail

      • getAmount

        public double getAmount()
        Returns the amount.
        Returns:
        the amount
        Since:
        9.0.0
      • getUnit

        public DistanceUnit getUnit()
        Returns the unit.
        Returns:
        the unit
        Since:
        9.0.0
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object