|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgrammar.Grammar
public abstract class Grammar
The abstract class for general grammars.
Constructor Summary | |
---|---|
Grammar()
Creates an instance of grammar. |
Method Summary | |
---|---|
void |
addProduction(Production production)
Adds a production to the set of productions in the grammar. |
void |
addProductions(Production[] productions)
Adds productions to grammar |
abstract void |
checkProduction(Production production)
Checks whether a production is invalid |
boolean |
equals(java.lang.Object obj)
|
Production[] |
getProductions()
Returns all productions in the grammar. |
int |
getProductionsNumber()
Returns the productions' number in the grammar. |
java.lang.String |
getStartVariable()
Returns the start variable. |
java.lang.String[] |
getTerminals()
Returns all terminals in the grammar. |
int |
getTerminalsNumber()
Returns the terminals' number in the grammar. |
java.lang.String[] |
getVariables()
Returns all variables in the grammar. |
int |
getVariablesNumber()
Returns the variables' number in the grammar. |
int |
hashCode()
|
boolean |
isEmpty()
Returns true if the grammar is empty. |
java.lang.String |
reachability()
Finds out the unreachable variables. |
void |
setStartVariable(java.lang.String variable)
Sets the start variable |
java.lang.String |
toString()
Returns a string representation of the grammar object, |
java.lang.String |
usefulness()
Finds out the useless variables. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Grammar()
Method Detail |
---|
public boolean isEmpty()
public java.lang.String getStartVariable()
public void setStartVariable(java.lang.String variable)
variable
- the start variable to setpublic java.lang.String[] getTerminals()
public int getTerminalsNumber()
public java.lang.String[] getVariables()
public int getVariablesNumber()
public abstract void checkProduction(Production production)
production
- the production to check
java.lang.IllegalArgumentException
- if the production is in some
way faultypublic void addProduction(Production production)
production
- the production to be added.
java.lang.IllegalArgumentException
- if the production is unsuitable somehowpublic void addProductions(Production[] productions)
productions
- the set of productions to addpublic Production[] getProductions()
public int getProductionsNumber()
public java.lang.String usefulness()
public java.lang.String reachability()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |