Biorithm  1.1
Public Member Functions | Protected Attributes | Friends
Itemset Class Reference

This class holds a set of items (column numbers) More...

#include <Itemset.h>

List of all members.

Public Member Functions

 Itemset (const Itemset &rhs)
 Copy constructor.
void addRow (unsigned int index)
 Add index as a row to the itemset.
void setId (ItemsetId id)
ItemsetId getId () const
unsigned int size () const
const Itemsetoperator= (const Itemset &rhs)
bool operator< (const Itemset &a) const
bool operator< (const Itemset *a) const
bool operator== (const Itemset &a) const
bool operator== (const Itemset *a) const
void clearColumns ()
 Delete the columns of the itemset to save memory usage.
bool containsColumn (unsigned int index) const
bool containsRow (unsigned int index) const
 Return true if and only if index is a row in the itemset.
bool containsRows (const Itemset &other) const
 Return true if and only if the rows in other are a subset of the rows in the invocant.
bool containsRows (const set< unsigned int > &otherRows) const
 Return true if and only if the elements of otherRows are a subset of the rows in the invocant.
vector< string > getColumns () const
 Return the set of columns in the itemset.
unsigned int getNumColumns () const
 Return the number of columns in the itemset.
unsigned int getNumRows () const
 Return the number of rows in the itemset.
unsigned int getNumComplementedRows () const
 Return the number of complemented rows in the itemset.
vector< string > getRows () const
 Return the set of rows in the itemset.
void printColumns (ostream &ostr) const
 Print the columns in the itemset to the output stream.
void printRows (ostream &ostr) const
 Print the rows in the itemset to the output stream.
void print (ostream &ostr, unsigned int itemsetnum) const
void printGraph (ostream &ostr, unsigned int itemsetNum) const
void setColumnPvalue (float pval)
 Set the column p-value of the itemset.
float getColumnPvalue () const
 Return the column p-value of the itemset.
void setRowPvalue (float pval)
 Set the row p-value of the itemset.
float getRowPvalue () const
 Return the row p-value of the itemset.
void setSizePvalue (float pval)
 Set the size p-value of the itemset.
float getSizePvalue () const
 Return the size p-value of the itemset.
 Itemset (unsigned int size=0)
 Itemset (const Itemset &src)
virtual ~Itemset ()
virtual Itemsetoperator= (const Itemset &rhs)
virtual unsigned int & operator[] (unsigned int index)
virtual unsigned int operator[] (unsigned int index) const
virtual unsigned int operator< (const Itemset &rhs) const
virtual unsigned int getItem (unsigned int index) const
virtual void setItem (unsigned int index, unsigned int item)
virtual unsigned int getSize () const
virtual void clear ()
virtual bool isEmpty () const
virtual void insertBack (unsigned int item)
virtual void insertFront (unsigned int item)
virtual void removeBack ()
virtual void removeFront ()
unsigned int getBack () const
unsigned int getFront () const

Protected Attributes

vector< unsigned int > items

Friends

class Apriori
class AprioriWithComplement
ostream & operator<< (ostream &out, const Itemset &token)

Detailed Description

This class holds a set of items (column numbers)


Constructor & Destructor Documentation

Itemset::Itemset ( const Itemset src) [inline]

Copy constructor.

The copy constructor // // ------------------------------- Parameters ------------------------------- // const Itemset& src // The source Itemset //

Itemset::Itemset ( unsigned int  size = 0)

The constructor // // ------------------------------- Parameters ------------------------------- // unsigned int max // The maximum item in the itemset //

Itemset::~Itemset ( ) [virtual]

The destructor //


Member Function Documentation

void Itemset::clear ( ) [virtual]

Clears the itemset

bool Itemset::containsColumn ( unsigned int  index) const [inline]

Return true if and only if index is a column in the itemset.

Warning:
The method assumes that the invocant's column set has been computed using Itemset::_computeColumnSet().
bool Itemset::containsRows ( const Itemset other) const

Return true if and only if the rows in other are a subset of the rows in the invocant.

