-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvent.java
More file actions
47 lines (38 loc) · 1.08 KB
/
Event.java
File metadata and controls
47 lines (38 loc) · 1.08 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
class Event implements Comparable<Event> {
protected final double time;
protected final Customer customer;
Event(double time, Customer customer) {
this.time = time;
this.customer = customer;
}
public boolean hasNextEvent() {
return false;
}
public int updateNumServed(int numServed) {
return numServed;
}
public int updateNumLeft(int numLeft) {
return numLeft;
}
public double updateTotalWaitingTime(double totalWaitingTime) {
return totalWaitingTime;
}
public ImList<Server> updateServerList(ImList<Server> serverList) {
return serverList;
}
public Event nextEvent(ImList<Server> serverList) {
return this;
}
public int compareTo(Event other) {
if (this.time > other.time) {
return 1;
} else if (this.time == other.time) {
return this.customer.compareTo(other.customer);
} else {
return -1;
}
}
public String toString() {
return String.format("%.3f ", time) + this.customer;
}
}