cds.simbad
Class Identifier

java.lang.Object
  extended bycds.simbad.Identifier
All Implemented Interfaces:
java.io.Serializable

public class Identifier
extends java.lang.Object
implements java.io.Serializable

Manages an identifier

Version:
1.0 Apr 2002 (MW)
, 1.1 Sep 2002 (SJ) : Fct de normalisation + getIdent + setIdent
Constructeur sans parametre
Constructeur par copie
, 1.2 Nov 2002 (SJ) : Ajout des attributs oid, cat et pos
, 1.3 Dec 2002 (SJ) : Modif de la fct d'extraction du nom de catalogue, 2.0 May 2003 (OD) : Final normalisation function, 2.5 Jun 2003 (MW) : Revisited, 2.6 Jan 2004 (BB) : Ajout de la methode equals.
Author:
Marc Wenger/CDS, Sylvaine Jaehn (stage UTBM), Olivier Dellicour (stage INPRESS)
See Also:
Serialized Form

Field Summary
private  Catalog cat
           
private static CatalogTable catTable
           
private  IdentDebugData debugData
           
private  int fcat
           
private  java.lang.String forcedCatName
           
private  boolean hasUnderscores
           
private  java.lang.String identifier
           
private  int pos
           
private  java.util.Vector vecElementBin
           
 
Constructor Summary
Identifier()
          Empty constructor
Identifier(java.lang.String id)
          Constructor.
Identifier(java.lang.String id, boolean isNormalized)
          Constructor.
Identifier(java.lang.String id, boolean isNormalized, IdentDebugData debugData)
           
 
Method Summary
 boolean equals(java.lang.Object o)
          MOD-BB 21-01-04 Ajout de cette methode.
 byte[] getBin()
          Retourne l'identificateur sous forme binaire
 Catalog getCat()
          Get the catalogue object
 java.lang.String getCatname()
          Get the catalogue name
 java.lang.String getIdent()
          Gets the identifier
 int getPos()
          Gets the position of the identifier
private  java.lang.String normalize(Catalog cat, java.lang.String idfields)
          Identifier normalization method
static java.lang.String ReplaceCatName(java.lang.String id, java.lang.String old_cat, java.lang.String new_cat)
          Methode static!
static void setCatalogTable()
          Loads the catalogue description table
 void setIdent(java.lang.String ident, boolean isNormalized)
          Sets a new identifier for this object
 void setPos(int pos)
          Sets the position of the identifier in the identifier list of a given astronomical object
 java.lang.String toString()
          Returns the identifier string
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

catTable

private static CatalogTable catTable

identifier

private java.lang.String identifier

fcat

private int fcat

pos

private int pos

cat

private Catalog cat

forcedCatName

private java.lang.String forcedCatName

vecElementBin

private java.util.Vector vecElementBin

debugData

private IdentDebugData debugData

hasUnderscores

private boolean hasUnderscores
Constructor Detail

Identifier

public Identifier()
Empty constructor


Identifier

public Identifier(java.lang.String id)
           throws IdentifierException
Constructor. It is designed to accept ONLY an already normalized identifier.

Parameters:
id - normalized identifier to set to this object.
Throws:
IdentifierException

Identifier

public Identifier(java.lang.String id,
                  boolean isNormalized)
           throws IdentifierException
Constructor. It may receive any kind of identifier. Normalization will occur if the flag is set to false.

Parameters:
id - identifier to set to this object. It can be not normalized, but must be 'trimmed'.
isNormalized - true if the identifier is already normalized, false if the normalization process should occur
Throws:
IdentifierException

Identifier

public Identifier(java.lang.String id,
                  boolean isNormalized,
                  IdentDebugData debugData)
           throws IdentifierException
Method Detail

setCatalogTable

public static void setCatalogTable()
Loads the catalogue description table


getCat

public Catalog getCat()
Get the catalogue object

Returns:
the catalog object for the identifier

setIdent

public void setIdent(java.lang.String ident,
                     boolean isNormalized)
              throws IdentifierException
Sets a new identifier for this object

Parameters:
ident - an identifier string. it should have been 'trim()ed'. It should also be already normalized if isNormalized is true
isNormalized - if false, the identifier will be normalized by this method
Throws:
IdentifierException

normalize

private java.lang.String normalize(Catalog cat,
                                   java.lang.String idfields)
Identifier normalization method

Parameters:
cat - Catalog object of the identifier to normalize
idfields - string containing the fields
Returns:
the normalized identifier

getBin

public byte[] getBin()
Retourne l'identificateur sous forme binaire

Returns:
the byte array containing the binary counterpart of the identifier

getCatname

public java.lang.String getCatname()
Get the catalogue name

Returns:
the catalogue name as a string

getIdent

public java.lang.String getIdent()
Gets the identifier

Returns:
always the normalized identifier

getPos

public int getPos()
Gets the position of the identifier

Returns:
identifier position in the identifier list

toString

public java.lang.String toString()
Returns the identifier string

Returns:
the identifier

ReplaceCatName

public static java.lang.String ReplaceCatName(java.lang.String id,
                                              java.lang.String old_cat,
                                              java.lang.String new_cat)
Methode static! Remplace, dans l'identificateur fourni, l'ancien nom de catalogue par le nouveau

Parameters:
id - identifier
old_cat - current calaog name
new_cat - new catalog name
Returns:
identifier with the catalog name substituted

setPos

public void setPos(int pos)
Sets the position of the identifier in the identifier list of a given astronomical object

Parameters:
pos - position de l'identificateur

equals

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

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