Enum DistanceUnits

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<DistanceUnits>

    public enum DistanceUnits
    extends java.lang.Enum<DistanceUnits>
    Define units for expressing distances (primarily for geo search).
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      KILOMETERS
      Units representing a kilometer.
      METERS
      Units representing a meter.
      MILES
      Units representing a mile.
      NAUTICAL_MILES
      Units representing a nautical mile.
      YARDS
      Units representing a yard.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static DistanceUnits fromExternal​(java.lang.String value)
      Parse a string value into a DistanceUnits value.
      abstract double fromMeters​(double value)
      Convert a value from meters to this enum's type.
      abstract double toMeters​(double value)
      Convert a value to meters from this enum's type.
      static DistanceUnits valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static DistanceUnits[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • METERS

        public static final DistanceUnits METERS
        Units representing a meter.
      • KILOMETERS

        public static final DistanceUnits KILOMETERS
        Units representing a kilometer.
      • YARDS

        public static final DistanceUnits YARDS
        Units representing a yard.
      • MILES

        public static final DistanceUnits MILES
        Units representing a mile.
      • NAUTICAL_MILES

        public static final DistanceUnits NAUTICAL_MILES
        Units representing a nautical mile.
    • Method Detail

      • values

        public static DistanceUnits[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (DistanceUnits c : DistanceUnits.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static DistanceUnits valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • toMeters

        public abstract double toMeters​(double value)
        Convert a value to meters from this enum's type.
      • fromMeters

        public abstract double fromMeters​(double value)
        Convert a value from meters to this enum's type.
      • fromExternal

        public static DistanceUnits fromExternal​(java.lang.String value)
        Parse a string value into a DistanceUnits value.