cds.simbad.ident
Class Instruction

java.lang.Object
  extended bycds.simbad.ident.Instruction
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CatE, ChE, ConstE, DecimalE, DeE, IndE, IntE, LetE, LgqE, MajE, MinE, PgmE, RaE, RomE, SpaceE, TabE, TextE, UintE, VarE, ZoneE

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

Super class de tout les types pouvant composer un identificateur d'un catalogue Elle contient aussi quelques variables constantes

See Also:
Serialized Form

Field Summary
static char ALIG_LEFT
           
static char ALIG_RIGHT
           
protected  char alignment
           
static int BINARY
           
protected  int binPos
           
static java.lang.String BLANC_RE
           
static int CARMAX
           
static int CAT
           
protected  java.lang.String catName
           
static int CH
           
static int CONST
           
static int DE
           
static int DECIMAL
           
static int DECIMALES
           
static boolean DEFAULT_BINARY
           
static int DEFAULT_DECIMAL
           
static char DEFAULT_DELIMITOR
           
static char DEFAULT_FILLER
           
static int DEFAULT_MIN
           
static boolean DEFAULT_OPTIONAL
           
static int DELIMITOR
           
static int FACULTATIF
           
protected  char filler
           
static int FORMAT
           
static int IND
           
private  int instrCode
           
protected static java.lang.String[] instrNames
           
static int INT
           
protected  boolean isBinary
           
static int JUSTIFICATION
           
static int LET
           
static int LGQ
           
static int LIST
           
static int LONGUEUR
           
static int MAJ
           
static char MAX_DEFAULT_CARMAX
           
static int MAXIMUM
           
static int MIN
           
static char MIN_DEFAULT_CARMAX
           
static int MINIMUM
           
static char NO_ALIGNMENT
           
static int NO_BIN_POS
           
static char NO_FILLER
           
static int NOM
           
protected  boolean optional
           
static int PARAM_FINISHED
           
protected static java.lang.String[] paramNames
           
static int PGM
           
static int PLUS
           
static int POSITION
           
static int RA
           
protected  boolean regexGen
           
static int ROM
           
static int SPACE
           
static java.lang.String SPACES_RE
           
static int STRICT
           
static int TAB
           
static int TEXT
           
static int TEXTE
           
static int UINT
           
(package private)  PairInteger valuelim
           
static int VAR
           
static int VAR_LENGTH
           
protected static java.util.Vector vec_format_car
           
static int ZONE
           
 
Constructor Summary
Instruction(int instrCode)
          Constructor receiving only the instruction type
 
Method Summary
protected  void align(java.lang.StringBuffer buf, int pos0, int nb_pos)
           
protected  void appendBinary(java.lang.StringBuffer str)
          Append alignement parameter
protected  void appendCarmax(java.lang.StringBuffer str, char carmax)
          Append carmax parameter
protected  void appendCarmax(java.lang.StringBuffer str, java.lang.String carmax)
          Append carmax parameter
protected  void appendClose(java.lang.StringBuffer str)
          Close the stringBuffer containing the instruction parameters
protected  void appendDecimal(java.lang.StringBuffer str, int nbdec)
          Append number of decimals
protected  void appendDelimitor(java.lang.StringBuffer str, char delim)
          Append list parameter
protected  void appendFormat(java.lang.StringBuffer str, java.lang.String fmt)
          Append format parameter
protected  void appendJustification(java.lang.StringBuffer str)
          Append alignement parameter
protected  void appendLength(java.lang.StringBuffer str, int lg)
          Append length parameter
protected  void appendList(java.lang.StringBuffer str, java.lang.String list)
          Append list parameter
protected  void appendMaximum(java.lang.StringBuffer str, long maximum)
          Append maximum parameter
protected  void appendMinimum(java.lang.StringBuffer str, int minimum)
          Append minimum parameter
protected  void appendMinimum(java.lang.StringBuffer str, long minimum)
          Append minimum parameter
protected  void appendName(java.lang.StringBuffer str)
          Append instruction name and opening parenthesis
protected  void appendNom(java.lang.StringBuffer str)
          Append 'name' parameter
protected  void appendOptional(java.lang.StringBuffer str)
          Append optional parameter
protected  void appendPlus(java.lang.StringBuffer str, boolean plus)
          Append plus sign
protected  void appendPosition(java.lang.StringBuffer str, int num)
          Append position parameter
protected  void appendStrict(java.lang.StringBuffer str, boolean strict)
          Append strict flag
protected  void appendText(java.lang.StringBuffer str, java.lang.String text)
          Append list parameter
