-
Notifications
You must be signed in to change notification settings - Fork 0
/
FF_Bin.h
66 lines (55 loc) · 1.37 KB
/
FF_Bin.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
#include <iostream>
#include <iomanip>
class FF_Bin // adapted from the slide lecture
{
private:
int index;
double rc; // remaining capacity
double brc; // best remaining capacity
public:
FF_Bin() = default;
FF_Bin(const FF_Bin& other)
{
index = other.index;
rc = other.rc;
brc = other.brc;
}
FF_Bin(int index, double rc, double brc)
{
this->index = index;
this->rc = rc;
this->brc = brc;
}
double get_RC() const
{
return rc;
}
double get_BRC() const
{
return brc;
}
int get_index() const
{
return index;
}
bool operator<(const FF_Bin& other) const
{
return (index < other.index) ;
}
bool operator>(const FF_Bin &other) const
{
return (index > other.index) ;
}
void set_RC(double new_rc)
{
this->rc = new_rc;
}
void set_BRC(double new_brc)
{
this->brc = new_brc;
}
void print() {
std::cout << std::fixed << index << " " << rc << " " << brc;
}
~FF_Bin(){}
};