forked from kuraczak/symulacja
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDiagram.cpp
79 lines (63 loc) · 1.16 KB
/
Diagram.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
71
72
73
74
75
76
77
78
79
/*
* Diagram.cpp
*
* Created on: 28 gru 2017
* Author: kuraczak
*/
#include "Diagram.h"
Diagram::Diagram() {
// TODO Auto-generated constructor stub
}
Diagram::~Diagram() {
// TODO Auto-generated destructor stub
}
Sender & Diagram::getRefToSender(int id){
int i=0;
for(Ramp send:ramps){
if(send.getId()==id){
break;
return ramps.at(i);
}
i++;
}
i=0;
for(Worker work:workers){
if(work.id==id){
break;
}
i++;
}
if(i!=0)
return ramps.at(i);
};
Receiver & Diagram::getRefToReceiver(int id){
int i=0;
for(Storehouse store:storehouses){
if(store.getId()==id){
break;
return storehouses.at(i);
}
i++;
}
i=0;
for(Worker work:workers){
if(work.id==id){
break;
}
i++;
}
};
bool Diagram::add_worker(int id, QUEUE_TYPE queue, int time){
workers.push_back(Worker(id,queue,time));
return true;
};
bool Diagram::add_store(int id){
storehouses.push_back(Storehouse(id));
return true;
};
bool Diagram::add_ramp(int id, int delivery_interval){
ramps.push_back(Ramp(id,delivery_interval));
return true;
};
bool Diagram::add_link(TYPE s_type, int s_id, TYPE r_type, int r_id, float prob){
};