Package adql.db

## Class STCS.CoordSys

- java.lang.Object
- - adql.db.STCS.CoordSys

- Enclosing class:
    STCS

      public static class STCS.CoordSys
      extends java.lang.Object

  Object representation of an STC coordinate system.

  A coordinate system is composed of three parts: a frame (`frame`), a reference position (`refpos`) and a flavor (`flavor`).

  The default value - also corresponding to an empty string - should be: `STCS.Frame.UNKNOWNFRAME` `STCS.RefPos.UNKNOWNREFPOS` `STCS.Flavor.SPHERICAL2`. Once built, it is possible to know whether the coordinate system is the default one or not thanks to function `isDefault()`.

  An instance of this class can be easily serialized into STC-S using `toSTCS()`, `toFullSTCS()` or `toString()`. `toFullSTCS()` will display default values explicitly on the contrary to `toSTCS()` which will replace them by empty strings.

  Important note: The flavors CARTESIAN2 and CARTESIAN3 can not be used with other frame and reference position than UNKNOWNFRAME and UNKNOWNREFPOS. In the contrary case an `IllegalArgumentException` is throw.

  Since:
    1.3
  Version:
    1.3 (10/2014)
  Author:
    Grégory Mantelet (ARI)

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `STCS.Flavor` | `flavor` | Third and last item of a coordinate system expression: the flavor.
    `STCS.Frame` | `frame` | First item of a coordinate system expression: the frame.
    `STCS.RefPos` | `refpos` | Second item of a coordinate system expression: the reference position.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CoordSys()` | Build a default coordinate system (UNKNOWNFRAME UNKNOWNREFPOS SPHERICAL2).
    `CoordSys​(STCS.Frame fr, STCS.RefPos rp, STCS.Flavor fl)` | Build a coordinate system with the given parts.
    `CoordSys​(java.lang.String coordsys)` | Build a coordinate system by parsing the given STC-S expression.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `isDefault()` | Tell whether this is the default coordinate system (UNKNOWNFRAME UNKNOWNREFPOS SPHERICAL2).
    `java.lang.String` | `toFullSTCS()` | Get the STC-S expression of this coordinate system, in which default values are explicitly written.
    `java.lang.String` | `toSTCS()` | Get the STC-S expression of this coordinate system, in which default values are not written (they are replaced by empty strings).
    `java.lang.String` | `toString()` | Convert this coordinate system into a STC-S expression.

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### frame

          public final STCS.Frame frame

      First item of a coordinate system expression: the frame.

    - #### refpos

          public final STCS.RefPos refpos

      Second item of a coordinate system expression: the reference position.

    - #### flavor

          public final STCS.Flavor flavor

      Third and last item of a coordinate system expression: the flavor.

  - ### Constructor Detail

    - #### CoordSys

          public CoordSys()

      Build a default coordinate system (UNKNOWNFRAME UNKNOWNREFPOS SPHERICAL2).

    - #### CoordSys

          public CoordSys​(STCS.Frame fr,
                          STCS.RefPos rp,
                          STCS.Flavor fl)
                   throws java.lang.IllegalArgumentException

      Build a coordinate system with the given parts.
      Parameters:
        `fr` - Frame part.
        `rp` - Reference position part.
        `fl` - Flavor part.
      Throws:
        `java.lang.IllegalArgumentException` - If a cartesian flavor is used with a frame and reference position other than UNKNOWNFRAME and UNKNOWNREFPOS.

    - #### CoordSys

          public CoordSys​(java.lang.String coordsys)
                   throws ParseException

      Build a coordinate system by parsing the given STC-S expression.
      Parameters:
        `coordsys` - STC-S expression representing a coordinate system. Empty string and NULL are allowed values ; they correspond to a default coordinate system.
      Throws:
        `ParseException` - If the syntax of the given STC-S expression is wrong or if it is not a coordinate system only.

  - ### Method Detail

    - #### isDefault

          public final boolean isDefault()

      Tell whether this is the default coordinate system (UNKNOWNFRAME UNKNOWNREFPOS SPHERICAL2).
      Returns:
        true if it is the default coordinate system, false otherwise.

    - #### toSTCS

          public java.lang.String toSTCS()

      Get the STC-S expression of this coordinate system, in which default values are not written (they are replaced by empty strings).
      Returns:
        STC-S representation of this coordinate system.

    - #### toFullSTCS

          public java.lang.String toFullSTCS()

      Get the STC-S expression of this coordinate system, in which default values are explicitly written.
      Returns:
        STC-S representation of this coordinate system.

    - #### toString

          public java.lang.String toString()

      Convert this coordinate system into a STC-S expression.
      Overrides:
        `toString` in class `java.lang.Object`
      See Also:
        `Object.toString()`, `toSTCS()`