-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsleepingtask.cpp
More file actions
44 lines (36 loc) · 795 Bytes
/
Copy pathsleepingtask.cpp
File metadata and controls
44 lines (36 loc) · 795 Bytes
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
#include "sleepingtask.h"
#include <QGuiApplication>
SleepingTask::SleepingTask(TaskControlBlock *task, int duration)
{
this->task = task;
this->duration = duration;
this->elepsedTime = 0;
}
void SleepingTask::runTime()
{
if (this->elepsedTime >= this->duration) {
qDebug() << "Essa tarefa ja deveria ter acordado";
return;
}
this->elepsedTime++;
}
void SleepingTask::undoRunTime()
{
if (this->elepsedTime < 0) {
qDebug() << "Essa tarefa ja esta no inicio do spleeping";
return;
}
this->elepsedTime--;
}
bool SleepingTask::hasFinish()
{
return this->duration == this->elepsedTime;
}
int SleepingTask::getDuration()
{
return this->duration;
}
TaskControlBlock *SleepingTask::getTask()
{
return this->task;
}