feat: bring to working state
This commit is contained in:
parent
b33ff933ec
commit
82920fcbc6
@ -31,7 +31,9 @@ class ArrivalEvent extends Event {
|
||||
// if no counters available, check if queue slots avialable in counters
|
||||
availableCounter = this.shop.findCounterWithQueue();
|
||||
if (availableCounter != null) {
|
||||
return new Event[] { new JoinCounterQueueEvent(this.getTime(), this.customer, this.shop, availableCounter) };
|
||||
return new Event[] {
|
||||
new JoinCounterQueueEvent(this.getTime(), this.customer, availableCounter)
|
||||
};
|
||||
}
|
||||
// if shop queue isn't empty, join shop queue
|
||||
if (!this.shop.isQueueFull()) {
|
||||
@ -43,9 +45,6 @@ class ArrivalEvent extends Event {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s: %s arrived %s",
|
||||
super.toString(),
|
||||
this.customer,
|
||||
this.shop.queueString());
|
||||
return String.format("%s: %s arrived %s", super.toString(), this.customer, this.shop);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,11 @@
|
||||
public class JoinCounterQueueEvent extends Event {
|
||||
private Customer customer;
|
||||
private Shop shop;
|
||||
private ServiceCounter counter;
|
||||
|
||||
public JoinCounterQueueEvent(double time, Customer customer, Shop shop, ServiceCounter counter) {
|
||||
public JoinCounterQueueEvent(double time, Customer customer, ServiceCounter counter) {
|
||||
super(time);
|
||||
this.customer = customer;
|
||||
this.shop = shop;
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,6 +19,6 @@ class JoinShopQueueEvent extends Event {
|
||||
public String toString() {
|
||||
return String.format("%s: %s joined shop queue %s",
|
||||
super.toString(),
|
||||
this.customer, this.shop.queueString());
|
||||
this.customer, this.shop);
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class ServiceEndEvent extends Event {
|
||||
return new Event[] {
|
||||
new DepartureEvent(this.getTime(), this.customer),
|
||||
new ServiceBeginEvent(this.getTime(), serviceCustomer, this.shop, this.counter),
|
||||
new JoinCounterQueueEvent(this.getTime(), this.shop.leaveQueue(), this.shop, counter)
|
||||
new JoinCounterQueueEvent(this.getTime(), this.shop.leaveQueue(), counter)
|
||||
};
|
||||
}
|
||||
return new Event[] {
|
||||
|
Loading…
Reference in New Issue
Block a user