modelling.fiti.data
Class ItemList

java.lang.Object
  extended by modelling.fiti.data.ItemList

public class ItemList
extends java.lang.Object

List of Items and InterItems. Shall be only one of a kind of each item. Index of InterItem is given by position in this list. ItemList is used so that all itemsets are given a unique index. This is given by the position in the list. The index is need in communication with external classes.

Author:
Kjell-Inge Skogstad and Trond Řivind Eriksen

Field Summary
static ItemList INSTANCE
           
 
Constructor Summary
ItemList()
          Constructor creating a new itemlist.
 
Method Summary
 int addItem(Item item)
          Method for adding an item.
 Item getItem(int i)
          Method for getting an item.
 int getSize()
           
 int indexOfItem(Item item)
          Method for getting the index of an item.
 java.lang.String toString()
          Method for getting a printable representation of the itemlist.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INSTANCE

public static ItemList INSTANCE
Constructor Detail

ItemList

public ItemList()
Constructor creating a new itemlist.

Method Detail

getSize

public int getSize()

addItem

public int addItem(Item item)
Method for adding an item. If item is already present only index is returned.

Parameters:
item - The item
Returns:
The index

indexOfItem

public int indexOfItem(Item item)
Method for getting the index of an item.

Parameters:
item - The item
Returns:
The index

getItem

public Item getItem(int i)
Method for getting an item.

Parameters:
i - The index
Returns:
The item

toString

public java.lang.String toString()
Method for getting a printable representation of the itemlist.

Overrides:
toString in class java.lang.Object