cds.astro
Class Sptype

java.lang.Object
  extended by cds.astro.Sptype
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Sptype
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Spectral type

See Also:
Serialized Form

Field Summary
static int _CN
           
static int _comp
           
static int _em
           
static int _m
           
static int _n
           
static int _n1
           
static int _n2
           
static int _neb
           
static int _nn
           
static int _NONE
           
static int _pec
           
static int _s
           
static int _sh
           
static int _ss
           
static int _var
           
static int _W
           
static char EOS
           
static long GENERAL_BRACKETS
           
static int GENERAL_BRACKETS_POS
           
static int GENERAL_FLAGS_BEGIN
           
static int GENERAL_FLAGS_LENGTH
           
static long GENERAL_FLAGS_MASK
           
static long GENERAL_INCOMPLETENESS
           
static int GENERAL_INCOMPLETENESS_POS
           
static int LUM_BEGIN
           
static int LUM_LENGTH
           
static long LUM_UNCERTAINTY_FLAG
           
static int LUM_UNCERTAINTY_FLAG_POS
           
protected static java.lang.Object[] lumCodes
           
static int NOSUBTYPE_VALUE
           
static java.lang.String Of_FLAGS
           
static int PEC_BEGIN
           
static int PEC_LENGTH
           
static long PEC_UNCERTAINTY_FLAG
           
static int PEC_UNCERTAINTY_FLAG_POS
           
protected static java.lang.Object[] regularTempCodes
           
static int TEMP_BEGIN
           
static int TEMP_FLAGS_BEGIN
           
static int TEMP_FLAGS_LENGTH
           
static long TEMP_FLAGS_MASK
           
static long TEMP_HOUK_FLAG
           
static int TEMP_HOUK_FLAG_POS
           
static long TEMP_INCOMPLETE_FLAG
           
static int TEMP_INCOMPLETE_FLAG_POS
           
static int TEMP_LENGTH
           
static long TEMP_MK_FLAG
           
static int TEMP_MK_FLAG_POS
           
static long TEMP_NOSUBTYPE_FLAG
           
static int TEMP_NOSUBTYPE_FLAG_POS
           
static long TEMP_UNCERTAINTY_FLAG
           
static int TEMP_UNCERTAINTY_FLAG_POS
           
static int UNKNOWN_CODE
           
static int WD_A_FLAG
           
static int WD_B_FLAG
           
static int WD_C_FLAG
           
static int WD_E_FLAG
           
static int WD_H_FLAG
           
static int WD_O_FLAG
           
static int WD_P_FLAG
           
static int WD_Q_FLAG
           
static int WD_V_FLAG
           
static int WD_X_FLAG
           
static int WD_Z_FLAG
           
 
Constructor Summary
Sptype()
          Empty constructor
Sptype(Sptype sp)
          Copy constructor.
Sptype(java.lang.String sp)
          Constructor with initialisation by a spectral type string
Sptype(java.lang.String spstr, long spbin)
          Constructor to use ONLY with an already parsed and correct spectral type.
 
Method Summary
 java.lang.Object clone()
          Copy values parameters
static boolean compare(java.lang.String sp1, java.lang.String sp2)
          Compare two spectral type strings after some canonical normalisation
 java.lang.String decode()
          Decode the current type from binary into the string.
static java.lang.String decode(long binsp)
          Decode the given binary type into a string.
 boolean equals(java.lang.Object o)
          Spectral type object comparison
 java.lang.String get()
          Get the spectral type string
static java.util.ArrayList getLumCodes()
          Get the list of luminosity codes (for displaying purpose)
static java.lang.String getNonParsableItems(java.lang.String spstr)
          Get the string of non parsable elements in a spectral type string
 long getSpBin()
          Get the binary spectral type value
 long getSpMask()
          Get the spectral type binary mask (used for sql queries)
 java.lang.String getSpNumeric()
          Get the current spectral type in a edited form (TTTTTTTT.LLLL.ppp0)
