-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEvent.cpp
56 lines (40 loc) · 1011 Bytes
/
Event.cpp
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
#include "Event.h"
Event::Event(string type, float time, int hackerId, int data) { //constructor
this->type = type;
this->time = time;
this->data=data;
this->hackerId=hackerId;
}
Event::Event(Event& event) { //copy counstructor
this->type = event.type;
this->time = event.time;
this->hackerId=event.hackerId;
this->data=event.data;
}
Event& Event::operator=(const Event& event) { //assignment operator
if (this == &event) {
return *this;
}
this->type = event.type;
this->time = event.time;
this->hackerId=event.hackerId;
this->data=event.data;
return *this;
}
bool Event::operator<(const Event& other) { //overriding "<" operator
if(this->time - other.time > 0.00001){ //this is larger
return true;
} else { //equal or smaller
if(abs(this->time - other.time) < 0.00001){ //equal
if(this->hackerId > other.hackerId){ //this id büyük, küçük istiyoruz
return true;
}else {
return false;
}
} else {
return false;
}
}
}
Event::~Event() {
}