arules
Class TrActSet

java.lang.Object
  extended by arules.TrActSet

public class TrActSet
extends java.lang.Object

Class for a set of transactions.

Since:
2007.06.06

Field Summary
protected  int cnt
          the current number of transactions
protected  util.IdMap iset
          the underlying item set
protected  int max
          the maximal size of a transaction
protected  int[][] tracts
          the set of transactions
 
Constructor Summary
TrActSet()
          Create an empty set of transactions.
TrActSet(util.IdMap iset)
          Create an empty set of transactions.
 
Method Summary
 int addTrAct(int[] tract)
          Add a transaction.
 java.lang.String getItemName(int i)
          Get the name of an item.
 util.IdMap getItemSet()
          Get the underlying item set.
 int getMaxSize()
          Get the maximal size of a transaction.
 int[] getTrAct(int i)
          Get a transaction.
 int getTrActCount()
          Get the number of transactions.
static void main(java.lang.String[] args)
          Main function for testing some basic functionality.
static int[] parseTrAct(util.IdMap iset, util.TableReader reader)
          Parse a transaction.
static TrActSet parseTrActSet(util.IdMap iset, util.TableReader reader)
          Parse a set of transactions.
 void write(util.TableWriter writer)
          Write a set of transactions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iset

protected util.IdMap iset
the underlying item set


tracts

protected int[][] tracts
the set of transactions


cnt

protected int cnt
the current number of transactions


max

protected int max
the maximal size of a transaction

Constructor Detail

TrActSet

public TrActSet()
Create an empty set of transactions.

Since:
2007.06.06 (Christian Borgelt)

TrActSet

public TrActSet(util.IdMap iset)
Create an empty set of transactions.

Parameters:
iset - the underlying item set
Since:
2007.06.06 (Christian Borgelt)
Method Detail

getItemSet

public util.IdMap getItemSet()
Get the underlying item set.

Returns:
the underlying item set
Since:
2007.06.06 (Christian Borgelt)

getItemName

public java.lang.String getItemName(int i)
Get the name of an item.

Returns:
the name of the item with index i
Since:
2007.06.06 (Christian Borgelt)

getTrActCount

public int getTrActCount()
Get the number of transactions.

Returns:
the number of transactions
Since:
2007.06.06 (Christian Borgelt)

getTrAct

public int[] getTrAct(int i)
Get a transaction.

Parameters:
i - the index of the transaction
Returns:
the transaction with index i
Since:
2007.06.06 (Christian Borgelt)

addTrAct

public int addTrAct(int[] tract)
Add a transaction.

Parameters:
tract - the transaction to add
Returns:
the index of the transaction in the set
Since:
2007.06.06 (Christian Borgelt)

getMaxSize

public int getMaxSize()
Get the maximal size of a transaction.

Returns:
the maximal size of a transaction
Since:
2007.06.06 (Christian Borgelt)

write

public void write(util.TableWriter writer)
           throws java.io.IOException
Write a set of transactions.

Parameters:
writer - the table writer to write to
Throws:
java.io.IOException - if a write error occurs
Since:
2007.06.06 (Christian Borgelt)

parseTrAct

public static int[] parseTrAct(util.IdMap iset,
                               util.TableReader reader)
                        throws java.io.IOException
Parse a transaction.

Parameters:
iset - the underlying item set
reader - the table reader to read from
Returns:
the parsed transaction
Throws:
java.io.IOException - if a read error occurs
Since:
2007.06.06 (Christian Borgelt)

parseTrActSet

public static TrActSet parseTrActSet(util.IdMap iset,
                                     util.TableReader reader)
                              throws java.io.IOException
Parse a set of transactions.

Parameters:
iset - the underlying item set
reader - the table reader to read from
Returns:
the parsed set of transactions
Throws:
java.io.IOException - if a read error occurs
Since:
2007.06.06 (Christian Borgelt)

main

public static void main(java.lang.String[] args)
Main function for testing some basic functionality.

It is tried to parse the file that is given as the first command line argument as a set of transactions.

Parameters:
args - the command line arguments
Since:
2007.06.06 (Christian Borgelt)