|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object marf.nlp.Parsing.GrammarCompiler.GrammarElement
public abstract class GrammarElement
Generic grammar token that must be subclassed.
$Id: GrammarElement.java,v 1.12 2008/02/17 02:23:28 mokhov Exp $
Field Summary | |
---|---|
protected int |
iID
ID to act as an index to table. |
protected java.util.Vector |
oFirstSet
FirstSet of us. |
protected Token |
oToken
A bit extra info in the encapsulated token. |
protected java.lang.String |
strName
A name of a token to refer to. |
Constructor Summary | |
---|---|
protected |
GrammarElement(java.lang.String pstrName,
int piID)
Constructor by name; inner token is set to null. |
protected |
GrammarElement(Token poToken,
int piID)
Preferred Constructor. |
Method Summary | |
---|---|
boolean |
addToFirstSet(NonTerminal poNonTerminal)
Adds a single non-terminal to the first set. |
boolean |
addToFirstSet(Terminal poTerminal)
Adds a single terminal to the first set if it's not already there. |
boolean |
addToFirstSet(java.util.Vector poSet)
Appends elements from the passed set to its current first set. |
java.util.Vector |
getFirstSet()
Allows getting the first set of this grammar element. |
int |
getID()
Allows querying this element's ID. |
static java.lang.String |
getMARFSourceCodeRevision()
Retrieves class' revision. |
java.lang.String |
getName()
Allows querying this element's name. |
Token |
getToken()
Allows querying this element's enclosed token. |
boolean |
isEqualByName(java.lang.String pstrName)
Tests whether the parameter is equal to the internal name of the grammar element. |
abstract boolean |
isNonTerminal()
Allows querying this grammar element for non-terminality. |
abstract boolean |
isTerminal()
Allows querying this grammar element for terminality. |
java.lang.String |
toString()
Overridden to return the grammar element's name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String strName
protected int iID
protected Token oToken
protected java.util.Vector oFirstSet
Constructor Detail |
---|
protected GrammarElement(Token poToken, int piID)
poToken
- token corresponding to this grammar elementpiID
- element's IDprotected GrammarElement(java.lang.String pstrName, int piID)
pstrName
- name of the grammar elementpiID
- element's IDMethod Detail |
---|
public abstract boolean isTerminal()
true
if this grammar element is a terminalpublic abstract boolean isNonTerminal()
true
if this grammar element is a non-terminalpublic final int getID()
public final java.lang.String getName()
public final Token getToken()
public boolean addToFirstSet(java.util.Vector poSet)
poSet
- collection of grammar elements to add to the first set
true
if the underlying first set has change
as a result of operation.public boolean addToFirstSet(Terminal poTerminal)
poTerminal
- the terminal element to add
true
if the terminal was addedpublic boolean addToFirstSet(NonTerminal poNonTerminal)
poNonTerminal
- the non-terminal element to add
true
if the non-terminal was addedpublic java.util.Vector getFirstSet()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public boolean isEqualByName(java.lang.String pstrName)
pstrName
- name to test
true
if the names are equalpublic static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |