This commit is contained in:
Yadunand Prem 2022-09-06 12:18:44 +08:00
parent ae8e984866
commit f1826044a7
2 changed files with 7 additions and 2 deletions

View File

@ -25,7 +25,7 @@ class ArrivalEvent extends Event {
// check if counters are available. If none, push customer to queue if not full.
// If full, customer departs
if (availableCounter == null) {
if (this.shop.getQueue().isFull()) {
if (this.shop.isQueueFull()) {
return new Event[] { new DepartureEvent(this.getTime(), customer, shop) };
}
Queue queue = this.shop.getQueue();

View File

@ -35,6 +35,11 @@ public class Shop {
}
public Queue getQueue() {
return queue;
return this.queue;
}
public boolean isQueueFull() {
return this.queue.isFull();
}
}