-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServer.java
More file actions
42 lines (35 loc) · 1008 Bytes
/
Server.java
File metadata and controls
42 lines (35 loc) · 1008 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
36
37
38
39
40
41
42
class Server {
private final int id;
private final double timeServingTill;
private final Customer customer;
Server(int id, double timeServingTill) {
this.id = id;
this.timeServingTill = timeServingTill;
this.customer = new Customer(0.0, 0.0, -1);
}
Server(int id, double timeServingTill, Customer customer) {
this.id = id;
this.timeServingTill = timeServingTill;
this.customer = customer;
}
public Customer getCustomer() {
return this.customer;
}
public double getServerTimeServingTill() {
return this.timeServingTill;
}
public int getServerId() {
return this.id;
}
public boolean serverIsBusy(Customer customer, double timeNow) {
if (this.timeServingTill <= timeNow) {
return false;
} else {
return true;
}
}
@Override
public String toString() {
return "Server serving until " + timeServingTill;
}
}