Package org.tinfour.utils
Enum LinearUnits
- java.lang.Object
-
- java.lang.Enum<LinearUnits>
-
- org.tinfour.utils.LinearUnits
-
- All Implemented Interfaces:
Serializable,Comparable<LinearUnits>
public enum LinearUnits extends Enum<LinearUnits>
An enumeration for specifying linear units of measure.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doublefromMeters(double value)Convert a value specified in meters to the unit system indicated by this enumeration instance.StringgetAbbreviation()Get the abbreviation for the unit of measure.StringgetName()Gets the name of the units in a form suitable for user interface display.doubletoMeters(double value)Convert the specified value to meters.static LinearUnitsvalueOf(String name)Returns the enum constant of this type with the specified name.static LinearUnits[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
UNKNOWN
public static final LinearUnits UNKNOWN
Indicates that no unit specification is applicable.
-
METERS
public static final LinearUnits METERS
Specifies units in meters.
-
FEET
public static final LinearUnits FEET
Specifies units in feet.
-
FATHOMS
public static final LinearUnits FATHOMS
Specifies units in fathoms.
-
-
Method Detail
-
values
public static LinearUnits[] 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 (LinearUnits c : LinearUnits.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static LinearUnits valueOf(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:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getAbbreviation
public String getAbbreviation()
Get the abbreviation for the unit of measure. Where appropriate this will be an SI abbreviation given in lower case.- Returns:
- a valid string
-
toMeters
public double toMeters(double value)
Convert the specified value to meters.- Parameters:
value- a valid numeric value in the system of units specified by the enumeration instance- Returns:
- a valid floating-point value, in meters.
-
fromMeters
public double fromMeters(double value)
Convert a value specified in meters to the unit system indicated by this enumeration instance.- Parameters:
value- a value in meters- Returns:
- a value in the current unit system.
-
getName
public String getName()
Gets the name of the units in a form suitable for user interface display.- Returns:
- a valid string.
-
-