-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmergencyArrivals.java
More file actions
73 lines (52 loc) · 1.37 KB
/
Copy pathEmergencyArrivals.java
File metadata and controls
73 lines (52 loc) · 1.37 KB
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
package HealthCareSystem;
import java.lang.*;
import genDevs.modeling.*;
import genDevs.simulation.*;
import GenCol.*;
import util.*;
import simView.*;
import statistics.*;
public class EmergencyArrivals extends ViewableAtomic{
protected double int_arr_time;
protected int count;
protected rand r = null;
public EmergencyArrivals() {
this("Emergency Arrivals ",10);
}
public EmergencyArrivals(String nm, double int_arr_time){
super(nm);
addInport("stop");
addInport("start");
addOutport("out");
this.int_arr_time = int_arr_time;
addTestInput("start",new entity(""),0);
addTestInput("stop",new entity(""),0);
r = new rand(1);
initialize();
}
public void initialize(){
if (r != null)
holdIn("active",r.uniform(int_arr_time));
count = 0;
super.initialize();
}
public void deltext(double e,message x){
Continue(e);
if (somethingOnPort(x,"start"))
holdIn("active",r.expon(int_arr_time));
if (somethingOnPort(x,"stop"))
passivate();
}
public void deltint() {
if(phaseIs("active")){
count = count +1;
holdIn("active",r.uniform(int_arr_time));
}
}
public message out() {
message m = new message();
content con = makeContent("out", new entity ("Patient" + count));
m.add(con);
return m;
}
}// end of class depGenerator