static java.lang.String getSpNumeric(long spbinary)
          Get the given binary spectral type in a edited form (TT.TTTTTT.LLLL.ppp0)
static java.util.ArrayList getTempCodes()
          Get the list of temperature codes (for displaying purpose)
 int hashCode()
          Compute the hashcode
 boolean hasValue()
          Checks wether the SpectralType has a value
 int parse(java.lang.String sp)
          Parse a spectral type string
 int parse(java.lang.String sp, int offset)
          Parse a spectral type string
 void reset()
          Resets a SpectralType object to nodata
 void set(Sptype sp)
          Sets the SpectralType from another SpectralType object
 java.lang.String toString()
          returns the spectral type string, without spaces between the fields
 java.lang.String toString(boolean separFields)
          returns the spectral type string.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN_CODE

public static final int UNKNOWN_CODE
See Also:
Constant Field Values

GENERAL_FLAGS_BEGIN

public static final int GENERAL_FLAGS_BEGIN
See Also:
Constant Field Values

GENERAL_FLAGS_LENGTH

public static final int GENERAL_FLAGS_LENGTH
See Also:
Constant Field Values

GENERAL_FLAGS_MASK

public static final long GENERAL_FLAGS_MASK
See Also:
Constant Field Values

GENERAL_INCOMPLETENESS

public static final long GENERAL_INCOMPLETENESS
See Also:
Constant Field Values

GENERAL_INCOMPLETENESS_POS

public static final int GENERAL_INCOMPLETENESS_POS
See Also:
Constant Field Values

GENERAL_BRACKETS

public static final long GENERAL_BRACKETS
See Also:
Constant Field Values

GENERAL_BRACKETS_POS

public static final int GENERAL_BRACKETS_POS
See Also:
Constant Field Values

TEMP_FLAGS_BEGIN

public static final int TEMP_FLAGS_BEGIN
See Also:
Constant Field Values

TEMP_FLAGS_LENGTH

public static final int TEMP_FLAGS_LENGTH
See Also:
Constant Field Values

TEMP_FLAGS_MASK

public static final long TEMP_FLAGS_MASK
See Also:
Constant Field Values

TEMP_UNCERTAINTY_FLAG

public static final long TEMP_UNCERTAINTY_FLAG
See Also:
Constant Field Values

TEMP_UNCERTAINTY_FLAG_POS

public static final int TEMP_UNCERTAINTY_FLAG_POS
See Also:
Constant Field Values

TEMP_NOSUBTYPE_FLAG

public static final long TEMP_NOSUBTYPE_FLAG
See Also:
Constant Field Values

TEMP_NOSUBTYPE_FLAG_POS

public static final int TEMP_NOSUBTYPE_FLAG_POS
See Also:
Constant Field Values

TEMP_INCOMPLETE_FLAG

public static final long TEMP_INCOMPLETE_FLAG
See Also:
Constant Field Values

TEMP_INCOMPLETE_FLAG_POS

public static final int TEMP_INCOMPLETE_FLAG_POS
See Also:
Constant Field Values

TEMP_HOUK_FLAG

public static final long TEMP_HOUK_FLAG
See Also:
Constant Field Values

TEMP_HOUK_FLAG_POS

public static final int TEMP_HOUK_FLAG_POS
See Also:
Constant Field Values

TEMP_MK_FLAG

public static final long TEMP_MK_FLAG
See Also:
Constant Field Values

TEMP_MK_FLAG_POS

public static final int TEMP_MK_FLAG_POS
See Also:
Constant Field Values

TEMP_BEGIN

public static final int TEMP_BEGIN
See Also:
Constant Field Values

TEMP_LENGTH

public static final int TEMP_LENGTH
See Also:
Constant Field Values

LUM_BEGIN

public static final int LUM_BEGIN
See Also:
Constant Field Values

LUM_LENGTH

