forked from jacyara/GenESyS-Reborn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Queue.cpp
70 lines (49 loc) · 1.38 KB
/
Queue.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
67
68
69
70
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Queue.cpp
* Author: cancian
*
* Created on 21 de Agosto de 2018, 17:12
*/
#include "Queue.h"
Queue::Queue() : ModelInfrastructure(Util::TypeOf<Queue>()) {
}
Queue::Queue(const Queue& orig) : ModelInfrastructure(orig) {
}
Queue::~Queue() {
}
std::string Queue::show() {
return ModelInfrastructure::show()+
",waiting="+this->_list->show();
}
void Queue::insertElement(Waiting* element) {
_list->insert(element);
this->_cstatNumberInQueue->getCollector()->addValue(_list->size());
}
void Queue::removeElement(Waiting* element, double tnow) {
_list->remove(element);
this->_cstatNumberInQueue->getCollector()->addValue(_list->size());
double timeInQueue = tnow - element->getTimeStartedWaiting();
this->_cstatTimeInQueue->getCollector()->addValue(timeInQueue);
}
unsigned int Queue::size() {
return _list->size();
}
Waiting* Queue::first() {
return _list->first();
}
//List<Waiting*>* Queue::getList() const {
// return _list;
//}
void Queue::_loadInstance(std::list<std::string> words) {
}
std::list<std::string>* Queue::_saveInstance() {
std::list<std::string>* words = new std::list<std::string>();
return words;
}
bool Queue::_verifySymbols(std::string* errorMessage) {
}