cds.astro
Class Otype

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

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

The Otype is a classification of the astronomical objects in a hierarchical structure.

See Also:
Serialized Form

Field Summary
static boolean DEBUG
           
protected static int[] Nlev
           
protected static java.util.ArrayList otrees
           
protected  int otype
           
protected static java.util.ArrayList otypes
           
static int UNKNOWN
           
 
Constructor Summary
Otype()
          Define the default Otype (object of unknown nature)
Otype(int otype)
          Define the Otype from an otype code (integer)
Otype(Otype ot)
          Copy constructor
Otype(java.lang.String text)
          Define the Otype from a String
 
Method Summary
 boolean agrees(Otype ot1)
          Check if the 2 Otypes are compatible
 java.lang.Object clone()
          Copy values parameters
 void dump()
          Dump contents to stdout
protected static void edit(java.lang.StringBuffer buf, int otype)
          Edit the otype as xx.xx.xx.xx
 boolean equals(java.lang.Object o)
          MOD-BB 21-01-04 Ajout de cette methode.
 java.lang.String get()
           
 int getBinType()
          Get the binary type
 java.util.ArrayList getCompatibleTypes()
          For the current type, get all compatible types in other branches
 java.lang.String[] getList()
          Gives all explanation string of otypes
 java.lang.String getName()
           
 int getQueryMask()
           
 int getQueryMask(int level)
           
 int getQueryValue()
           
 java.lang.String[] getShortList()
           
 int getValue(int level)
          Get the value of a particular level (0-3)
 int hashCode()
          Compute the hashcode (overrides the Object method).
 boolean hasValue()
          Check if this type has a value.
static java.lang.String hexaToNumeric(java.lang.String strHex)
          Methode qui transforme une chaine de caractere hexadecimale en otype sous forme numerique
 boolean implies(Otype t1)
          Check if is a subtype (in same branch)
static void init()
          Initialisation
static void init(java.lang.String filename)
          Initialisation
 boolean isUnknown()
          Check if the object type is unknown
protected static int level(int otype)
          Compute the level in the hierarchy
 java.util.Enumeration list()
          List in an enumeration all Otypes belonging to a class.
 Otype merge(Otype ot1)
          Choose the most accurate Otype: the deepest one ine the hierarchy.
 Otype mergepl(Otype ot2)
           
 java.lang.String numericToHexa()
          Methode qui permet de transformer un otype decimal en hexadecimal
 int parse(java.lang.String s)
          Parse a string containing otype sting name
 int parse(java.lang.String s, int offset)
          Parse a string containing otype sting name
 void reset()
          Reset this object type to its NODATA value.
