-
Notifications
You must be signed in to change notification settings - Fork 2
/
ExceptionList.h
75 lines (59 loc) · 1.32 KB
/
ExceptionList.h
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* Copyright (c) Hilmi Yildirim 2010,2011.
The software is provided on an as is basis for research purposes.
There is no additional support offered, nor are the author(s)
or their institutions liable under any circumstances.
*/
#ifndef _EXCEPTION_LIST_H
#define _EXCEPTION_LIST_H
#include <unordered_set>
using namespace std;
class ExceptionList{
public:
int size;
unordered_set<int> * lists;
bool LEVEL_FILTER;
public :
ExceptionList(){
}
~ExceptionList(){
delete[] lists;
}
void set_level_filter(bool lf){
LEVEL_FILTER = lf;
}
void printExceptions(){
unordered_set<int>::iterator siter;
for(int node= 0 ; node < size ; node++){
cout << node << " :";
for(siter=lists[node].begin(); siter!=lists[node].end();siter++)
cout << " " << *siter;
cout << endl;
}
}
virtual bool isAnException(int src, int dest){
return lists[src].find(dest) != lists[src].end();
//return xlists[src].find(dest) != xlists[src].end();
}
int getSize(){
int i,count=0;
for(i=0;i<size;i++){
count += lists[i].size();
}
return count;
}
void printStats(){
int i,count=0;
for(i=0;i<size;i++){
count += lists[i].size();
}
cout << " Total Number of Exceptions : " << count << endl;
}
int Size(){
int i,count=0;
for(i=0;i<size;i++){
count += lists[i].size();
}
return count;
}
};
#endif