Class 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.
    • 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()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • 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 Detail

      • SkyUnits

        protected SkyUnits​(java.lang.String name)
        Constructor.
    • 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 units
        c2 - 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 radians
        c2 - 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. Tries to stick to the VOUnits standard.
        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 the encode 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 class java.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.