protected  void set(int o)
          Convert an integer into an Otype
 void set(java.lang.String text)
          Convert a text into an object type
 java.lang.String toString()
          Default Edition of the Otype value
 java.lang.String toString(char cc)
          Edition with options
 java.lang.String toString(int choice)
          Default Edition of the Otype value
 java.lang.String toString(java.lang.String opt)
          Edition with options
 void truncate(int lev)
          Truncate the otype to some upper level (e.g.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

otype

protected int otype

UNKNOWN

public static final int UNKNOWN
See Also:
Constant Field Values

DEBUG

public static boolean DEBUG

Nlev

protected static final int[] Nlev

otypes

protected static java.util.ArrayList otypes

otrees

protected static java.util.ArrayList otrees
Constructor Detail

Otype

public Otype()
Define the default Otype (object of unknown nature)


Otype

public Otype(java.lang.String text)
      throws java.text.ParseException
Define the Otype from a String

Parameters:
text - the Otype as a string
Throws:
java.text.ParseException - when otype is not understandable

Otype

public Otype(int otype)
      throws java.text.ParseException
Define the Otype from an otype code (integer)

Parameters:
otype - the Otype as a coded integer
Throws:
java.text.ParseException - when otype is not understandable

Otype

public Otype(Otype ot)
Copy constructor

Parameters:
ot - Otype object to copy
Method Detail

hasValue

public boolean hasValue()
Check if this type has a value. An unknown type is different from nodata.

Returns:
true if it has a value, false otherwise.

reset

public void reset()
Reset this object type to its NODATA value. The NODATA value is different from the type 'unknown'.


getBinType

public final int getBinType()
Get the binary type

Returns:
the integer value

init

public static void init()
Initialisation


init

public static void init(java.lang.String filename)
                 throws java.lang.Exception
Initialisation

Parameters:
filename - name of file with the list of Object Types
Throws:
java.lang.Exception - e.g. IOException if file not existing, parsing...

level

protected static final int level(int otype)
Compute the level in the hierarchy

Parameters:
otype - an object type
Returns:
the level (0 1 2 3 4)

edit

protected static void edit(java.lang.StringBuffer buf,
                           int otype)
Edit the otype as xx.xx.xx.xx

Parameters:
buf - the buffer to which the ascii equivalent of otype is appended.
otype - the object type

getValue

public int getValue(int level)
Get the value of a particular level (0-3)

Parameters:
level - from 0 (main level) to 3 (today lowest one)
Returns:
the level value

truncate

public final void truncate(int lev)
Truncate the otype to some upper level (e.g. Algol --> V*)

Parameters:
lev - the level (between 1 and 4)

implies

public final boolean implies(Otype t1)
Check if is a subtype (in same branch)

Parameters:
t1 - the other Otype
Returns:
true t1 is an upper class

agrees

public final boolean agrees(Otype ot1)
Check if the 2 Otypes are compatible

Parameters:
ot1 - the other Otype
Returns:
true t1 is compatible

getCompatibleTypes

public java.util.ArrayList getCompatibleTypes()
For the current type, get all compatible types in other branches

Returns:
an array list of all compatible types. The first item is the current type

merge

public final Otype merge(Otype ot1)
Choose the most accurate Otype: the deepest one ine the hierarchy.

Parameters:
ot1 - a second otype
Returns:
the 'most accurate' otype

mergepl

public final Otype mergepl(Otype ot2)
                    throws java.text.ParseException
Throws:
java.text.ParseException

set

protected final void set(int o)
                  throws java.text.ParseException
Convert an integer into an Otype

Parameters:
o - a number representing an otype
Throws:
java.text.ParseException - when the text can' be interpreted.

set

public final void set(java.lang.String text)
               throws java.text.ParseException
Convert a text into an object type

Parameters:
text - the text representing the otype, either in numeric, or as one of the available abbreviations
Throws:
java.text.ParseException - when the text can' be interpreted.

list

public java.util.Enumeration list()
List in an enumeration all Otypes belonging to a class.

Returns:
An enumeration of Otypes in subtree

toString

public final java.lang.String toString(int choice)
Default Edition of the Otype value

Parameters:
choice - 0=numeric, 1=standard, 2=verbose, 3=3-letter
Returns:
the meaning of the Object Type

toString

public final java.lang.String toString()
Default Edition of the Otype value

Overrides:
toString in class java.lang.Object
Returns:
the "standard" explanation of hte object type

toString

public java.lang.String toString(java.lang.String opt)
Edition with options

Parameters:
opt - Option string. It can contain:
'N'=numeric, 'S'=standard, 'V'=verbose, '3'=3-letter and any other embedded character
Returns:
the edited object type

toString

public java.lang.String toString(char cc)
Edition with options

Parameters:
cc - Option char. It can be:
N=numeric, S=standard, V=verbose, 3=3-letter
Returns:
the edited object

dump

public final void dump()
Dump contents to stdout


numericToHexa

public java.lang.String numericToHexa()
Methode qui permet de transformer un otype decimal en hexadecimal

Returns:
chaine representant la valeur de otype en hexadecimal

hexaToNumeric

public static java.lang.String hexaToNumeric(java.lang.String strHex)
Methode qui transforme une chaine de caractere hexadecimale en otype sous forme numerique

Parameters:
strHex - chaine representant un otype sous forme hexadecimale
Returns:
otype sous forme numerique

equals

public boolean equals(java.lang.Object o)
MOD-BB 21-01-04 Ajout de cette methode. Test d'egalite de Otype.

Overrides:
equals in class java.lang.Object
Parameters:
o - Objet a comparer.
Returns:
Vrai si o est identique a this, faux sinon.

isUnknown

public boolean isUnknown()
Check if the object type is unknown

Returns:
true if it is unknown, false otherwise

clone

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

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

getList

public java.lang.String[] getList()
Gives all explanation string of otypes

Returns:
array of first level strings
See Also:
list()

getShortList

public java.lang.String[] getShortList()
See Also:
cds.util.ValueList#getShortList()

parse

public int parse(java.lang.String s)
          throws java.text.ParseException
Parse a string containing otype sting name

Parameters:
s - string to parse
Returns:
index of first char not used in the string
Throws:
java.text.ParseException
See Also:
set(java.lang.String)

parse

public int parse(java.lang.String s,
                 int offset)
          throws java.text.ParseException
Parse a string containing otype sting name

Parameters:
s - string to parse
offset - first char to parse in the string
Returns:
index of first char not used in the string
Throws:
java.text.ParseException
See Also:
set(java.lang.String)

getName

public java.lang.String getName()
Returns:
String object type

get

public java.lang.String get()
Returns:
String object type

getQueryMask

public int getQueryMask()

getQueryMask

public int getQueryMask(int level)

getQueryValue

public int getQueryValue()

hashCode

public int hashCode()
Compute the hashcode (overrides the Object method). The hashcode is the integer object type code

Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode value for the otype