|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.percederberg.grammatica.parser.ProductionPatternAlternative
A production pattern alternative. This class represents a list of production pattern elements. In order to provide productions that cannot be represented with the element occurance counters, multiple alternatives must be created and added to the same production pattern. A production pattern alternative is always contained within a production pattern.
Constructor Summary | |
ProductionPatternAlternative()
Creates a new production pattern alternative. |
Method Summary | |
void |
addElement(ProductionPatternElement elem)
Adds a production pattern element to this alternative. |
void |
addElement(ProductionPatternElement elem,
int min,
int max)
Adds a production pattern element to this alternative. |
void |
addProduction(int id,
int min,
int max)
Adds a production to this alternative. |
void |
addToken(int id,
int min,
int max)
Adds a token to this alternative. |
boolean |
equals(java.lang.Object obj)
Checks if this object is equal to another. |
ProductionPatternElement |
getElement(int pos)
Returns an element in this alternative. |
int |
getElementCount()
Returns the number of elements in this alternative. |
int |
getMaxElementCount()
Returns the maximum number of elements needed to satisfy this alternative. |
int |
getMinElementCount()
Returns the minimum number of elements needed to satisfy this alternative. |
ProductionPattern |
getPattern()
Returns the production pattern containing this alternative. |
boolean |
isLeftRecursive()
Checks if this alternative is recursive on the left-hand side. |
boolean |
isMatchingEmpty()
Checks if this alternative would match an empty stream of tokens. |
boolean |
isRightRecursive()
Checks if this alternative is recursive on the right-hand side. |
java.lang.String |
toString()
Returns a string representation of this object. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ProductionPatternAlternative()
Method Detail |
public boolean isLeftRecursive()
public boolean isRightRecursive()
public boolean isMatchingEmpty()
public ProductionPattern getPattern()
public int getElementCount()
public int getMinElementCount()
public int getMaxElementCount()
public ProductionPatternElement getElement(int pos)
pos
- the element position, 0 <= pos < count
public void addToken(int id, int min, int max)
id
- the token (pattern) idmin
- the minimum number of occuranciesmax
- the maximum number of occurancies, or
-1 for infinitepublic void addProduction(int id, int min, int max)
id
- the production (pattern) idmin
- the minimum number of occuranciesmax
- the maximum number of occurancies, or
-1 for infinitepublic void addElement(ProductionPatternElement elem)
elem
- the production pattern elementpublic void addElement(ProductionPatternElement elem, int min, int max)
elem
- the production pattern elementmin
- the minimum number of occuranciesmax
- the maximum number of occurancies, or
-1 for infinitepublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to compare with
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |