-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomer.java
More file actions
35 lines (28 loc) · 962 Bytes
/
Customer.java
File metadata and controls
35 lines (28 loc) · 962 Bytes
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
import java.util.function.Supplier;
class Customer implements Comparable<Customer> {
private final int id;
private final double arrivalTime;
private final double waitingTime;
private final Supplier<Double> serviceTime;
Customer(int id, double arrivalTime, double waitingTime, Supplier<Double> serviceTime) {
this.id = id;
this.arrivalTime = arrivalTime;
this.waitingTime = waitingTime;
this.serviceTime = serviceTime;
}
public Customer updateWaitingTime(double waitingTime) {
return new Customer(this.id, this.arrivalTime, waitingTime, this.serviceTime);
}
public double getWaitingTime() {
return waitingTime;
}
public double getServiceTime() {
return this.serviceTime.get();
}
public int compareTo(Customer other) {
return this.id - other.id;
}
public String toString() {
return String.format("%s ", this.id);
}
}