feat: update structure
This commit is contained in:
24
cs2030s/labs/Lab1/JoinShopQueueEvent.java
Normal file
24
cs2030s/labs/Lab1/JoinShopQueueEvent.java
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
class JoinShopQueueEvent extends Event {
|
||||
private Customer customer;
|
||||
private Shop shop;
|
||||
|
||||
public JoinShopQueueEvent(Customer customer, Shop shop) {
|
||||
super(customer.getArrivalTIme());
|
||||
this.customer = customer;
|
||||
this.shop = shop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event[] simulate() {
|
||||
this.shop.joinQueue(customer);
|
||||
return new Event[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s: %s joined shop queue %s",
|
||||
super.toString(),
|
||||
this.customer, this.shop);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user