Note:
The method returns true when the two itemsets have identical sets of rows. To check if the rows in other are a proper subset of of the rows in the invocant, compare the number of rows in the two itemsets in the calling context.
bool Itemset::containsRows ( const set< unsigned int > &  otherRows) const

Return true if and only if the elements of otherRows are a subset of the rows in the invocant.

Note:
The method returns true when the row-set in the invocant is identical to otherRows. To check if elements of otherRows are a proper subset of of the rows in the invocant, compare the number of rows in the calling context.
unsigned int Itemset::getBack ( ) const

Gets the last item

--------------------------------- Return --------------------------------- The last item

unsigned int Itemset::getFront ( ) const

Gets the first item

--------------------------------- Return --------------------------------- The first item

unsigned int Itemset::getItem ( unsigned int  index) const [virtual]

Gets an item by index

------------------------------- Parameters ------------------------------- unsigned int index The index

--------------------------------- Return --------------------------------- The item at that index

unsigned int Itemset::getSize ( ) const [virtual]

Gets the size of the itemset

--------------------------------- Return --------------------------------- The size of the itemset

void Itemset::insertBack ( unsigned int  item) [virtual]

Inserts an item into the itemset

------------------------------- Parameters ------------------------------- unsigned int item The item

void Itemset::insertFront ( unsigned int  item) [virtual]

Inserts an item into the itemset

------------------------------- Parameters ------------------------------- unsigned int item The item

bool Itemset::isEmpty ( ) const [virtual]

Sees if the itemset is empty

--------------------------------- Return --------------------------------- true: the itemset is empty false: the itemset is not empty

unsigned int Itemset::operator< ( const Itemset rhs) const

The < operator

------------------------------- Parameters ------------------------------- const Itemset& rhs The right hand side

--------------------------------- Return --------------------------------- true: this itemset is less than the other itemset false: this itemset is not less than the other itemset

Itemset & Itemset::operator= ( const Itemset rhs) [inline]

The = operator

------------------------------- Parameters ------------------------------- const Itemset& rhs The right hand side

--------------------------------- Return --------------------------------- this

unsigned int & Itemset::operator[] ( unsigned int  index) [virtual]

We can use the [] operator to access items by index

------------------------------- Parameters ------------------------------- unsigned int index The index

--------------------------------- Return --------------------------------- A reference to the item at that index

unsigned int Itemset::operator[] ( unsigned int  index) const [virtual]

We can use the [] operator to access items by index

------------------------------- Parameters ------------------------------- unsigned int index The index

--------------------------------- Return --------------------------------- The item at that index

void Itemset::print ( ostream &  ostr,
unsigned int  itemsetnum 
) const

Print the itemset in "itemset" format to the output stream.

The itemset appears on one line containing the name of the itemset, the names of the rows in the itemset, and the names of the columns in the itemset, all separated by tabs. The name of the itemset is the string "itemset_<index>_<number of rows>_<number of columns>".

void Itemset::printGraph ( ostream &  ostr,
unsigned int  itemsetNum 
) const

Print the bipartite graph induced by the itemset to the output file.

Each line of the file contains the itemset name, a row name, and a column name, all separated by tabs. An itemset with m rows and n columns produces m*n lines.

void Itemset::removeBack ( ) [virtual]

Removes the back item

void Itemset::removeFront ( ) [virtual]

Removes the front item

void Itemset::setItem ( unsigned int  index,
unsigned int  item 
) [virtual]

Sets an item at that index

------------------------------- Parameters ------------------------------- unsigned int index The index unsigned int item The item to use for that index --------------------------------- Return --------------------------------- A pointer to the itemset at that index


Friends And Related Function Documentation

ostream& operator<< ( ostream &  out,
const Itemset token 
) [friend]

The << operator

------------------------------- Parameters ------------------------------- const Itemset& token The itemset to be written ostream &out The stream in which to write down

--------------------------------- Return --------------------------------- out


The documentation for this class was generated from the following files:
 All Classes Functions Variables Typedefs Friends