|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.chaperon.build.ItemSet
This class represents a set of items, which means positions of production, in production and lookahead symbols. These item sets were used to decribes states.
Constructor Summary | |
ItemSet(Grammar grammar,
FirstSetCollection firstsets)
Create an empty set of items. |
Method Summary | |
boolean |
addItem(int production,
int position,
Symbol lookahead)
Add a item to this set. |
boolean |
addItem(int production,
int position,
SymbolSet lookaheads)
|
boolean |
addItemSet(ItemSet I)
Add the items from another itemset to this set. |
ItemSet |
closure()
Calculate the closure for this item set. |
boolean |
contains(ItemSet itemset)
Test, if all items from a other state exists in this state |
boolean |
equals(java.lang.Object o)
Compares two item sets. |
boolean |
equalsCore(java.lang.Object o)
Compares the core of two item sets. |
int |
getItemCount()
Returns the count of items in this set. |
Error |
getNextError()
|
SymbolSet |
getNextNonterminals()
|
SymbolSet |
getNextTerminals()
|
IntegerSet |
getReduceProductions()
Returns the list of productions, which could be reduced. |
IntegerSet |
getReduceProductions(Symbol lookahead)
Returns the list of productions, which a special symbol reduce. |
SymbolSet |
getReduceSymbols()
Return all symbols, which reduce productions in this state. |
SymbolSet |
getShiftSymbols()
Returns all symbols, which forces a transition. |
int |
getTransition(Symbol symbol)
Returns the destination state of a transition. |
boolean |
isEmpty()
Returns true, if this set is empty. |
ItemSet |
jump(Symbol symbol)
Calculates the next state by a transition through the symbol X. |
void |
setTransition(Symbol symbol,
int state)
Add a transition to this state. |
java.lang.String |
toString()
Return a string representation of this item set. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ItemSet(Grammar grammar, FirstSetCollection firstsets)
grammar
- Grammar.firstsets
- The first sets.Method Detail |
public boolean addItem(int production, int position, Symbol lookahead)
production
- Production.position
- Position in this production.lookahead
- Lookahead symbol.
public boolean addItem(int production, int position, SymbolSet lookaheads)
public boolean addItemSet(ItemSet I)
I
- ItemSet, which should be addded.
public boolean contains(ItemSet itemset)
itemset
- Other item set.
public int getItemCount()
public boolean isEmpty()
public boolean equals(java.lang.Object o)
o
- Other itemset.
public boolean equalsCore(java.lang.Object o)
o
- Other itemset.
public SymbolSet getNextTerminals()
public SymbolSet getNextNonterminals()
public Error getNextError()
public ItemSet closure()
public ItemSet jump(Symbol symbol)
symbol
- A Symbol, which can be a terminal or a nonterminal symbol.
public void setTransition(Symbol symbol, int state)
symbol
- Symbol, which forces a transition into another state.state
- Destination state.public int getTransition(Symbol symbol)
symbol
- Symbol, which force the transition.
public SymbolSet getShiftSymbols()
public IntegerSet getReduceProductions()
public IntegerSet getReduceProductions(Symbol lookahead)
lookahead
- Symbol, which the productions reduce.
public SymbolSet getReduceSymbols()
public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |