|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Rule
The rule class describes a grammatical rule. It iterates through itself, successively returning the tokens of the rule in sequence.
Constructor Summary | |
Rule(Rule rule)
Make a rule from a rule. |
|
Rule(Rule rule,
int offset)
Make a rule from a rule, but add some amount to the index. |
|
Rule(Rule rule,
int offset,
java.lang.String addInterp)
Make a rule from a rule, but add some amount to the index and a string to the interpretation. |
|
Rule(java.lang.String grammarLine)
Creates a rule based on a string. |
Method Summary | |
java.lang.String |
consistencyCode()
Get the consistencyCode of this rule. |
java.lang.String |
getBindings(java.util.LinkedList valuesList,
java.lang.String initialString)
Return a version of this rule's consistencyCode with all the variables bound. |
java.lang.String |
getBindings(java.util.LinkedList valuesList,
java.lang.String initialString,
boolean moreTags)
Return a version of this rule's consistencyCode with all the variables bound. |
static java.util.LinkedList |
getRules(java.lang.String fileName)
Read the grammar rules file and return a linked list of rules. |
boolean |
hasMoreElements()
Check if there are more elements in the list. |
java.lang.String |
interpretation()
Get the interpretation of this rule. |
java.lang.Object |
nextElement()
Get the next token of this rule. |
java.lang.Object |
peekElement()
Peek at the next token of this rule. |
java.lang.String |
syntax()
Get the syntactic role of this rule. |
java.lang.String |
toString()
Print the rule. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Rule(java.lang.String grammarLine)
grammarLine
- a string from the grammar. See the latest grammar file for format.
java.lang.RuntimeException
- for format problems.public Rule(Rule rule)
rule
- the rule to copy.public Rule(Rule rule, int offset)
rule
- the rule to copy.offset
- amount to add to index.public Rule(Rule rule, int offset, java.lang.String addInterp)
rule
- the rule to copy.offset
- amount to add to index.addInterp
- the string to add to the interpretation.Method Detail |
public boolean hasMoreElements()
hasMoreElements
in interface java.util.Enumeration
public java.lang.Object nextElement()
nextElement
in interface java.util.Enumeration
java.util.NoSuchElementException
- if out.public java.lang.Object peekElement()
java.util.NoSuchElementException
- if out.public java.lang.String consistencyCode()
public java.lang.String interpretation()
public java.lang.String syntax()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getBindings(java.util.LinkedList valuesList, java.lang.String initialString)
valuesList
- the values to bind.initialString
- the string to bind on.
java.lang.RuntimeException
- if the values list is too short to bind all the variables, or
too long.public java.lang.String getBindings(java.util.LinkedList valuesList, java.lang.String initialString, boolean moreTags)
valuesList
- the values to bind.initialString
- the string to bind on.
java.lang.RuntimeException
- if the values list is too short to bind all the variables, or
too long.public static java.util.LinkedList getRules(java.lang.String fileName)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |