-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvent.java
More file actions
69 lines (56 loc) · 1.4 KB
/
Copy pathEvent.java
File metadata and controls
69 lines (56 loc) · 1.4 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
class Event implements Comparable<Event> {
protected final Customer customer;
protected final double time;
Event(Customer customer, double time) {
this.customer = customer;
this.time = time;
}
public Customer getCust() {
return this.customer;
}
public double getTime() {
return this.time;
}
public Pair<Server, Event> nextEvent(Server server) {
return new Pair<Server, Event>(server, this);
}
public Event updateEvent() {
return this;
}
public boolean haveNext() {
return false;
}
public int numServed() {
return 0;
}
public double addWaitTime() {
return 0;
}
public double minusWaitTime() {
return 0;
}
public int numLeft() {
return 0;
}
@Override
public int compareTo(Event event) { //compare customer events
double diffCustID = this.customer.getCustID() - event.customer.getCustID();
double diffTime = this.getTime() - event.getTime();
if (diffTime < 0) {
return -1;
} else if (diffTime > 0) {
return 1;
} else if (diffTime == 0) {
if (diffCustID < 0) {
return -1;
} else {
return 1;
}
}
return 0;
}
@Override
public String toString() {
return "";
}
}