cds.simbad
Class Bibcode

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

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

CETTE CLASSE Bibcode EST A L'ORIGINE UNE COPIE DE LA CLASSE BIBCODE. LES MODIFICATIONS APPORTEES SONT IDENTIFIABLES PAR "MOD-BB" Bibcode management

Stores a bibcode as a String and has several control and normalisation functions

A full bibcode has the following syntax

 YYYYJJJJJNNNNMPPPPA
 

Version:
1.0 Apr 2002 (MW)
1.1 Oct 2002 (SJ) fct normalize() : add space suppression
Add getBibcode(), getYear()
, 1.2 Mar 2003 (MW) Hardcode BIBCODE_SIZE=19. Is only useful here and is connected with code development.
, 2.0 Apr 2003 (MW) complete rewrite of the analysis/normalization method. largely inspired from codref.c (SL/simbad3), 2.1 Oct 2003 (BB) modification in the contructors in order to be correct for the Axis BeanSerializer. Mask some methods., 2.2 Nov 2003 (BB) Modifications in the methods getVolume et getYear by using regular expression., 2.3 Jan 2004 (BB) Ajout de la methode equals.
Author:
Soizick Lesteven/CDS (who wrote the initial routine codref.c), Marc Wenger/CDS, Sylvaine Jaehn (Stage UTBM), Benoît Baranne (Stage UTBM)
See Also:
Serialized Form

Field Summary
private static int BIB_FIRST_YEAR
           
private  java.lang.String bibcode
           
private static int BIBCODE_SIZE
           
private static char FILL_CHAR
           
private  Journal jnl
           
private static int JNLABBREV_SIZE
           
private static JournalList jnlist
           
private static int MAX_VOLUME_SIZE
           
private static java.lang.String NO_BIBCODE
           
private static char NO_BIBCODE_CHAR
           
private static int PAGENUMBER_SIZE
           
static java.util.regex.Pattern pattern_bibcode
           
static java.lang.String regex_bibcode
           
private static int VOLUME_SIZE
           
private static int YEAR_SIZE
           
 
Constructor Summary
Bibcode()
          Empty constructor
Bibcode(Bibcode bibcode)
          copy constructor
Bibcode(java.lang.String bibcode)
          Constructor.
Bibcode(java.lang.String bibcode, boolean normalize)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object o)
          MOD-BB 21-01-04 Ajout de cette methode.
 java.lang.String getBibcode()
          Returns the bibcode string
private  void getJournalList()
          Get the journal list or write an error message
 java.lang.String getVolume()
          Returns the volume number
 java.lang.String getYear()
          Returns the publication year
private  boolean hasNoValue()
          Checks if the current bibcode has an actual value (or is ~)
static boolean isBibcode(java.lang.String str)
          Checks whether a string may be a bibcode
 Bibcode normalize()
          Normalizes the current object
private  java.lang.String normalize(java.lang.String bibcode)
          Normalisation method. returns a 19 char bibcode.
 void set(Bibcode bc)
          Sets a bibcode from another one
 void setBibcode(java.lang.String bibcode)
          Positionnement de l'attribut bibcode.
 java.lang.String toString()
          Returns the bibcode string
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BIB_FIRST_YEAR

private static final int BIB_FIRST_YEAR
See Also:
Constant Field Values

BIBCODE_SIZE

private static final int BIBCODE_SIZE
See Also:
Constant Field Values

YEAR_SIZE

private static final int YEAR_SIZE
See Also:
Constant Field Values

JNLABBREV_SIZE

private static final int JNLABBREV_SIZE
See Also:
Constant Field Values

MAX_VOLUME_SIZE

private static final int MAX_VOLUME_SIZE
See Also:
Constant Field Values

VOLUME_SIZE

private static final int VOLUME_SIZE
See Also:
Constant Field Values

PAGENUMBER_SIZE

private static final int PAGENUMBER_SIZE
See Also:
Constant Field Values

FILL_CHAR

private static final char FILL_CHAR
See Also:
Constant Field Values

NO_BIBCODE

private static final java.lang.String NO_BIBCODE
See Also:
Constant Field Values

NO_BIBCODE_CHAR

private static final char NO_BIBCODE_CHAR

bibcode

private java.lang.String bibcode

jnl

private Journal jnl

jnlist

private static JournalList jnlist

regex_bibcode

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

pattern_bibcode

public static final java.util.regex.Pattern pattern_bibcode
Constructor Detail

Bibcode

public Bibcode()
Empty constructor


Bibcode

public Bibcode(java.lang.String bibcode)
        throws BibcodeException
Constructor. Normalizes first the bibcode before storing it.

Parameters:
bibcode - a bibcode string. It may be not normalized.
Throws:
BibcodeException

Bibcode

public Bibcode(java.lang.String bibcode,
               boolean normalize)
        throws BibcodeException
Constructor. Normalization is done depending on the boolean parameter. Storing a bibcode not normalized may have unreliable behaviors.

Parameters:
bibcode - the bibcode string
normalize - true if the bibcode has to be normalized
Throws:
BibcodeException

Bibcode

public Bibcode(Bibcode bibcode)
copy constructor

Parameters:
bibcode - the bibcode string
Method Detail

set

public void set(Bibcode bc)
Sets a bibcode from another one

Parameters:
bc - Bibcode object to copy

getJournalList

private void getJournalList()
Get the journal list or write an error message


hasNoValue

private final boolean hasNoValue()
Checks if the current bibcode has an actual value (or is ~)

Returns:
true if the bibcode has no value

normalize

private java.lang.String normalize(java.lang.String bibcode)
                            throws BibcodeException
Normalisation method. returns a 19 char bibcode.

The entered bibcode can be written in many simplified ways. The normalization routine can recognize automatically following situations:

Parameters:
bibcode - bibcode to normalize
Returns:
the normalized bibcode string
Throws:
BibcodeException

normalize

public Bibcode normalize()
                  throws BibcodeException
Normalizes the current object

Returns:
the current Bibcode object
Throws:
BibcodeException

isBibcode

public static boolean isBibcode(java.lang.String str)
Checks whether a string may be a bibcode

Parameters:
str - a possible bibcode string
Returns:
true if the string has a bibcode syntax

getBibcode

public java.lang.String getBibcode()
Returns the bibcode string

Returns:
a string containing the 19 chars bibcode

setBibcode

public void setBibcode(java.lang.String bibcode)
Positionnement de l'attribut bibcode. Le bibcode doit etre normalise

Parameters:
bibcode - chaine de caractere representant un bibcode normalise

getYear

public java.lang.String getYear()
Returns the publication year

Returns:
publication year

getVolume

public java.lang.String getVolume()
Returns the volume number

Returns:
Volume number

toString

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

Returns:
the bibcode string

equals

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

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