Package mil.nga.crs.common
Enum Units
- java.lang.Object
-
- java.lang.Enum<Units>
-
- mil.nga.crs.common.Units
-
- All Implemented Interfaces:
Serializable
,Comparable<Units>
public enum Units extends Enum<Units>
Common Units- Since:
- 1.1.0
- Author:
- osbornb
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ARC_MINUTE
Arc-minute unitARC_SECOND
Arc-second unitBIN
Bin unitCALENDAR_MONTH
Calendar month unitCALENDAR_SECOND
Calendar second unitDAY
Day unitDEGREE
Degree unitFOOT
Foot unitGERMAN_LEGAL_METRE
German legal metre unitGRAD
Grad unitHECTOPASCAL
Hectopascal unitHOUR
Hour unitKILOMETRE
Kilometre unitMETRE
Metre unitMICROMETRE
Micrometre unitMICRORADIAN
Microradian unitMICROSECOND
Microsecond unitMILLIMETRE
Millimetre unitMILLIRADIAN
Milliradian unitMILLISECOND
Millisecond unitMINUTE
Minute unitPARTS_PER_MILLION
Parts per million unitPASCAL
Pascal unitRADIAN
Radian unitSECOND
Second unitUNITY
Unity unitUS_SURVEY_FOOT
US survey foot unitYEAR
Year unit
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
canConvert(Unit unit1, Unit unit2)
Determine if values can be converted between the two unitsstatic boolean
canConvert(Units unit1, Units unit2)
Determine if values can be converted between the two unitsstatic double
convert(double value, Unit from, Unit to)
Convert the value from a unit to a same typed unit, both with conversion factorsstatic double
convert(double value, Units from, Units to)
Convert the value from a unit to a same typed unit, both with conversion factorsstatic Unit
createDefaultUnit(UnitType type)
Create the default unit for the unit typeUnit
createUnit()
Create a unitstatic Units
fromName(String name)
Get the units type from the namestatic Units
fromUnit(Unit unit)
Get the units type from the unitDouble
getConversionFactor()
Get the conversion factorstatic Units
getDefaultUnit(UnitType type)
Get the default unit for the unit typeString
getName()
Get the nameUnitType
getType()
Get the typestatic UnitType
getUnitType(String name)
Get the unit type from the nameboolean
hasConversionFactor()
Has conversion factorstatic Units
valueOf(String name)
Returns the enum constant of this type with the specified name.static Units[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
MICROMETRE
public static final Units MICROMETRE
Micrometre unit
-
MILLIMETRE
public static final Units MILLIMETRE
Millimetre unit
-
METRE
public static final Units METRE
Metre unit
-
KILOMETRE
public static final Units KILOMETRE
Kilometre unit
-
GERMAN_LEGAL_METRE
public static final Units GERMAN_LEGAL_METRE
German legal metre unit
-
US_SURVEY_FOOT
public static final Units US_SURVEY_FOOT
US survey foot unit
-
FOOT
public static final Units FOOT
Foot unit
-
MICRORADIAN
public static final Units MICRORADIAN
Microradian unit
-
MILLIRADIAN
public static final Units MILLIRADIAN
Milliradian unit
-
RADIAN
public static final Units RADIAN
Radian unit
-
ARC_SECOND
public static final Units ARC_SECOND
Arc-second unit
-
ARC_MINUTE
public static final Units ARC_MINUTE
Arc-minute unit
-
DEGREE
public static final Units DEGREE
Degree unit
-
GRAD
public static final Units GRAD
Grad unit
-
UNITY
public static final Units UNITY
Unity unit
-
BIN
public static final Units BIN
Bin unit
-
PARTS_PER_MILLION
public static final Units PARTS_PER_MILLION
Parts per million unit
-
PASCAL
public static final Units PASCAL
Pascal unit
-
HECTOPASCAL
public static final Units HECTOPASCAL
Hectopascal unit
-
MICROSECOND
public static final Units MICROSECOND
Microsecond unit
-
MILLISECOND
public static final Units MILLISECOND
Millisecond unit
-
SECOND
public static final Units SECOND
Second unit
-
MINUTE
public static final Units MINUTE
Minute unit
-
HOUR
public static final Units HOUR
Hour unit
-
DAY
public static final Units DAY
Day unit
-
YEAR
public static final Units YEAR
Year unit
-
CALENDAR_SECOND
public static final Units CALENDAR_SECOND
Calendar second unit
-
CALENDAR_MONTH
public static final Units CALENDAR_MONTH
Calendar month unit
-
-
Method Detail
-
values
public static Units[] 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 (Units c : Units.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Units 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
-
getType
public UnitType getType()
Get the type- Returns:
- type
-
getName
public String getName()
Get the name- Returns:
- name
-
hasConversionFactor
public boolean hasConversionFactor()
Has conversion factor- Returns:
- true if has conversion factor
-
getConversionFactor
public Double getConversionFactor()
Get the conversion factor- Returns:
- conversion factor
-
createUnit
public Unit createUnit()
Create a unit- Returns:
- new unit
-
fromName
public static Units fromName(String name)
Get the units type from the name- Parameters:
name
- unit name- Returns:
- units type
-
fromUnit
public static Units fromUnit(Unit unit)
Get the units type from the unit- Parameters:
unit
- unit- Returns:
- units type
-
getUnitType
public static UnitType getUnitType(String name)
Get the unit type from the name- Parameters:
name
- unit name- Returns:
- units type
- Since:
- 1.1.0
-
getDefaultUnit
public static Units getDefaultUnit(UnitType type)
Get the default unit for the unit type- Parameters:
type
- unit type- Returns:
- default unit or null if no default
-
createDefaultUnit
public static Unit createDefaultUnit(UnitType type)
Create the default unit for the unit type- Parameters:
type
- unit type- Returns:
- default unit or null if no default
-
canConvert
public static boolean canConvert(Unit unit1, Unit unit2)
Determine if values can be converted between the two units- Parameters:
unit1
- first unitunit2
- second unit- Returns:
- true if can convert
-
convert
public static double convert(double value, Unit from, Unit to)
Convert the value from a unit to a same typed unit, both with conversion factors- Parameters:
value
- value to convertfrom
- unit to convert fromto
- unit to convert to- Returns:
- converted value
-
canConvert
public static boolean canConvert(Units unit1, Units unit2)
Determine if values can be converted between the two units- Parameters:
unit1
- first unitunit2
- second unit- Returns:
- true if can convert
- Since:
- 1.1.1
-
-