public static final int LUM_LENGTH
See Also:
Constant Field Values

LUM_UNCERTAINTY_FLAG

public static final long LUM_UNCERTAINTY_FLAG
See Also:
Constant Field Values

LUM_UNCERTAINTY_FLAG_POS

public static final int LUM_UNCERTAINTY_FLAG_POS
See Also:
Constant Field Values

PEC_BEGIN

public static final int PEC_BEGIN
See Also:
Constant Field Values

PEC_LENGTH

public static final int PEC_LENGTH
See Also:
Constant Field Values

PEC_UNCERTAINTY_FLAG

public static final long PEC_UNCERTAINTY_FLAG
See Also:
Constant Field Values

PEC_UNCERTAINTY_FLAG_POS

public static final int PEC_UNCERTAINTY_FLAG_POS
See Also:
Constant Field Values

EOS

public static final char EOS
See Also:
Constant Field Values

_CN

public static final int _CN
See Also:
Constant Field Values

_W

public static final int _W
See Also:
Constant Field Values

_m

public static final int _m
See Also:
Constant Field Values

_s

public static final int _s
See Also:
Constant Field Values

_n

public static final int _n
See Also:
Constant Field Values

_n1

public static final int _n1
See Also:
Constant Field Values

_n2

public static final int _n2
See Also:
Constant Field Values

_nn

public static final int _nn
See Also:
Constant Field Values

_sh

public static final int _sh
See Also:
Constant Field Values

_neb

public static final int _neb
See Also:
Constant Field Values

_ss

public static final int _ss
See Also:
Constant Field Values

_var

public static final int _var
See Also:
Constant Field Values

_em

public static final int _em
See Also:
Constant Field Values

_comp

public static final int _comp
See Also:
Constant Field Values

_pec

public static final int _pec
See Also:
Constant Field Values

NOSUBTYPE_VALUE

public static final int NOSUBTYPE_VALUE
See Also:
Constant Field Values

_NONE

public static final int _NONE
See Also:
Constant Field Values

WD_A_FLAG

public static final int WD_A_FLAG
See Also:
Constant Field Values

WD_B_FLAG

public static final int WD_B_FLAG
See Also:
Constant Field Values

WD_O_FLAG

public static final int WD_O_FLAG
See Also:
Constant Field Values

WD_C_FLAG

public static final int WD_C_FLAG
See Also:
Constant Field Values

WD_Q_FLAG

public static final int WD_Q_FLAG
See Also:
Constant Field Values

WD_Z_FLAG

public static final int WD_Z_FLAG
See Also:
Constant Field Values

WD_X_FLAG

public static final int WD_X_FLAG
See Also:
Constant Field Values

WD_P_FLAG

public static final int WD_P_FLAG
See Also:
Constant Field Values

WD_H_FLAG

public static final int WD_H_FLAG
See Also:
Constant Field Values

WD_E_FLAG

public static final int WD_E_FLAG
See Also:
Constant Field Values

WD_V_FLAG

public static final int WD_V_FLAG
See Also:
Constant Field Values

Of_FLAGS

public static final java.lang.String Of_FLAGS
See Also:
Constant Field Values

regularTempCodes

protected static java.lang.Object[] regularTempCodes

lumCodes

protected static java.lang.Object[] lumCodes
Constructor Detail

Sptype

public Sptype()
Empty constructor


Sptype

public Sptype(java.lang.String sp)
       throws java.text.ParseException
Constructor with initialisation by a spectral type string

Parameters:
sp - spectral type string.
Throws:
java.text.ParseException - if the spectral type is incorrect

Sptype

public Sptype(Sptype sp)
Copy constructor.

Parameters:
sp - SpectralType object

Sptype

public Sptype(java.lang.String spstr,
              long spbin)
Constructor to use ONLY with an already parsed and correct spectral type.
With this constructor the object has no mask for SQL queries
The typical usage is for spectral type extracted from Simbad

