cds.simbad
Class Astrobject

java.lang.Object
  extended bycds.simbad.Astrobject
All Implemented Interfaces:
java.io.Serializable, SimbadObject

public class Astrobject
extends java.lang.Object
implements java.io.Serializable, SimbadObject

Manages an astronomical object.

Version:
1.0 Mar 2002 (MW)
1.1 Oct 2002 (SJ) : liste de bibcodes et d'indentificateurs
toString()
old_oid / oid
attributs prives
methodes get et set
1.2 Nov 2002 (SJ) : Ajout methode insertb(SimbadDb) + methode toXML
1.3 Apr 2003 (MW) : Corriger identifier.pos qui etait tjrs = 2
1.4 May 2003 (MW) : OTYPE => char(11)
objects Oid, Coobox
1.5 Jun 2003 (MW) : replace individual data
2.0 Sep 2003 (MW) : main reorganisation: setters and getters for each data type 2.1 Jan 2004 (BB) : Ajout de la methode equals.
Author:
Marc Wenger, Sylvaine Jaehn (Stage UTBM)
See Also:
Serialized Form

Field Summary
private static java.util.ArrayList attrList
           
private static MagnitudeFilter BFilter
           
private  BibcodeList bibcodelist
           
static int BIBCODELIST
           
static int CLASS
           
static int COOBOX
           
private  Coobox cooboxnum
           
private  CooFrame cooframe
           
private  Coordinates coord
           
static int COORD
           
static short GALAXY
           
private  GalaxyDimension galdim
           
static int GALDIM
           
private  IdList idlist
           
static int IDLIST
           
private  Magnitude magB
           
private  MagnitudeList maglist
           
static int MAGLIST
           
static int MAGPEC
           
private  Magnitude magV
           
private  SortedHashtable measurementlist
           
static int MORPHTYPE
           
private  MagnitudePecul mpecul
           
private  MorphologicalType mtype
           
 int nbHasBibRef
           
 int nbIdent
           
 int nbMagn
           
 int nbRef_bib
           
private  short objclass
           
private  Oid oid
           
static int OID3
           
static int OID4
           
(package private) static java.util.HashMap oidbibCache
           
private  Oid3 oldOid
           
private  Otype otype
           
static int OTYPE
           
private static Parameters pdata
           
private  Parallax plx
           
static int PLX
           
private  ProperMotion pm
           
static int PM
           
private static Parameters pseq
           
private static Parameters ptable
           
private  RadialVelocity rv
           
static int RV
           
static int RVZ
           
private static java.lang.String seqName
           
private  java.lang.String sesameId
           
private  SpectralType sptype
           
static int SPTYPE
           
static short STAR
           
private  java.lang.StringBuffer strcoord
           
static short UNKNOWN
           
private static MagnitudeFilter VFilter
           
static int Z
           
 
Constructor Summary
Astrobject()
          Creates an astronomical object
 
Method Summary
 Astrobject add(Bibcode bib)
          Adds a bibcode to the object
 Astrobject add(Identifier id)
          Adds an identifier to the object
 Astrobject add(Magnitude mag)
          Adds a magnitude to the list
 Astrobject add(MagnitudePecul magpec)
          Adds magnitude peculiarities to this object
private static void createOidbibCache(SimbadJDBC sjdbc)
           
 boolean equals(java.lang.Object o)
          MOD-BB 22-01-04 Ajout de cette methode
 boolean fromParfile(java.io.BufferedReader rdr)
          Read an astronomical object data from a Parfile.
 java.lang.Object get(int datatype)
          Get a particular data from the astronomical object.
 Coordinates getCoordinates()
           
 IdList getIdList()
          MOD-BB 18-12-03 Ajout des methodes ci-dessous.
 java.util.Iterator getIterator(int datatype)
          Returns an iterator for multiple data.
 Magnitude getMagB()
           
 Magnitude getMagV()
           
 int getNbBibRef()
           
 SpectralType getSpectralType()
           
 int insertdb(SimbadJDBC sjdbc)
          Inserts an astronomical object in the database
 void reset()
          Resets an astronomical object.
private  boolean sameIdent(java.lang.String id1, java.lang.String id2)
          Decides if two identifiers are the same (comparison without the spaces)
 Astrobject set(CooFrame cofr)
          Sets the Coordinates Frame object
 Astrobject set(Coordinates coo)
          Sets coordinates in an astronomical object
 Astrobject set(GalaxyDimension gdim)
          Sets the galaxy dimension
 Astrobject set(MorphologicalType mt)
          Sets the morphological type
 Astrobject set(Oid oid)
          Sets Oid object in an astronomical object
 Astrobject set(Oid3 oid)
          Sets a Simbad3 oid object in an astronomical object.
 Astrobject set(Otype objtype)
          Sets Object type
 Astrobject set(Parallax plx)
          Sets parallax object in an astronomical object
 Astrobject set(ProperMotion pm)
          Sets proper motions object in an astronomical object
 Astrobject set(RadialVelocity rv)
          Sets radial velocity/redshift object in an astronomical object
 Astrobject set(SpectralType sp)
          Sets the spectral type
 Astrobject set(java.lang.String datatype, java.lang.Object data)
          Puts a data value in an astronomical object.
