-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEvent.java
executable file
·59 lines (53 loc) · 1.63 KB
/
Event.java
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
// event representation
class Event implements Comparable<Object> {
public Event(int a_type, double a_time) { _type = a_type; time = a_time; setFirstDelay(0); setSecondDelay(0);setServiceTime(0);setResponse1(0); setResponse2(0); }
public double time;
private int _type;
private double firstDelay; //First delay of a caller
private double secondDelay; //Second delay of a caller
private double serviceTime; //Service time taken by a caller
private double response1; //First response time of a caller
private double response2; //Second response time of a caller
public int get_type() { return _type; }
public double get_time() { return time; }
public Event leftlink, rightlink, uplink;
public int compareTo(Object _cmpEvent ) {
double _cmp_time = ((Event) _cmpEvent).get_time() ;
if( this.time < _cmp_time) return -1;
if( this.time == _cmp_time) return 0;
return 1;
}
/**
* Every functions below does the job what their names tell
*/
public double getFirstDelay() {
return firstDelay;
}
public void setFirstDelay(double firstDelay) {
this.firstDelay = firstDelay;
}
public double getTotalDelay() {
return secondDelay+firstDelay;
}
public void setSecondDelay(double secondDelay) {
this.secondDelay = secondDelay;
}
public double getServiceTime() {
return serviceTime;
}
public void setServiceTime(double serviceTime) {
this.serviceTime = serviceTime;
}
public void setResponse1(double response1) {
this.response1 = response1;
}
public double getTotalResponse() {
return response2 + response1;
}
public void setResponse2(double response2) {
this.response2 = response2;
}
public double getResponse1() {
return response1;
}
};