cds.astro
Class Astroformat

java.lang.Object
  extended by cds.astro.Astroformat
Direct Known Subclasses:
Editing, Parsing

public class Astroformat
extends java.lang.Object

This class contains definitions used in Parsing and Editing of numbers, and the default representation of the NaN (null) value.

Version:
1.0 : 12-Aug-2004 as a separate entiry, 1.1 : 12-Aug-2006 added DATE_MJD, 1.2 : 30-Oct-2006 added DATE_DIFF
Author:
Francois Ochsenbein -- francois@astro.u-strasbg.fr

Field Summary
static int DATE
          The number represents a date; variants follow
static int DATE_alpha
          Format of date contains alphabetical month
static int DATE_COMP
          Number represents a date (returned as MJD)
static int DATE_DIFF
          Time expressed as days (elapsed time)
static int DATE_DMY
          Format of date is Day Month Year
static int DATE_DY
          Format of date is Day and Year, day in range [1..366]
static int DATE_MDY
          Format of date is Month Day Year
static int DATE_MY
          Format of date is Year and Month
static int DATE_MYD
          Format of date is Month Year Day
static int DATE_YD
          Format of date is Year and Day, day in range [1..366]
static int DATE_YM
          Format of date is Year and Month
static int DATE_YMD
          Format of date is Year Month Day
static int DECIMAL
          Format of number is decimal
static int EFORMAT
          Format of number contains the E notation
static int FACTOR
          Format of number is of the form mantissax10±exp
static java.lang.String[] month_list
          The standard edition of month names
 java.lang.String[] nulls
          The default way of representing the NULL (unknown) numbers .
static int SEXA1d
          Format of number is sexagesimal 1 component (with : or d)
static int SEXA1h
          Format of number is sexagesimal 1 component (with h)
static int SEXA1o
          Format of number is sexagesimal 1 component (with °)
static int SEXA2
          Format of number is sexagesimal (2 components h m)
static int SEXA2c
          Format of number is sexagesimal (2 components h:m)
static int SEXA2d
          Format of number is sexagesimal angle (2 components dm)
static int SEXA2h
          Format of number is sexagesimal time (2 components hm)