static AstrobjectList toAstrobject(java.io.InputStream in)
          MOD-BB 01/12/03 Cette methode static permet de creer une liste (AstrobjectList) d'objets astronomiques a partir d'un flux d'entree contenant la representation XML (VOTable) d'objets astronomiques.
 java.lang.String toString()
          Astronomical object display function (mainly useful for debugging.
 void toXML(VOTable vot)
          XML output for the astronomical object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OID4

public static final int OID4
See Also:
Constant Field Values

OID3

public static final int OID3
See Also:
Constant Field Values

COOBOX

public static final int COOBOX
See Also:
Constant Field Values

OTYPE

public static final int OTYPE
See Also:
Constant Field Values

COORD

public static final int COORD
See Also:
Constant Field Values

PM

public static final int PM
See Also:
Constant Field Values

RV

public static final int RV
See Also:
Constant Field Values

Z

public static final int Z
See Also:
Constant Field Values

RVZ

public static final int RVZ
See Also:
Constant Field Values

PLX

public static final int PLX
See Also:
Constant Field Values

MAGLIST

public static final int MAGLIST
See Also:
Constant Field Values

MAGPEC

public static final int MAGPEC
See Also:
Constant Field Values

SPTYPE

public static final int SPTYPE
See Also:
Constant Field Values

MORPHTYPE

public static final int MORPHTYPE
See Also:
Constant Field Values

GALDIM

public static final int GALDIM
See Also:
Constant Field Values

IDLIST

public static final int IDLIST
See Also:
Constant Field Values

BIBCODELIST

public static final int BIBCODELIST
See Also:
Constant Field Values

CLASS

public static final int CLASS
See Also:
Constant Field Values

UNKNOWN

public static final short UNKNOWN
See Also:
Constant Field Values

STAR

public static final short STAR
See Also:
Constant Field Values

GALAXY

public static final short GALAXY
See Also:
Constant Field Values

oid

private Oid oid

oldOid

private Oid3 oldOid

cooboxnum

private Coobox cooboxnum

cooframe

private CooFrame cooframe

otype

private Otype otype

objclass

private short objclass

sesameId

private java.lang.String sesameId

strcoord

private java.lang.StringBuffer strcoord

coord

private Coordinates coord

pm

private ProperMotion pm

rv

private RadialVelocity rv

plx

private Parallax plx

maglist

private MagnitudeList maglist

BFilter

private static final MagnitudeFilter BFilter

VFilter

private static final MagnitudeFilter VFilter

magB

private Magnitude magB

magV

private Magnitude magV

mpecul

private MagnitudePecul mpecul

sptype

private SpectralType sptype

mtype

private MorphologicalType mtype

galdim

private GalaxyDimension galdim

idlist

private IdList idlist

bibcodelist

private BibcodeList bibcodelist

measurementlist

private SortedHashtable measurementlist

ptable

private static Parameters ptable

pdata

private static Parameters pdata

pseq

private static Parameters pseq

attrList

private static java.util.ArrayList attrList

seqName

private static java.lang.String seqName

nbIdent

public int nbIdent

nbMagn

public int nbMagn

nbHasBibRef

public int nbHasBibRef

nbRef_bib

public int nbRef_bib

oidbibCache

static java.util.HashMap oidbibCache
Constructor Detail

Astrobject

public Astrobject()
Creates an astronomical object

Method Detail

createOidbibCache

private static void createOidbibCache(SimbadJDBC sjdbc)

reset

public void reset()
Resets an astronomical object. Using reset() when browsing through a list of objects may be faster than recreating a new one every time.


set

public Astrobject set(Oid oid)
Sets Oid object in an astronomical object

Parameters:
oid - Oid object
Returns:
the astronomical object, allowing 'concatenation' of set() calls

set

public Astrobject set(Oid3 oid)
Sets a Simbad3 oid object in an astronomical object.

Parameters:
oid - Oid3 object
Returns:
the astronomical object, allowing 'concatenation' of set() calls

set

public Astrobject set(CooFrame cofr)
Sets the Coordinates Frame object

Parameters:
cofr - coordinates frame definition
Returns:
the astronomical object, allowing 'concatenation' of set() calls

set

public Astrobject set(Otype objtype)
Sets Object type

Parameters:
objtype - Object type
Returns:
the astronomical object, allowing 'concatenation' of set() calls

set

public Astrobject set(Coordinates coo)
Sets coordinates in an astronomical object

Parameters:
coo - Coordinates object
Returns:
the astronomical object, allowing 'concatenation' of set() calls

set

public Astrobject set(ProperMotion pm)
Sets proper motions object in an astronomical object

Parameters:
pm - proper motions object
Returns:
the astronomical object, allowing 'concatenation' of set() calls

set

public Astrobject set(RadialVelocity rv)
Sets radial velocity/redshift object in an astronomical object

Parameters:
rv - radial velocity/redshift object
Returns:
the astronomical object, allowing 'concatenation' of set() calls

set

public Astrobject set(Parallax plx)
Sets parallax object in an astronomical object

Parameters:
plx - parallax object
Returns:
the astronomical object, allowing 'concatenation' of set() calls

add

public Astrobject add(Magnitude mag)
Adds a magnitude to the list

Parameters:
mag - Magnitude to add to this object
Returns:
the astronomical object, allowing 'concatenation' of set() calls

add

public Astrobject add(MagnitudePecul magpec)
Adds magnitude peculiarities to this object

Parameters:
magpec - Magnitude peculiarities associated with this object
Returns:
the astronomical object, allowing 'concatenation' of set() calls

set

public Astrobject set(SpectralType sp)
Sets the spectral type

Parameters:
sp - spectral type
Returns:
the astronomical object, allowing 'concatenation' of set() calls

set

public Astrobject set(MorphologicalType mt)
Sets the morphological type

Parameters:
mt - morphological type
Returns:
the astronomical object, allowing 'concatenation' of set() calls

set

public Astrobject set(GalaxyDimension gdim)
Sets the galaxy dimension

Parameters:
gdim - galaxy dimension
Returns:
the astronomical object, allowing 'concatenation' of set() calls

add

public Astrobject add(Identifier id)
Adds an identifier to the object

Parameters:
id - identifier
Returns:
the astronomical object, allowing 'concatenation' of set() calls

add

public Astrobject add(Bibcode bib)
Adds a bibcode to the object

Parameters:
bib - bibcode
Returns:
the astronomical object, allowing 'concatenation' of set() calls

set

public Astrobject set(java.lang.String datatype,
                      java.lang.Object data)
Puts a data value in an astronomical object. Data must be either a String or an ArrayList of Strings. The following table contains (when finished !) a description of all data that can be added to an astronomical object: datatype nameArrayexample
OID4-13224
OID3-1234,12
COOBOX-12345

Parameters:
datatype - Type of the data
data - Data to add to the astronomical object (the actual type depends on the data
Returns:
the astronomical object, allowing 'concatenation' of set() calls
Throws:
BibcodeException - Bibcode parsing error
java.text.ParseException - Various parse exception

get

public java.lang.Object get(int datatype)
Get a particular data from the astronomical object. The datatype is the same as for the set() method. The object returned depends on the data type:

datatype
name
returned
object class
.get() returnslongint
OID4Oid
OID3Oid3
COOBOXCoobox

Parameters:
datatype - Datatype code of the data to get
Returns:
The data object. This type must be known from the caller to be able to cast it properly.

getIterator

public java.util.Iterator getIterator(int datatype)
Returns an iterator for multiple data. This concerns :

Parameters:
datatype - must be IDLIST for identifiers, BIBCODELIST for bibcodes or ? for measurements
Returns:
an iterator for the given datatype TODO: iterator pour les mesures

toString

public java.lang.String toString()
Astronomical object display function (mainly useful for debugging.

Specified by:
toString in interface SimbadObject
Returns:
a string containing the astronomical object data

insertdb

public int insertdb(SimbadJDBC sjdbc)
Inserts an astronomical object in the database

Parameters:
sjdbc - SimbadDb object
Returns:
status (TBS : -1 is error, 1 if ok ?)

toXML

public void toXML(VOTable vot)
XML output for the astronomical object. The XML output is managed by the VOTable object. This astronomical object will be added in the VOTable output as a new RESOURCE. Any number of astronomical objects can be appended to a VOTable object.

Specified by:
toXML in interface SimbadObject
Parameters:
vot - VOTable object driving the output.

fromParfile

public boolean fromParfile(java.io.BufferedReader rdr)
Read an astronomical object data from a Parfile. The method reads the parfile until the first line following an empty line, and stops at the next empty line.
Successive calls to this method will read consecutive objects in the parfile

Parameters:
rdr - input file.
Returns:
true if a parfile record was read into the astronomical object

toAstrobject

public static AstrobjectList toAstrobject(java.io.InputStream in)
MOD-BB 01/12/03 Cette methode static permet de creer une liste (AstrobjectList) d'objets astronomiques a partir d'un flux d'entree contenant la representation XML (VOTable) d'objets astronomiques.

Parameters:
in - Flux d'entree contenant la representation XML (VOTable) d'objets astronomiques.
Returns:
Une liste d'objets astronomiques.

sameIdent

private boolean sameIdent(java.lang.String id1,
                          java.lang.String id2)
Decides if two identifiers are the same (comparison without the spaces)

Parameters:
id1 - first identifier
id2 - second identifier
Returns:
true if the identifier are the same, false otherwise

getIdList

public IdList getIdList()
MOD-BB 18-12-03 Ajout des methodes ci-dessous.


getCoordinates

public Coordinates getCoordinates()

getMagV

public Magnitude getMagV()

getMagB

public Magnitude getMagB()

getSpectralType

public SpectralType getSpectralType()

getNbBibRef

public int getNbBibRef()

equals

public boolean equals(java.lang.Object o)
MOD-BB 22-01-04 Ajout de cette methode

Parameters:
o - Objet a comparer.
Returns:
Vrai si o est identique a this, faux sinon.