Parameters:
spstr - spectral type string (already normalized)
spbin - binary spectral type
Method Detail

reset

public void reset()
Resets a SpectralType object to nodata


hasValue

public boolean hasValue()
Checks wether the SpectralType has a value

Returns:
true if it has a value, false otherwise

set

public void set(Sptype sp)
Sets the SpectralType from another SpectralType object

Parameters:
sp - SpectralType object to copy

get

public java.lang.String get()
Get the spectral type string

Returns:
the spectral type string

getSpBin

public long getSpBin()
Get the binary spectral type value

Returns:
the long containing the binary spectral type

getSpNumeric

public java.lang.String getSpNumeric()
Get the current spectral type in a edited form (TTTTTTTT.LLLL.ppp0)

Returns:
the string containing the binary edited spectral type

getSpNumeric

public static java.lang.String getSpNumeric(long spbinary)
Get the given binary spectral type in a edited form (TT.TTTTTT.LLLL.ppp0)

Parameters:
spbinary -
Returns:
the string containing the binary edited spectral type

getSpMask

public long getSpMask()
Get the spectral type binary mask (used for sql queries)

Returns:
the bit mask

toString

public java.lang.String toString()
returns the spectral type string, without spaces between the fields

Overrides:
toString in class java.lang.Object
Returns:
the spectral type string

toString

public java.lang.String toString(boolean separFields)
returns the spectral type string. The fields are separated if the parameter is set to true

Parameters:
separFields - if true, the fields are separated by a space
Returns:
the spectral type string

equals

public boolean equals(java.lang.Object o)
Spectral type object comparison

Overrides:
equals in class java.lang.Object
Parameters:
o - Object to compare
Returns:
True if the two objects are equals, false otherwise

hashCode

public int hashCode()
Compute the hashcode

Overrides:
hashCode in class java.lang.Object
Returns:
the hascode value

getTempCodes

public static java.util.ArrayList getTempCodes()
Get the list of temperature codes (for displaying purpose)

Returns:
a sorted list of SpTypeCode objects

getLumCodes

public static java.util.ArrayList getLumCodes()
Get the list of luminosity codes (for displaying purpose)

Returns:
a sorted list of SpTypeCode objects

parse

public int parse(java.lang.String sp)
          throws java.text.ParseException
Parse a spectral type string

Parameters:
sp - spectral type string
Returns:
the first char not used in parsing
Throws:
java.text.ParseException

parse

public int parse(java.lang.String sp,
                 int offset)
          throws java.text.ParseException
Parse a spectral type string

Parameters:
sp - spectral type string
offset - first char to use in parsing
Returns:
the first char not used for the parsing
Throws:
java.text.ParseException

clone

public java.lang.Object clone()
Copy values parameters

Overrides:
clone in class java.lang.Object
Returns:
a copy of the object

decode

public java.lang.String decode()
Decode the current type from binary into the string.
This string MAY be different from the spectral type kept in a string

Returns:
the decoded string representing the content of the binary type.
DO NOT USE IT FOR DISPLAYING A SPECTRAL TYPE !!

decode

public static java.lang.String decode(long binsp)
Decode the given binary type into a string.
This string MAY be different from a spectral type kept in a string

Returns:
the decoded string representing the content of the binary type.
DO NOT USE IT FOR DISPLAYING A SPECTRAL TYPE !!

getNonParsableItems

public static java.lang.String getNonParsableItems(java.lang.String spstr)
Get the string of non parsable elements in a spectral type string

Parameters:
spstr - spectral type to analyze
Returns:
the substring of non parsable elements or null if all of them are parsable

compare

public static boolean compare(java.lang.String sp1,
                              java.lang.String sp2)
Compare two spectral type strings after some canonical normalisation

Parameters:
sp1 - first spectral type string
sp2 - second spectral type string
Returns:
true if the two types are identical, false otherwise