cds.simbad.ident
Class Pgm

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

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

Classe qui contient le liste ordonnee des differentes instructions

See Also:
Serialized Form

Field Summary
static char CHAR_COMA
           
static char CHAR_DOUBLE_QUOTES
           
static char CHAR_LPAR
           
static char CHAR_QUOTES
           
static char CHAR_RPAR
           
private  java.util.ArrayList instrList
           
private  java.util.regex.Pattern pat
           
 
Constructor Summary
Pgm()
          Constructor of a Pgm object.
 
Method Summary
 void addInstruction(java.lang.String line)
          adds an instruction to the programme.
 void clear()
          Clears a programme, by suppressing the instructions
private  Instruction createInstruction(java.lang.String instrName, java.lang.String params)
          Cretae an instruction object, according to the parameters.
 boolean equals(java.lang.Object o)
          MOD-BB 21-01-04 Ajout de cette methode.
 Instruction getInstructionAt(int i)
          Returns the n-th instruction in the programme
 Instruction[] getInstructions()
          Returns an array with all the instructions objects in the programme
 int getLength()
          Returns the number of instructions in the programme
 java.util.regex.Pattern getPattern()
          Returns the compiled regular expression used to analyse an identifier with this programme.
 int getSize()
          returns the number of instructions in a programme
 java.lang.String toRE()
          Returns the regular expression (as a string) build with the all the regular instructions defined by the instructions
 java.lang.String toString()
          Displays a program as a list of instructions
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CHAR_LPAR

public static final char CHAR_LPAR
See Also:
Constant Field Values

CHAR_RPAR

public static final char CHAR_RPAR
See Also:
Constant Field Values

CHAR_COMA

public static final char CHAR_COMA
See Also:
Constant Field Values

CHAR_QUOTES

public static final char CHAR_QUOTES
See Also:
Constant Field Values

CHAR_DOUBLE_QUOTES

public static final char CHAR_DOUBLE_QUOTES
See Also:
Constant Field Values

instrList

private java.util.ArrayList instrList

pat

private java.util.regex.Pattern pat
Constructor Detail

Pgm

public Pgm()
Constructor of a Pgm object.
A programme should, after construction, be filled with instructions using the addInstruction() method.

Method Detail

addInstruction

public void addInstruction(java.lang.String line)
                    throws IdentifierDescriptionException
adds an instruction to the programme.

Parameters:
line - contains the instruction parameters to analyze. its syntax is always:
instr_name(param1, param2, ...)
Throws:
IdentifierDescriptionException - in case of syntax error in the instruction

createInstruction

private Instruction createInstruction(java.lang.String instrName,
                                      java.lang.String params)
                               throws IdentifierDescriptionException
Cretae an instruction object, according to the parameters.
This method can be seen as a Instruction factory

Parameters:
instrName - name of the instruction to create
params - parameter string
Returns:
the created instruction object
Throws:
IdentifierDescriptionException - in case of error

getLength

public int getLength()
Returns the number of instructions in the programme

Returns:
the number of instructions

getInstructionAt

public Instruction getInstructionAt(int i)
Returns the n-th instruction in the programme

Parameters:
i - index of the instruction
Returns:
the instruction object, or null

getInstructions

public Instruction[] getInstructions()
Returns an array with all the instructions objects in the programme

Returns:
the Instruction objects in an array

getSize

public int getSize()
returns the number of instructions in a programme

Returns:
number of instructions

getPattern

public java.util.regex.Pattern getPattern()
Returns the compiled regular expression used to analyse an identifier with this programme.

Returns:
a Pattern object, containeing a compiled regular expression

toString

public java.lang.String toString()
Displays a program as a list of instructions

Returns:
a string displaying the programme, one instruction/line

toRE

public java.lang.String toRE()
Returns the regular expression (as a string) build with the all the regular instructions defined by the instructions

Returns:
the regular instruction string

clear

public void clear()
Clears a programme, by suppressing the instructions


equals

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

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