|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object marf.nlp.Parsing.TransitionTable
public class TransitionTable
TransitionTable class stores transition table for the main parser. Can be serialized and deserialized as a binary gzipped object.
$Id: TransitionTable.java,v 1.15 2007/12/18 21:37:56 mokhov Exp $
Field Summary | |
---|---|
protected int |
iEOFTerminalID
|
protected int |
iStartNonTerminalID
|
protected java.util.Vector |
oNonTerminals
Vector of NonTerminals as "row-pointers" to TT. |
protected java.util.Vector |
oTerminals
Vector of Terminals as "column-pointers" to TT. |
protected java.util.Vector |
oTT
Transition Table (TT) is a Vector of Vectors of Objects, such as Rules and SyntaxErrors. |
protected java.lang.String |
strTableFile
Prepared file name of a file with the saved table (if available). |
Constructor Summary | |
---|---|
TransitionTable()
Default Constructor. |
|
TransitionTable(java.lang.String pstrTableFileName)
Constructor with params. |
Method Summary | |
---|---|
java.lang.Object |
getEntryAt(NonTerminal poNonTerminal,
Terminal poTerminal)
Gets a table entry at a given position (NonTerminal, Terminal). |
java.lang.Object |
getEntryAt(NonTerminal poNonTerminal,
Token poToken)
Gets a table entry at a given position (NonTerminal, Token). |
Terminal |
getEOFTerminal()
Allows querying for the EOF terminal. |
GrammarElement |
getGrammarElement(java.lang.String pstrName)
Gets grammar element by its name (lexeme). |
static java.lang.String |
getMARFSourceCodeRevision()
Retrieves class' revision. |
java.util.Vector |
getNonTerminals()
NonTerminals property accessor. |
NonTerminal |
getStartNonTerminal()
Allows querying for the starting non-terminal. |
java.lang.String |
getTableFile()
TableFile property accessor. |
java.util.Vector |
getTerminals()
Terminals property accessor. |
boolean |
init(int piRows,
int piCols)
This is a standard attempt to initialize. |
boolean |
save()
Saves current state of the TT (itself). |
boolean |
serialize(int piOperation)
Serialize in text mode. |
void |
setEntryAt(NonTerminal poNonTerminal,
Terminal poTerminal,
java.lang.Object poEntry)
Sets the entry of a table. |
void |
setEOFTerminalID(int piID)
Allows setting the ID of an EOF terminal. |
void |
setNonTerminals(java.util.Vector poNonTerminalList)
Sets NonTerminals property. |
void |
setStartNonTerminalID(int piID)
Allows setting the ID of the Start non-terminal. |
void |
setTableFile(java.lang.String pstrTableFileName)
Sets TableFile property. |
void |
setTerminals(java.util.Vector poTerminalList)
Sets Terminals property. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Vector oTT
Rule
,
SyntaxError
protected java.util.Vector oNonTerminals
protected java.util.Vector oTerminals
protected int iEOFTerminalID
protected int iStartNonTerminalID
protected transient java.lang.String strTableFile
Constructor Detail |
---|
public TransitionTable()
public TransitionTable(java.lang.String pstrTableFileName)
pstrTableFileName
- Method Detail |
---|
public boolean init(int piRows, int piCols)
GrammarCompiler
or when
dimensions of the table are well known.
piRows
- rows number in the tablepiCols
- columns number in the table
true
if initialization was successfulGrammarCompiler
public boolean save()
true
if serialization was successfulpublic boolean serialize(int piOperation)
piOperation
- - 0 - LOAD, 1 - SAVE
true
if serialization was successfulpublic java.util.Vector getTerminals()
public java.util.Vector getNonTerminals()
public void setTerminals(java.util.Vector poTerminalList)
poTerminalList
- Vector with terminalspublic void setNonTerminals(java.util.Vector poNonTerminalList)
poNonTerminalList
- Vector with non-terminalspublic java.lang.Object getEntryAt(NonTerminal poNonTerminal, Terminal poTerminal)
poNonTerminal
- non-terminal as a line numberpoTerminal
- terminal as a column
public java.lang.Object getEntryAt(NonTerminal poNonTerminal, Token poToken)
poNonTerminal
- non-terminal as a line numberpoToken
- token corresponding to a terminal as a column
public void setEntryAt(NonTerminal poNonTerminal, Terminal poTerminal, java.lang.Object poEntry)
poNonTerminal
- the non-terminal as a row indexpoTerminal
- the terminal as a column indexpoEntry
- the entry to set
java.lang.ArrayIndexOutOfBoundsException
- if either index does not existpublic java.lang.String getTableFile()
public void setTableFile(java.lang.String pstrTableFileName)
pstrTableFileName
- the new filename to setpublic GrammarElement getGrammarElement(java.lang.String pstrName)
pstrName
- a name to search
public void setEOFTerminalID(int piID)
piID
- the ID corresponding to the end-of-file markerpublic void setStartNonTerminalID(int piID)
piID
- the ID corresponding to the Start non-terminalpublic Terminal getEOFTerminal()
public NonTerminal getStartNonTerminal()
public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |