net.sourceforge.chaperon.build
Class ItemSetCollection

java.lang.Object
  extended by net.sourceforge.chaperon.build.ItemSetCollection

public class ItemSetCollection
extends java.lang.Object

This class contains a collection of item sets.

Version:
CVS $Id: ItemSetCollection.java,v 1.15 2003/12/09 19:55:52 benedikta Exp $
Author:
Stephan Michels

Constructor Summary
ItemSetCollection(Grammar grammar, FirstSetCollection firstsets)
          Create a new collection of item sets, calculated with the aid of the grammar.
ItemSetCollection(Grammar grammar, FirstSetCollection firstsets, org.apache.commons.logging.Log log)
          Create a new collection of item sets, calculated with the aid of the grammar.
 
Method Summary
 int addItemSet(ItemSet itemset)
          Add a itemset to this collection.
 boolean contains(ItemSet itemset)
          If this collection contains the item set.
 boolean containsCore(ItemSet itemset)
          If this collection contains the item set.
 ItemSet getItemSet(int index)
          Return an item set given by an index.
 int getItemSetCount()
          Return the count of item sets in this collection
 int indexOf(ItemSet itemset)
          Return the index of an item set.
 int indexOfCore(ItemSet itemset)
          Return the index of an item set.
 java.lang.String toString()
          Return a string representation of the collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ItemSetCollection

public ItemSetCollection(Grammar grammar,
                         FirstSetCollection firstsets)
Create a new collection of item sets, calculated with the aid of the grammar. The constructor calculates all state and transitions and combine all itemsets with the same core.

Parameters:
grammar - Grammar.
firstsets - First sets.

ItemSetCollection

public ItemSetCollection(Grammar grammar,
                         FirstSetCollection firstsets,
                         org.apache.commons.logging.Log log)
Create a new collection of item sets, calculated with the aid of the grammar. The constructor calculates all state and transitions and combine all itemsets with the same core.

Parameters:
grammar - Grammar
firstsets - First sets.
log - Log, which should be used.
Method Detail

addItemSet

public int addItemSet(ItemSet itemset)
Add a itemset to this collection.

Parameters:
itemset - Itemset.
Returns:
Index of the itemset in the collection.

getItemSet

public ItemSet getItemSet(int index)
Return an item set given by an index.

Parameters:
index - Index of the itemset.
Returns:
Itemset.

getItemSetCount

public int getItemSetCount()
Return the count of item sets in this collection

Returns:
Count of itemsets.

indexOf

public int indexOf(ItemSet itemset)
Return the index of an item set. If the collection does not contain the itemset, then return this method will return -1.

Parameters:
itemset - Itemset, which should be found.
Returns:
Index of the itemset.

contains

public boolean contains(ItemSet itemset)
If this collection contains the item set.

Parameters:
itemset - Itemset, which should be found.
Returns:
True, if the collection contains the itemset.

indexOfCore

public int indexOfCore(ItemSet itemset)
Return the index of an item set. If the collection does not contain the itemset, then this method will return -1. This Method compare only the core from the item sets.

Parameters:
itemset - Itemset, which should be found.
Returns:
Index of the Itemset

containsCore

public boolean containsCore(ItemSet itemset)
If this collection contains the item set. This method compares only the core of the itemset.

Parameters:
itemset - Itemset, which should be found.
Returns:
True, if the collection contain the itemset.

toString

public java.lang.String toString()
Return a string representation of the collection.

Overrides:
toString in class java.lang.Object
Returns:
String representation of the collection.


Copyright ? 2003 Chaperon project. All Rights Reserved.