-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHangup.java
More file actions
76 lines (63 loc) · 1.69 KB
/
Hangup.java
File metadata and controls
76 lines (63 loc) · 1.69 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
72
73
74
75
package simModel;
import simulationModelling.ExtSequelActivity;
public class Hangup extends ExtSequelActivity {
Call icCall;
SMTravel model;
public Hangup(Call icCall,SMTravel model) {
this.icCall = icCall;
this.model = model;
}
@Override
protected double duration() {
return model.rvp.uHangupTime(icCall.uType);
}
@Override
public void startingEvent() {
switch(icCall.uType) {
case Constants.REGULAR:
super.name = "from Regular call";
break;
case Constants.SILVER:
super.name = "from Silver call";
break;
case Constants.GOLD:
super.name = "from Gold call";
break;
default:
super.name = "Invalid type of call"; // This should not happen... like ever.
}
icCall.uStartWaitTime = model.getClock();
model.qPhoneSystem.list.add(icCall);
//System.out.println("insertion time: " + model.getClock());
//System.out.print(model.rgOperators[0].schedule[0]);
}
@Override
protected void terminatingEvent() {
model.qPhoneSystem.list.remove(icCall);
if(model.udp.userWaitedTooLong(icCall.uType, model.getClock()-icCall.uStartWaitTime)){
model.udp.incLongWait(icCall);
}
model.qPhoneSystem.numOfCalls--;
}
@Override
public int interruptionPreCond() {
if(model.udp.canServiceCall(icCall)){
//System.err.println("BYE");
return 1;
} else {
return 0;
}
}
@Override
public void interruptionSCS(int arg0) {
if(arg0 == 1) {
model.qPhoneSystem.list.remove(icCall);
//model.output.beingSed++;
if(model.udp.userWaitedTooLong(icCall.uType, model.getClock()-icCall.uStartWaitTime)){
model.udp.incLongWait(icCall);
}
ServiceCall serviceCall = new ServiceCall(icCall,model);
model.spStart(serviceCall);
}
}
}