-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lift.h
93 lines (86 loc) · 2.09 KB
/
Lift.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef LIFT_HPP
#define LIFT_HPP
#include <iostream>
#include <string>
#include "Button.h"
#include "Building.h"
#include "Floor.h"
using namespace std;
enum class Direction { Up, Down, StandBy };
class Lift{
public:
Lift(Button *floorButtons, string currentFloor, int maxWeight, int doorTimerInSeconds, Building building){
this->floorButtons = floorButtons;
this->currentFloor = currentFloor;
this->currentDirection = static_cast<int>(Direction::StandBy);
this->isDoorOpen = false;
this->stopsQueue = new string[0];
this->futureQueue = new string[0];
this->maxWeight = maxWeight;
this->currentWeight = 0;
this->isOverWeight = false;
this->doorTimerInSeconds = doorTimerInSeconds;
this->building = building;
}
Button* getFloorButtons() {
return this->floorButtons;
}
string getCurrentFloor() {
return this->currentFloor;
}
int getCurrentDirection() {
return this->currentDirection;
}
bool getIsDoorOpen() {
return this->isDoorOpen;
}
string* getStopsQueue() {
return this->stopsQueue;
}
string* getFutureQueue() {
return this->futureQueue;
}
int getMaxWeight() {
return this->maxWeight;
}
bool getIsOverWeight() {
return this->isOverWeight;
}
int getDoorTimerInSeconds() {
return this->doorTimerInSeconds;
}
Building getBuilding() {
return this->building;
}
void setCurrentFloor(string currentFloor){
this->currentFloor = currentFloor;
}
void setCurrentDirection(int currentDirection){
this->currentDirection = currentDirection;
}
void setIsDoorOpen(bool isDoorOpen){
this->isDoorOpen = isDoorOpen;
}
void setCurrentWeight(int currentWeight){
this->currentWeight = currentWeight;
if(this->currentWeight >= this->maxWeight){
this->isOverWeight = true;
}
else {
this->isOverWeight = false;
}
}
private:
Button *floorButtons;
string currentFloor;
int currentDirection;
bool isDoorOpen;
string *stopsQueue;
string *futureQueue;
int maxWeight;
int currentWeight;
bool isOverWeight;
int doorTimerInSeconds;
Building building;
};
#endif