static int SEXA2o
          Format of number is sexagesimal 2 component (with ° ')
static int SEXA3
          Format of number is sexagesimal (3 components h m s)
static int SEXA3c
          Format of number is sexagesimal (3 components h:m:s)
static int SEXA3d
          Format of number is sexagesimal angle (3 components dms)
static int SEXA3h
          Format of number is sexagesimal time (3 components hms)
static int SEXA3o
          Format of number is sexagesimal 3 component (with ° ' ")
static int SIGN_EDIT
          Number must be signed (contains a '+' sign if positive)
static int TRUNCATE
          Numbers are truncated in their edition
static int ZERO_FILL
          Number must be left-filled with zeroes
 
Constructor Summary
Astroformat()
          Create an Astroformat with the defaut "---" edition for NULL values.
Astroformat(java.lang.String default_null)
          Create an Astroformat with the defaut "---" edition for NULL values.
 
Method Summary
 void acceptAsNaN(java.lang.String representation)
          Give alternative representation of nulls.
static java.lang.String explain(int bin_form)
          Explain the 'form' of the last parsed number
static java.lang.String explainComplex(java.lang.String pic)
          Explain the conventions of "complex" templates.
static boolean isAngle(int bin_form)
          Test whether a format indicates Angle (dms or °'").
static boolean isDate(int bin_form)
          Test whether a format indicates a Date (YMD).
static boolean isDays(int bin_form)
          Test whether a format indicates a number of days.
static boolean isSexa(int bin_form)
          Test whether a format indicates a Sexagesimal coding.
static boolean isTime(int bin_form)
          Test whether a format indicates Time (hms).
 void setNaN(java.lang.String default_null)
          Change the default edition of NULL.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nulls

public java.lang.String[] nulls
The default way of representing the NULL (unknown) numbers . The first element of the array contains the default_null. Implicitely the last character of any NULL representation may be repeated.


DECIMAL

public static final int DECIMAL
Format of number is decimal

See Also:
Constant Field Values

EFORMAT

public static final int EFORMAT
Format of number contains the E notation

See Also:
Constant Field Values

FACTOR

public static final int FACTOR
Format of number is of the form mantissax10±exp

See Also:
Constant Field Values

SEXA2

public static final int SEXA2
Format of number is sexagesimal (2 components h m)

See Also:
Constant Field Values

SEXA3

public static final int SEXA3
Format of number is sexagesimal (3 components h m s)

See Also:
Constant Field Values

SEXA2c

public static final int SEXA2c
Format of number is sexagesimal (2 components h:m)

See Also:
Constant Field Values

SEXA3c

public static final int SEXA3c
Format of number is sexagesimal (3 components h:m:s)

See Also:
Constant Field Values

SEXA2d

public static final int SEXA2d
Format of number is sexagesimal angle (2 components dm)

See Also:
Constant Field Values

SEXA3d

public static final int SEXA3d
Format of number is sexagesimal angle (3 components dms)

See Also:
Constant Field Values

SEXA2h

public static final int SEXA2h
Format of number is sexagesimal time (2 components hm)

See Also:
Constant Field Values

SEXA3h

public static final int SEXA3h
Format of number is sexagesimal time (3 components hms)

See Also:
Constant Field Values

SEXA1d

public static final int SEXA1d
Format of number is sexagesimal 1 component (with : or d)

See Also:
Constant Field Values

SEXA1h

public static final int SEXA1h
Format of number is sexagesimal 1 component (with h)

See Also:
Constant Field Values

SEXA1o

public static final int SEXA1o
Format of number is sexagesimal 1 component (with °)

See Also:
Constant Field Values

SEXA2o

public static final int SEXA2o
Format of number is sexagesimal 2 component (with ° ')

See Also:
Constant Field Values

SEXA3o

public static final int SEXA3o
Format of number is sexagesimal 3 component (with ° ' ")

See Also:
Constant Field Values

DATE

public static final int DATE
The number represents a date; variants follow

See Also:
Constant Field Values

DATE_alpha

public static final int DATE_alpha
Format of date contains alphabetical month

See Also:
Constant Field Values

DATE_YM

public static final int DATE_YM
Format of date is Year and Month

See Also:
Constant Field Values

DATE_MY

public static final int DATE_MY
Format of date is Year and Month

See Also:
Constant Field Values

DATE_YD

public static final int DATE_YD
Format of date is Year and Day, day in range [1..366]

See Also:
Constant Field Values

DATE_DY

public static final int DATE_DY
Format of date is Day and Year, day in range [1..366]

See Also:
Constant Field Values

DATE_YMD

public static final int DATE_YMD
Format of date is Year Month Day

See Also:
Constant Field Values

DATE_DMY

public static final int DATE_DMY
Format of date is Day Month Year

See Also:
Constant Field Values

DATE_MDY

public static final int DATE_MDY
Format of date is Month Day Year

See Also:
Constant Field Values

DATE_MYD

public static final int DATE_MYD
Format of date is Month Year Day

See Also:
Constant Field Values

DATE_DIFF

public static final int DATE_DIFF
Time expressed as days (elapsed time)

See Also:
Constant Field Values

SIGN_EDIT

public static final int SIGN_EDIT
Number must be signed (contains a '+' sign if positive)

See Also:
Constant Field Values

ZERO_FILL

public static final int ZERO_FILL
Number must be left-filled with zeroes

See Also:
Constant Field Values

TRUNCATE

public static final int TRUNCATE
Numbers are truncated in their edition

See Also:
Constant Field Values

DATE_COMP

public static final int DATE_COMP
Number represents a date (returned as MJD)

See Also:
Constant Field Values

month_list

public static java.lang.String[] month_list
The standard edition of month names

Constructor Detail

Astroformat

public Astroformat()
Create an Astroformat with the defaut "---" edition for NULL values.


Astroformat

public Astroformat(java.lang.String default_null)
Create an Astroformat with the defaut "---" edition for NULL values.

Method Detail

explain

public static final java.lang.String explain(int bin_form)
Explain the 'form' of the last parsed number

Returns:
A printable variant of format.

isSexa

public static final boolean isSexa(int bin_form)
Test whether a format indicates a Sexagesimal coding.

Returns:
true if it does.

isDate

public static final boolean isDate(int bin_form)
Test whether a format indicates a Date (YMD). Units are days (a date is expressed as MJD)

Returns:
true if it does.

isDays

public static final boolean isDays(int bin_form)
Test whether a format indicates a number of days. Similar to isTime, but units are days.

Returns:
true if it does.

isTime

public static final boolean isTime(int bin_form)
Test whether a format indicates Time (hms). Units are then hours.

Returns:
true if it does.

isAngle

public static final boolean isAngle(int bin_form)
Test whether a format indicates Angle (dms or °'"). Units are then degrees

Returns:
true if it does.

explainComplex

public static final java.lang.String explainComplex(java.lang.String pic)
Explain the conventions of "complex" templates. Letters are Y y (years) M (month) D (day) h (hour) m (minutes) s (seconds) d (degrees) f (fractions), and punctuations like : (colon) / (slash), etc.

Parameters:
pic - "picture" which specifies the format
Returns:
the explanations

setNaN

public void setNaN(java.lang.String default_null)
Change the default edition of NULL. All alternative representations are removed.

Parameters:
default_null - The default null representation

acceptAsNaN

public void acceptAsNaN(java.lang.String representation)
Give alternative representation of nulls.

Parameters:
representation - An additional possible representation of a null. The last character may be repeated.


Copyright © 2009 UDS/CNRS