-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListNode.cpp
More file actions
72 lines (69 loc) · 1.45 KB
/
ListNode.cpp
File metadata and controls
72 lines (69 loc) · 1.45 KB
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
//
// ListNode.cpp
// ListMiner
//
// Created by Chenhao Liu on 11/29/12.
// Copyright (c) 2012 Chenhao Liu. All rights reserved.
//
#include "ListNode.h"
#include "Graph.h"
ListNode::ListNode(){
start=-1,end=-1,support=0,G=new Graph();
}
ListNode::ListNode(const int s,const int e,const int spt,const Graph* g):start(s),end(e),support(spt){
G=new Graph(*g);
}
ListNode::ListNode(const ListNode& node){
start=node.getStart();
end=node.getEnd();
support=node.getSupport();
G=new Graph(*node.getGraph());
}
int ListNode::getStart() const{
return start;
}
void ListNode::setStart(int s){
start=s;
}
int ListNode::getEnd() const{
return end;
}
void ListNode::setEnd(int e){
end=e;
}
int ListNode::getSupport() const{
return support;
}
void ListNode::setSupport(int s){
support=s;
}
Graph* ListNode::getGraph() const{
return G;
}
void ListNode::setGraph(const Graph& g){
if (G) {
delete G;
}
G=new Graph(g);
}
void ListNode::operator=(const ListNode& node){
start=node.getStart();
end=node.getEnd();
support=node.getSupport();
G=new Graph(*node.getGraph());
}
bool ListNode::operator==(const ListNode& node) const{
if (start!=node.getStart()) {
return false;
}
if(end!=node.getEnd()){
return false;
}
if (support!=node.getSupport()) {
return false;
}
return (*G)==(*node.getGraph());
}
void ListNode::incrementSupport(){
++support;
}