# Class SkyUnits

java.lang.Object
uk.ac.starlink.ttools.convert.SkyUnits

public abstract class SkyUnits extends Object
Class defining units used for a two-coordinate sky coordinate system. Each coordinate represents an angle.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final SkyUnits`
`DEFAULT_UNIT`
Default unit (DEGREES).
`static final SkyUnits`
`DEGREES`
Degrees.
`static final SkyUnits`
`RADIANS`
Radians.
`static final SkyUnits`
`SEXAGESIMAL`
Sexagesimal (hh:mm:ss.s, dd:mm:ss.s).

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`SkyUnits(String name)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`abstract double[]`
`decode(Object c1, Object c2)`
Takes a pair of objects representing coordinates in these units, and converts them to radians.
`abstract Object[]`
`encode(double c1, double c2)`
Takes a pair of coordinates in radians and converts them to these units.
`static SkyUnits[]`
`getKnownUnits()`
Returns a list of all the available instances of this class.
`String`
`getName()`
Returns the name of this unit system.
`static SkyUnits`
`getUnitsFor(String unitName)`
Returns a unit as specified by a name.
`abstract String[]`
`getUnitStrings()`
Returns a pair of descriptions for the units of the first and second coordinates represented by these units.
`abstract Class<?>[]`
`getUnitTypes()`
Returns a pair of classes for the first and second coordinates represented by these units.
`String`
`toString()`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### DEGREES

public static final SkyUnits DEGREES
Degrees.

### RADIANS

public static final SkyUnits RADIANS
Radians.

### SEXAGESIMAL

public static final SkyUnits SEXAGESIMAL
Sexagesimal (hh:mm:ss.s, dd:mm:ss.s).

### DEFAULT_UNIT

public static final SkyUnits DEFAULT_UNIT
Default unit (DEGREES).

## Constructor Details

### SkyUnits

protected SkyUnits(String name)
Constructor.

## Method Details

### decode

public abstract double[] decode(Object c1, Object c2)
Takes a pair of objects representing coordinates in these units, and converts them to radians.

Parameters:
  `c1` - first input coordinate, in these units
  `c2` - second input coordinate, in these units
Returns:
  array of two output coordinates, in radians

### encode

public abstract Object[] encode(double c1, double c2)
Takes a pair of coordinates in radians and converts them to these units.

Parameters:
  `c1` - first input coordinate, in radians
  `c2` - second input coordinate, in radians
Returns:
  array of two output coordinates, in these units

### getUnitStrings

public abstract String[] getUnitStrings()
Returns a pair of descriptions for the units of the first and second coordinates represented by these units. Tries to stick to the VOUnits standard.

Returns:
  array of two unit names

### getUnitTypes

public abstract Class<?>[] getUnitTypes()
Returns a pair of classes for the first and second coordinates represented by these units.

Returns:
  array of two classes, the types which should be presented to the `decode` method and will be returned from the `encode` method

### getName

public String getName()
Returns the name of this unit system.

Returns:
  name

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### getKnownUnits

public static SkyUnits[] getKnownUnits()
Returns a list of all the available instances of this class.

Returns:
  array of known unit systems

### getUnitsFor

public static SkyUnits getUnitsFor(String unitName)
Returns a unit as specified by a name. Name may be abbreviated. Returns a suitable unit or throws an IllegalArgumentException.