Package uk.ac.starlink.ttools.convert
Class SkyUnits
- java.lang.Object
-
- uk.ac.starlink.ttools.convert.SkyUnits
-
public abstract class SkyUnits extends java.lang.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 SkyUnits
DEFAULT_UNIT
Default unit (DEGREES).static SkyUnits
DEGREES
Degrees.static SkyUnits
RADIANS
Radians.static SkyUnits
SEXAGESIMAL
Sexagesimal (hh:mm:ss.s, dd:mm:ss.s).
-
Constructor Summary
Constructors Modifier Constructor Description protected
SkyUnits(java.lang.String name)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract double[]
decode(java.lang.Object c1, java.lang.Object c2)
Takes a pair of objects representing coordinates in these units, and converts them to radians.abstract java.lang.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.java.lang.String
getName()
Returns the name of this unit system.static SkyUnits
getUnitsFor(java.lang.String unitName)
Returns a unit as specified by a name.abstract java.lang.String[]
getUnitStrings()
Returns a pair of descriptions for the units of the first and second coordinates represented by these units.abstract java.lang.Class<?>[]
getUnitTypes()
Returns a pair of classes for the first and second coordinates represented by these units.java.lang.String
toString()
-
-
-
Method Detail
-
decode
public abstract double[] decode(java.lang.Object c1, java.lang.Object c2)
Takes a pair of objects representing coordinates in these units, and converts them to radians.- Parameters:
c1
- first input coordinate, in these unitsc2
- second input coordinate, in these units- Returns:
- array of two output coordinates, in radians
-
encode
public abstract java.lang.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 radiansc2
- second input coordinate, in radians- Returns:
- array of two output coordinates, in these units
-
getUnitStrings
public abstract java.lang.String[] getUnitStrings()
Returns a pair of descriptions for the units of the first and second coordinates represented by these units.- Returns:
- array of two unit names
-
getUnitTypes
public abstract java.lang.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 theencode
method
-
getName
public java.lang.String getName()
Returns the name of this unit system.- Returns:
- name
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.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(java.lang.String unitName)
Returns a unit as specified by a name. Name may be abbreviated. Returns a suitable unit or throws an IllegalArgumentException.
-
-