protected  void displayError(java.lang.String type, java.lang.String msg)
           
 boolean equals(java.lang.Object o)
          MOD-BB 21-01-04 Ajout de cette methode.
 java.util.Vector extractParams(java.lang.String line)
           
protected  double format2dbl(java.lang.String format, java.lang.String data)
          Converts a format ('HHMMSS.dd...') into the regular expression needed to recognize it
protected  java.lang.String format2RE(java.lang.String format)
          Converts a format ('HHMMSS.dd...') into the regular expression needed to recognize it
 int getBinaryPosition()
          Get the bianry position
 java.lang.String getCatName()
          Returns a new catalogue name defined by the instruction of null
 int getInstrCode()
          Returns the instruction code
 java.lang.String getInstrName()
          Returns the instruction name
protected  int getInteger(java.lang.String params, PairInteger datalim)
          Gets an integer in a parameter string
protected  long getLong(java.lang.String params, PairInteger datalim)
           
 int getNextParam(java.lang.String line, int offset, PairInteger pi)
          In an instruction parameter list, returns the next parameter
 boolean getRegexGen()
          returns whether the instruction has generated or not a regex group
 boolean isBinary()
           
 boolean isOptional()
           
 boolean isREKeyword(char c)
          Checks whether the char is a special char for reg. expr. syntax
 boolean isREKeyword(java.lang.String c)
           
 boolean normalize(java.lang.StringBuffer norm)
           
 boolean normalize(java.lang.String str, java.lang.StringBuffer norm)
           
protected  void optional(boolean opt)
           
protected  void setBinary(java.lang.String params, PairInteger datalim)
           
protected  void setJustification(java.lang.String params, PairInteger datalim)
           
 void setRegexGen(boolean isGen)
          Sets regular expression generation switch.
 byte[] toBin()
           
static byte[] toByteArray(java.util.BitSet bits)
          Convers a bitset object into a byte array
 java.lang.String toRE()
          Returns the regular expression generated by the instruction: This method should be overwritten by actual instruction, except if the instruction generates nothing
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARAM_FINISHED

public static final int PARAM_FINISHED
See Also:
Constant Field Values

ALIG_RIGHT

public static final char ALIG_RIGHT
See Also:
Constant Field Values

ALIG_LEFT

public static final char ALIG_LEFT
See Also:
Constant Field Values

NO_ALIGNMENT

public static final char NO_ALIGNMENT
See Also:
Constant Field Values

DEFAULT_FILLER

public static final char DEFAULT_FILLER
See Also:
Constant Field Values

NO_FILLER

public static final char NO_FILLER
See Also:
Constant Field Values

DEFAULT_MIN

public static final int DEFAULT_MIN
See Also:
Constant Field Values

DEFAULT_BINARY

public static final boolean DEFAULT_BINARY
See Also:
Constant Field Values

NO_BIN_POS

public static final int NO_BIN_POS
See Also:
Constant Field Values

DEFAULT_OPTIONAL

public static final boolean DEFAULT_OPTIONAL
See Also:
Constant Field Values

MAX_DEFAULT_CARMAX

public static final char MAX_DEFAULT_CARMAX
See Also:
Constant Field Values

MIN_DEFAULT_CARMAX

public static final char MIN_DEFAULT_CARMAX
See Also:
Constant Field Values

VAR_LENGTH

public static final int VAR_LENGTH
See Also:
Constant Field Values

DEFAULT_DELIMITOR

public static final char DEFAULT_DELIMITOR
See Also:
Constant Field Values

DEFAULT_DECIMAL

public static final int DEFAULT_DECIMAL
See Also:
Constant Field Values

BLANC_RE

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

SPACES_RE

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

instrNames

protected static final java.lang.String[] instrNames

UINT

public static final int UINT
See Also:
Constant Field Values

TEXT

public static final int TEXT
See Also:
Constant Field Values

MAJ

public static final int MAJ
See Also:
Constant Field Values

CH

public static final int CH
See Also:
Constant Field Values

MIN

public static final int MIN
See Also:
Constant Field Values

LET

public static final int LET
See Also:
Constant Field Values

INT

public static final int INT
See Also:
Constant Field Values

DECIMAL

public static final int DECIMAL
See Also:
Constant Field Values

ZONE

public static final int ZONE
See Also:
Constant Field Values

LGQ

public static final int LGQ
See Also:
Constant Field Values

CONST

public static final int CONST
See Also:
Constant Field Values

ROM

public static final int ROM
See Also:
Constant Field Values

IND

public static final int IND
See Also:
Constant Field Values

TAB

public static final int TAB
See Also:
Constant Field Values

