-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodes.cpp
40 lines (32 loc) · 862 Bytes
/
modes.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
#include "modes.h"
Mode waitingForWork("waitingForWork", "wait", "work", 0);
Mode working("working", "action", "work", 25);
Mode waitingForRelax("waitingForRelax", "wait", "relax", 0);
Mode relaxing("relaxing", "action", "relax", 5);
Modes::Modes() {
waitingForWork.set_next(&working);
working.set_next(&waitingForRelax);
waitingForRelax.set_next(&relaxing);
relaxing.set_next(&waitingForWork);
this->current = &waitingForWork;
}
void Modes::advance() {
current = current->next;
}
void Modes::set_current(String mode_name) {
while(current->name != mode_name) {
advance();
}
}
String Modes::get_name() {
return current->name;
}
long Modes::get_time_limit() {
return current->time_limit;
}
boolean Modes::is_action_type() {
return current->type == "action";
}
boolean Modes::is_work_stage() {
return current->stage == "work";
}