| java.lang.Object net.sourceforge.chaperon.build.ItemSet
ItemSet | public class ItemSet (Code) | | 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.
author: Stephan Michels version: CVS $Id: ItemSet.java,v 1.17 2003/12/09 19:55:52 benedikta Exp $ |
Method Summary | |
public boolean | addItem(int production, int position, Symbol lookahead) Add a item to this set.
Parameters: production - Production. Parameters: position - Position in this production. Parameters: lookahead - Lookahead symbol. | public boolean | addItem(int production, int position, SymbolSet lookaheads) | public boolean | addItemSet(ItemSet I) Add the items from another itemset to this set. | public ItemSet | closure() Calculate the closure for this item set. | public boolean | contains(ItemSet itemset) Test, if all items from a other state exists in this state
Parameters: itemset - Other item set. | public boolean | equals(Object o) Compares two item sets.
Parameters: o - Other itemset. | public boolean | equalsCore(Object o) Compares the core of two item sets.
Parameters: o - Other itemset. | public int | getItemCount() Returns the count of items in this set. | public Error | getNextError() | public SymbolSet | getNextNonterminals() | public SymbolSet | getNextTerminals() | public IntegerSet | getReduceProductions() Returns the list of productions, which could be reduced. | public IntegerSet | getReduceProductions(Symbol lookahead) Returns the list of productions, which a special symbol reduce.
Parameters: lookahead - Symbol, which the productions reduce. | public SymbolSet | getReduceSymbols() Return all symbols, which reduce productions in this state. | public SymbolSet | getShiftSymbols() Returns all symbols, which forces a transition. | public int | getTransition(Symbol symbol) Returns the destination state of a transition.
Parameters: symbol - Symbol, which force the transition. | public boolean | isEmpty() Returns true, if this set is empty. | public ItemSet | jump(Symbol symbol) Calculates the next state by a transition through the symbol X.
Parameters: symbol - A Symbol, which can be a terminal or a nonterminal symbol. | public void | setTransition(Symbol symbol, int state) Add a transition to this state. | public String | toString() Return a string representation of this item set. |
ItemSet | public ItemSet(Grammar grammar, FirstSetCollection firstsets)(Code) | | Create an empty set of items.
Parameters: grammar - Grammar. Parameters: firstsets - The first sets. |
addItem | public boolean addItem(int production, int position, Symbol lookahead)(Code) | | Add a item to this set.
Parameters: production - Production. Parameters: position - Position in this production. Parameters: lookahead - Lookahead symbol. True, if this item was added |
addItem | public boolean addItem(int production, int position, SymbolSet lookaheads)(Code) | | |
addItemSet | public boolean addItemSet(ItemSet I)(Code) | | Add the items from another itemset to this set. If this set changed the method will return
true.
Parameters: I - ItemSet, which should be addded. True, if this set was changed |
closure | public ItemSet closure()(Code) | | Calculate the closure for this item set.
Closure of the item set |
contains | public boolean contains(ItemSet itemset)(Code) | | Test, if all items from a other state exists in this state
Parameters: itemset - Other item set. True, if the state contains all items. |
equals | public boolean equals(Object o)(Code) | | Compares two item sets.
Parameters: o - Other itemset. True, if the item sets are equal. |
equalsCore | public boolean equalsCore(Object o)(Code) | | Compares the core of two item sets.
Parameters: o - Other itemset. True, if the core of the itemsets are equal. |
getItemCount | public int getItemCount()(Code) | | Returns the count of items in this set.
Count of items of the core. |
getReduceProductions | public IntegerSet getReduceProductions()(Code) | | Returns the list of productions, which could be reduced.
List of indicies for the productions. |
getReduceProductions | public IntegerSet getReduceProductions(Symbol lookahead)(Code) | | Returns the list of productions, which a special symbol reduce.
Parameters: lookahead - Symbol, which the productions reduce. Set of indicies from the productions. |
getReduceSymbols | public SymbolSet getReduceSymbols()(Code) | | Return all symbols, which reduce productions in this state.
Set of symbols. |
getShiftSymbols | public SymbolSet getShiftSymbols()(Code) | | Returns all symbols, which forces a transition.
List of symbols. |
getTransition | public int getTransition(Symbol symbol)(Code) | | Returns the destination state of a transition.
Parameters: symbol - Symbol, which force the transition. Destination state. |
isEmpty | public boolean isEmpty()(Code) | | Returns true, if this set is empty.
True, if this set is empty. |
jump | public ItemSet jump(Symbol symbol)(Code) | | Calculates the next state by a transition through the symbol X.
Parameters: symbol - A Symbol, which can be a terminal or a nonterminal symbol. The next state, represented by an item set. |
setTransition | public void setTransition(Symbol symbol, int state)(Code) | | Add a transition to this state.
Parameters: symbol - Symbol, which forces a transition into another state. Parameters: state - Destination state. |
toString | public String toString()(Code) | | Return a string representation of this item set.
String representation of this item set. |
|
|