edu.nrao.sss.measure
Enum ArcUnits

java.lang.Object
  extended by java.lang.Enum<ArcUnits>
      extended by edu.nrao.sss.measure.ArcUnits
All Implemented Interfaces:
Symbolic, Serializable, Comparable<ArcUnits>

public enum ArcUnits
extends Enum<ArcUnits>
implements Symbolic

Units of arc.

Table of Units

Element Name1 Symbol1 HTML Symbol2 Units per Circle
DEGREEDEGREE d 3 &#x00B0; (°) 360.0
RADIANRADIAN rad rad
PERCENTPERCENT % &#x0025; (%) 100.0
HOURHOUR h h 24.0
MINUTEMINUTE m m 1,440.0
SECONDSECOND s s 86,400.0
ARC_MINUTEARC_MINUTE ' &#x0027; (') 21,600.0
ARC_SECONDARC_SECOND " &quot; (") 1,296,000.0
MILLI_ARC_SECONDMILLI_ARC_SECOND mas mas 1,296,000,000.0
1The names in this column may be sent to fromString(String). Note that the names are not case sensitive.
2The symbols for arc min and arc sec are sometimes troublesome in HTML (and in other arenas, for that matter). These particular symbols are placed in ampersand form.
3The original plan was to use '°' as the symbol, but 'd' is an easier identifier for users to furnish.

Table of Conversion Factors4

Elementdrad%hms'"mas
DEGREE1.00.017453292519943294444444444444444440.27777777777777777777777777777777780.066666666666666666666666666666666674.0240.060.03600.03600000.0
RADIAN57.295779513082325225835265587527121.015.915494309189534784954240440979763.819718634205488348389017705835142229.183118052329300903341062350108513750.987083139758054200463741006513437.746770784939513550115935251627206264.8062470963708130069561150976206264806.2470963708130069561150976
PERCENT3.60.062831853071795861.00.2414.4864.0216.012960.012960000.0
HOUR15.00.26179938779914941666666666666666674.1666666666666666666666666666666671.060.03600.0900.054000.054000000.0
MINUTE0.250.0043633231299858236111111111111111110.069444444444444444444444444444444440.016666666666666666666666666666666671.060.015.0900.0900000.0
SECOND0.0041666666666666666666666666666666670.000072722052166430393518518518518518520.0011574074074074074074074074074074070.00027777777777777777777777777777777780.016666666666666666666666666666666671.00.2515.015000.0
ARC_MINUTE0.016666666666666666666666666666666670.00029088820866572157407407407407407410.0046296296296296296296296296296296300.0011111111111111111111111111111111110.066666666666666666666666666666666674.01.060.060000.0
ARC_SECOND0.00027777777777777777777777777777777780.0000048481368110953595679012345679012350.000077160493827160493827160493827160490.000018518518518518518518518518518518520.0011111111111111111111111111111111110.066666666666666666666666666666666670.016666666666666666666666666666666671.01000.0
MILLI_ARC_SECOND2.777777777777777777777777777777778E-74.848136811095359567901234567901235E-97.716049382716049382716049382716049E-81.851851851851851851851851851851852E-80.0000011111111111111111111111111111111110.000066666666666666666666666666666666670.000016666666666666666666666666666666670.0011.0
4This table was generated from the conversion logic of this class.

Version Info:

$Revision: 1586 $
$Date: 2008-10-01 10:38:49 -0600 (Wed, 01 Oct 2008) $
$Author: dharland $

Since:
2006-04-12
Author:
David M. Harland

Enum Constant Summary
ARC_MINUTE
          One sixtieth of a degree.
ARC_SECOND
          One sixtieth of an arc minute.
DEGREE
          A degree.
HOUR
          An hour angle.
MILLI_ARC_SECOND
          One thousandth of an arc second.
MINUTE
          One sixtieth of an hour angle.
PERCENT
          Percent of a full circle.
RADIAN
          A radian.
SECOND
          One sixtieth of a minute.
 
Method Summary
static BigDecimal convertDmsTo(ArcUnits otherUnits, int degrees, int minutes, BigDecimal seconds)
          Converts from degrees-minutes-seconds to otherUnits.
static BigDecimal convertHmsTo(ArcUnits otherUnits, int hours, int minutes, BigDecimal seconds)
          Converts from hours-minutes-seconds to otherUnits.
 Number[] convertToDms(BigDecimal value)
          Converts value, expressed in this unit, to degrees-minutes-seconds.
 Number[] convertToHms(BigDecimal value)
          Converts value, expressed in this unit, to hours-minutes-seconds.
static ArcUnits fromString(String text)
          Returns the arc units represented by text.
static ArcUnits getDefault()
          Returns a default unit of arc.
 String getHtmlSymbol()
          Returns a symbol for this unit that may be more appropriate for use in HTML than the main symbol.
 String getSymbol()
          Returns the symbol for this unit.
 boolean symbolsAreCaseSensitive()
          Returns false -- these symbols are not case sensitive.
 BigDecimal toFullCircle()
          Returns the number of these units in a full circle.
 BigDecimal toHalfCircle()
          Returns the number of these units in one half of a circle.
 BigDecimal toQuarterCircle()
          Returns the number of these units in one quarter a circle.
 String toString()
          Returns a text representation of this enumeration constant.
 BigDecimal toUnits(ArcUnits otherUnits)
          Returns a factor for converting from this unit to otherUnits.
static ArcUnits valueOf(String name)
          Returns the enum constant of this type with the specified name.
static ArcUnits[] 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, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

DEGREE

public static final ArcUnits DEGREE
A degree. There are 360 degrees in a full circle.


RADIAN

public static final ArcUnits RADIAN
A radian. There are 2π radians in a full circle.


PERCENT

public static final ArcUnits PERCENT
Percent of a full circle. A full circle is 100%.


HOUR

public static final ArcUnits HOUR
An hour angle. There are 24 hours in a full circle.


MINUTE

public static final ArcUnits MINUTE
One sixtieth of an hour angle. Contrast this unit of measure with ARC_MINUTE.


SECOND

public static final ArcUnits SECOND
One sixtieth of a minute. Contrast this unit of measure with ARC_SECOND.


ARC_MINUTE

public static final ArcUnits ARC_MINUTE
One sixtieth of a degree. Contrast this unit of measure with MINUTE.


ARC_SECOND

public static final ArcUnits ARC_SECOND
One sixtieth of an arc minute. Contrast this unit of measure with SECOND.


MILLI_ARC_SECOND

public static final ArcUnits MILLI_ARC_SECOND
One thousandth of an arc second.

Method Detail

values

public static ArcUnits[] 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 (ArcUnits c : ArcUnits.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ArcUnits 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 name
NullPointerException - if the argument is null

symbolsAreCaseSensitive

public boolean symbolsAreCaseSensitive()
Returns false -- these symbols are not case sensitive.

Specified by:
symbolsAreCaseSensitive in interface Symbolic
Returns:
true if the case of the symbols carry meaning.

getSymbol

public String getSymbol()
Returns the symbol for this unit. For example, the symbol for DEGREE is d.

Specified by:
getSymbol in interface Symbolic
Returns:
the symbol for this unit.

getHtmlSymbol

public String getHtmlSymbol()
Returns a symbol for this unit that may be more appropriate for use in HTML than the main symbol. This is particularly true for ARC_MINUTE and ARC_SECOND. For most units, the HTML symbol is the same as the main symbol.

Returns:
a symbol for this unit that is HTML-friendly.

toFullCircle

public BigDecimal toFullCircle()
Returns the number of these units in a full circle.

Returns:
the number of these units in a full circle.

toHalfCircle

public BigDecimal toHalfCircle()
Returns the number of these units in one half of a circle. This is useful for calculating supplementarty angles.

Returns:
the number of these units in one half of a circle.

toQuarterCircle

public BigDecimal toQuarterCircle()
Returns the number of these units in one quarter a circle. This is useful for calculating complementarty angles.

Returns:
the number of these units in one quarter a circle.

toUnits

public BigDecimal toUnits(ArcUnits otherUnits)
Returns a factor for converting from this unit to otherUnits.

Parameters:
otherUnits - the unit to which conversion is desired.
Returns:
a factor for converting from this unit to otherUnits.

convertToDms

public Number[] convertToDms(BigDecimal value)
Converts value, expressed in this unit, to degrees-minutes-seconds.

Parameters:
value - the quantity, in this unit, to be converted to DMS.
Returns:
an array of size three in this order:
  1. An integral number of degrees.
  2. An integral number of arc minutes.
  3. A real number of arc seconds.

convertToHms

public Number[] convertToHms(BigDecimal value)
Converts value, expressed in this unit, to hours-minutes-seconds.

Parameters:
value - the quantity, in this unit, to be converted to DMS.
Returns:
an array of size three in this order:
  1. An integral number of degrees.
  2. An integral number of minutes.
  3. A real number of seconds.

convertDmsTo

public static BigDecimal convertDmsTo(ArcUnits otherUnits,
                                      int degrees,
                                      int minutes,
                                      BigDecimal seconds)
Converts from degrees-minutes-seconds to otherUnits.

At most, only one of degrees, minutes, or seconds may be negative. Further more, if one of these is negative, the higher units must all be zero. E.g., in order for seconds to be negative both degrees and minutes must be zero. If these conditions are not met, an IllegalArgumentException is thrown.

Parameters:
otherUnits - the units in which the value is returned.
degrees - the whole number of degrees of arc.
minutes - the whole number of minutes of arc. The normal range for this value is [0-59].
seconds - the whole and fraction number of seconds of arc. The normal range for this value is [0.0-60.0).
Returns:
the value of degrees, minutes, seconds converted to otherUnits.
Throws:
IllegalArgumentException - if the rules about negative parameters described above are violated.

convertHmsTo

public static BigDecimal convertHmsTo(ArcUnits otherUnits,
                                      int hours,
                                      int minutes,
                                      BigDecimal seconds)
Converts from hours-minutes-seconds to otherUnits.

At most, only one of hours, minutes, or seconds may be negative. Further more, if one of these is negative, the higher units must all be zero. E.g., in order for seconds to be negative both hours and minutes must be zero. If these conditions are not met, an IllegalArgumentException is thrown.

Parameters:
otherUnits - the units in which the value is returned.
hours - the whole number of angle hours.
minutes - the whole number of angle minutes. The normal range for this value is [0-59].
seconds - the whole and fraction number of angle seconds. The normal range for this value is [0.0-60.0).
Returns:
the value of hours, minutes, seconds converted to otherUnits.
Throws:
IllegalArgumentException - if the rules about negative parameters described above are violated.

getDefault

public static ArcUnits getDefault()
Returns a default unit of arc.

Returns:
a default unit of arc.

toString

public String toString()
Returns a text representation of this enumeration constant.

Overrides:
toString in class Enum<ArcUnits>
Returns:
a text representation of this enumeration constant.

fromString

public static ArcUnits fromString(String text)
Returns the arc units represented by text.

For details about the transformation, see EnumerationUtility.enumFromString(Class, String).

Parameters:
text - a text representation of a unit of arc.
Returns:
the arc units represented by text.


Copyright © 2009. All Rights Reserved.