|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgrammar.Production
grammar.cfg.MyProduction
public class MyProduction
The class for productions of context-free grammars with index numbers.
| Constructor Summary | |
|---|---|
MyProduction()
Creates an empty instance of production |
|
MyProduction(java.lang.String lhs,
java.lang.String rhs)
Creates an instance of production Tokens on the right hand side are delimited by blanks. |
|
MyProduction(java.lang.String lhs,
java.lang.String[] rhs)
Creates an instance of production |
|
| Method Summary | |
|---|---|
int |
compareTo(java.lang.Object o)
Compares this object with the specified object for order. |
int |
compareTokens(java.lang.String s,
java.lang.String t)
Compares two tokens. |
int[] |
getIndexesOfRHS()
Returns the indices of the right hand side |
int |
getIndexOfLHS()
Returns the index of the left hand side |
int[] |
getRHSVariableIndexes()
Returns the indices of variables at the right hand side |
int |
getRHSVariableNumber()
Returns the number of variables at the right hand side |
void |
setIndex(java.lang.String[] terminals,
java.lang.String[] variables)
Sets the indeies of the tokens at the production w.r.t. |
void |
setLHS(java.lang.String lhs)
Sets the left hand side |
void |
setRHS(java.lang.String rhs)
Sets the right hand side (in string format) |
| Methods inherited from class grammar.Production |
|---|
equals, getLHS, getRHS, getRHSTerminals, getRHSTokenNumber, getRHSTokens, getRHSVariables, getTerminals, getVariables, hashCode, setRHSTokens, toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MyProduction()
public MyProduction(java.lang.String lhs,
java.lang.String rhs)
lhs - the left hand side of the production rule, in string format.rhs - the right hand side of the production rule, in string format.
public MyProduction(java.lang.String lhs,
java.lang.String[] rhs)
lhs - the left hand side of the production rule, in string format.rhs - the right hand side of the production rule, in tokens(string[]) format.| Method Detail |
|---|
public void setLHS(java.lang.String lhs)
Production
setLHS in class Productionlhs - the left hand side to setpublic void setRHS(java.lang.String rhs)
Production
setRHS in class Productionrhs - the right hand side to set
public void setIndex(java.lang.String[] terminals,
java.lang.String[] variables)
terminals - the correlative terminalsvariables - the correlative variables
java.lang.IllegalArgumentException - if some token is in neither terminals nor variables.public int getIndexOfLHS()
public int[] getIndexesOfRHS()
public int[] getRHSVariableIndexes()
public int getRHSVariableNumber()
java.lang.Exception - if the production is not indexed.public int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparable<java.lang.Object>o - the specified object
public int compareTokens(java.lang.String s,
java.lang.String t)
s - the first tokent - the second token
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||