RA

public static final int RA
See Also:
Constant Field Values

DE

public static final int DE
See Also:
Constant Field Values

VAR

public static final int VAR
See Also:
Constant Field Values

SPACE

public static final int SPACE
See Also:
Constant Field Values

CAT

public static final int CAT
See Also:
Constant Field Values

PGM

public static final int PGM
See Also:
Constant Field Values

paramNames

protected static final java.lang.String[] paramNames

BINARY

public static final int BINARY
See Also:
Constant Field Values

FACULTATIF

public static final int FACULTATIF
See Also:
Constant Field Values

JUSTIFICATION

public static final int JUSTIFICATION
See Also:
Constant Field Values

MAXIMUM

public static final int MAXIMUM
See Also:
Constant Field Values

MINIMUM

public static final int MINIMUM
See Also:
Constant Field Values

TEXTE

public static final int TEXTE
See Also:
Constant Field Values

CARMAX

public static final int CARMAX
See Also:
Constant Field Values

DELIMITOR

public static final int DELIMITOR
See Also:
Constant Field Values

LONGUEUR

public static final int LONGUEUR
See Also:
Constant Field Values

DECIMALES

public static final int DECIMALES
See Also:
Constant Field Values

FORMAT

public static final int FORMAT
See Also:
Constant Field Values

LIST

public static final int LIST
See Also:
Constant Field Values

PLUS

public static final int PLUS
See Also:
Constant Field Values

STRICT

public static final int STRICT
See Also:
Constant Field Values

NOM

public static final int NOM
See Also:
Constant Field Values

POSITION

public static final int POSITION
See Also:
Constant Field Values

valuelim

PairInteger valuelim

vec_format_car

protected static java.util.Vector vec_format_car

instrCode

private int instrCode

optional

protected boolean optional

isBinary

protected boolean isBinary

binPos

protected int binPos

alignment

protected char alignment

filler

protected char filler

regexGen

protected boolean regexGen

catName

protected java.lang.String catName
Constructor Detail

Instruction

public Instruction(int instrCode)
Constructor receiving only the instruction type

Parameters:
instrCode - code value of the instruction
Method Detail

setRegexGen

public void setRegexGen(boolean isGen)
Sets regular expression generation switch. Is true by default, so should only be used if the instruction generates no regex.

Parameters:
isGen - false if the instruction does not generate a reg. expression

getRegexGen

public boolean getRegexGen()
returns whether the instruction has generated or not a regex group

Returns:
false if the instruction does not generate a reg. expr.

getCatName

public java.lang.String getCatName()
Returns a new catalogue name defined by the instruction of null

Returns:
the new catalogue name

getInstrCode

public int getInstrCode()
Returns the instruction code

Returns:
the instruction code

getInstrName

public java.lang.String getInstrName()
Returns the instruction name

Returns:
the instruction name

getBinaryPosition

public int getBinaryPosition()
Get the bianry position

Returns:
the binary position if explicitely specified. Otherwise -1

optional

protected void optional(boolean opt)

getInteger

protected int getInteger(java.lang.String params,
                         PairInteger datalim)
Gets an integer in a parameter string

Parameters:
params - string containing the number
datalim - begin and end offsets of the number in params
Returns:
the integer found or 0

getLong

protected long getLong(java.lang.String params,
                       PairInteger datalim)

setBinary

protected void setBinary(java.lang.String params,
                         PairInteger datalim)

setJustification

protected void setJustification(java.lang.String params,
                                PairInteger datalim)

isBinary

public boolean isBinary()

isOptional

public boolean isOptional()

toString

public java.lang.String toString()

extractParams

public java.util.Vector extractParams(java.lang.String line)

getNextParam

public int getNextParam(java.lang.String line,
                        int offset,
                        PairInteger pi)
                 throws IdentifierDescriptionException
In an instruction parameter list, returns the next parameter

Parameters:
line - parameter list string
offset - first char to analyse for the next parameter
pi - Pair of integers defining the beginning and the end of the parameter value. The end is always the comma or one char after the end of the string. If a parameter has no value, both integers point after the parameter.
The end value + 1 should be used for the next call to the method.
Returns:
the parameter code, or -1 if the string is finished, and -2 if a parameter is not recognized.
Throws:
IdentifierDescriptionException

toRE

public java.lang.String toRE()
Returns the regular expression generated by the instruction: This method should be overwritten by actual instruction, except if the instruction generates nothing

Returns:
an empty string.

isREKeyword

public boolean isREKeyword(char c)
Checks whether the char is a special char for reg. expr. syntax

Parameters:
c - char to check
Returns:
true if the parameter is a special char for reg. expr.

isREKeyword

public boolean isREKeyword(java.lang.String c)

normalize

public boolean normalize(java.lang.String str,
                         java.lang.StringBuffer norm)

normalize

public boolean normalize(java.lang.StringBuffer norm)

toBin

public byte[] toBin()

toByteArray

public static byte[] toByteArray(java.util.BitSet bits)
Convers a bitset object into a byte array

Parameters:
bits - A bitset object
Returns:
a byte array

align

protected void align(java.lang.StringBuffer buf,
                     int pos0,
                     int nb_pos)

displayError

protected void displayError(java.lang.String type,
                            java.lang.String msg)

format2RE

protected java.lang.String format2RE(java.lang.String format)
Converts a format ('HHMMSS.dd...') into the regular expression needed to recognize it

Parameters:
format - string containing the format
Returns:
the regular expression

format2dbl

protected double format2dbl(java.lang.String format,
                            java.lang.String data)
Converts a format ('HHMMSS.dd...') into the regular expression needed to recognize it

Parameters:
format - string containing the format
Returns:
the regular expression

appendName

protected void appendName(java.lang.StringBuffer str)
Append instruction name and opening parenthesis

Parameters:
str - stringBuffer to fill

appendPosition

protected void appendPosition(java.lang.StringBuffer str,
                              int num)
Append position parameter

Parameters:
str - StringBuffer to fill
num - position value

appendOptional

protected void appendOptional(java.lang.StringBuffer str)
Append optional parameter

Parameters:
str - stringBuffer to fill

appendNom

protected void appendNom(java.lang.StringBuffer str)
Append 'name' parameter

Parameters:
str - StringBuffer to fill

appendMaximum

protected void appendMaximum(java.lang.StringBuffer str,
                             long maximum)
Append maximum parameter

Parameters:
str - stringBuffer to fill
maximum - minimum value

appendMinimum

protected void appendMinimum(java.lang.StringBuffer str,
                             int minimum)
Append minimum parameter

Parameters:
str - stringBuffer to fill
minimum - minimum value

appendMinimum

protected void appendMinimum(java.lang.StringBuffer str,
                             long minimum)
Append minimum parameter

Parameters:
str - stringBuffer to fill
minimum - minimum value

appendDecimal

protected void appendDecimal(java.lang.StringBuffer str,
                             int nbdec)
Append number of decimals

Parameters:
str - stringBuffer to fill
nbdec - number of decimals

appendPlus

protected void appendPlus(java.lang.StringBuffer str,
                          boolean plus)
Append plus sign

Parameters:
str - stringBuffer to fill
plus - true if plus sign should be included

appendFormat

protected void appendFormat(java.lang.StringBuffer str,
                            java.lang.String fmt)
Append format parameter

Parameters:
str - stringBuffer to fill
fmt - format to add in the item

appendText

protected void appendText(java.lang.StringBuffer str,
                          java.lang.String text)
Append list parameter

Parameters:
str - stringBuffer to fill
text - text to add in the item

appendList

protected void appendList(java.lang.StringBuffer str,
                          java.lang.String list)
Append list parameter

Parameters:
str - stringBuffer to fill
list - List of items

appendDelimitor

protected void appendDelimitor(java.lang.StringBuffer str,
                               char delim)
Append list parameter

Parameters:
str - stringBuffer to fill
delim - delimitor character

appendCarmax

protected void appendCarmax(java.lang.StringBuffer str,
                            char carmax)
Append carmax parameter

Parameters:
str - stringBuffer to fill
carmax - last character to accept

appendCarmax

protected void appendCarmax(java.lang.StringBuffer str,
                            java.lang.String carmax)
Append carmax parameter

Parameters:
str - stringBuffer to fill
carmax - last string character to accept

appendLength

protected void appendLength(java.lang.StringBuffer str,
                            int lg)
Append length parameter

Parameters:
str - stringBuffer to fill
lg - length parameter

appendJustification

protected void appendJustification(java.lang.StringBuffer str)
Append alignement parameter

Parameters:
str - stringBuffer to fill

appendBinary

protected void appendBinary(java.lang.StringBuffer str)
Append alignement parameter

Parameters:
str - stringBuffer to fill

appendStrict

protected void appendStrict(java.lang.StringBuffer str,
                            boolean strict)
Append strict flag

Parameters:
str - stringBuffer to fill
strict - flag to append if it is true

appendClose

protected void appendClose(java.lang.StringBuffer str)
Close the stringBuffer containing the instruction parameters

Parameters:
str - stringBuffer to close

equals

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

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