-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathitemset.c
45 lines (37 loc) · 882 Bytes
/
itemset.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <stdio.h>
#include <errno.h>
#include "itemset.h"
// the constructor
Itemset::Itemset(int list_sz){
theitemset = new List<int>;
if ( theitemset == NULL){
perror ("memory::Itemset");
exit(errno);
}
thetidlist = new Array(list_sz);
if (thetidlist == NULL){
perror ("memory::Itemset");
exit(errno);
}
thesupport = 0;
}
// the destructor
Itemset::~Itemset()
{
if (theitemset) delete theitemset;
if (thetidlist) delete thetidlist;
theitemset = NULL;
thetidlist = NULL;
thesupport = 0;
}
ostream &operator << (ostream &outputStream, Itemset &thitemset)
{
outputStream << "ISET: ";
//output << theitemset -> print() << " ";
outputStream << *thitemset.itemset() << " ";
outputStream << "SUP: ";
outputStream << thitemset.thesupport<< " ";
//outputStream << "\n";
return outputStream;
}