Enum DistanceUnit

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

    public enum DistanceUnit
    extends java.lang.Enum<DistanceUnit>

    The distance units for use with spatial queries

    Since:
    4.0
    Version:
    4.0
    Author:
    Michael Grove
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double convert​(double theValue, DistanceUnit theUnit)
      Convert the value in the given unit to this unit
      double toCentimeters​(double theDistance)  
      double toDegrees​(double theDistance)
      Convert this distance to degrees
      double toFeet​(double theDistance)  
      double toInches​(double theDistance)  
      double toKilometers​(double theDistance)
      Convert this distance to kilometers
      double toMeters​(double theDistance)  
      double toMiles​(double theDistance)
      Convert this distance to miles
      double toRadians​(double theDistance)  
      double toYards​(double theDistance)  
      static DistanceUnit valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static DistanceUnit[] 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
    • Method Detail

      • values

        public static DistanceUnit[] 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 (DistanceUnit c : DistanceUnit.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static DistanceUnit 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
      • toInches

        public double toInches​(double theDistance)
      • toFeet

        public double toFeet​(double theDistance)
      • toYards

        public double toYards​(double theDistance)
      • toCentimeters

        public double toCentimeters​(double theDistance)
      • toRadians

        public double toRadians​(double theDistance)
      • toMeters

        public double toMeters​(double theDistance)
      • toKilometers

        public double toKilometers​(double theDistance)
        Convert this distance to kilometers
        Parameters:
        theDistance - the distance
        Returns:
        the distance in kilometers
      • toMiles

        public double toMiles​(double theDistance)
        Convert this distance to miles
        Parameters:
        theDistance - the distance
        Returns:
        the distance in miles
      • toDegrees

        public double toDegrees​(double theDistance)
        Convert this distance to degrees
        Parameters:
        theDistance - the distance
        Returns:
        the distance in degrees
      • convert

        public double convert​(double theValue,
                              DistanceUnit theUnit)
        Convert the value in the given unit to this unit
        Parameters:
        theValue - the value
        theUnit - the unit of the value
        Returns:
        the value converted to this unit