-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSurgery.cpp
66 lines (55 loc) · 1.05 KB
/
Surgery.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
55
56
57
58
59
60
61
62
63
64
65
66
//
// Created by quartie on 2018-05-10.
//
#include "Surgery.h"
#include <utility>
Surgery::Surgery(int id, int duration, std::string label)
{
this->id = id;
this->duration = duration;
this->label = std::move(label);
planned = false;
}
Surgery::~Surgery()
= default;
int Surgery::getId() const
{
return id;
}
int Surgery::getDuration() const
{
return duration;
}
std::string Surgery::getLabel() const
{
return label;
}
bool Surgery::schedule()
{
bool succeed = false;
if(!planned)
{
planned = true;
succeed = true;
}
return succeed;
}
bool Surgery::isScheduled() const
{
return planned;
}
bool Surgery::operator>(const Surgery &source)
{
return (duration > source.getDuration());
}
bool Surgery::operator<(const Surgery &source)
{
return (duration < source.getDuration());
}
std::ostream &operator<<(std::ostream &out, const Surgery &source)
{
out << "ID: " << source.getId();
out << " Label: " << source.getLabel();
out << " Duration: " << source.getDuration();
return out;
}