public class CheckoutLine extends Object
Constructor and Description |
---|
CheckoutLine()
Create a checkout line having an empty queue of customers.
|
Modifier and Type | Method and Description |
---|---|
void |
addCustomer(Customer c)
Add a customer to the back of the line.
|
Customer |
getCurrentCustomer()
Returns a reference to the customer currently at the front of the line
without removing the customer from the line.
|
List<Customer> |
getCustomersAsList()
Returns a list of this checkout line's queue of customers.
|
int |
getNumberOfCustomers()
Returns the number of customers in the checkout line.
|
boolean |
hasCustomers()
Returns true if there are customers in the checkout line , and false
otherwise.
|
Queue<Customer> |
update(double currentTime)
Process as many customers as possible starting from the front of the queue
given the current simulation time
currentTime . |
public CheckoutLine()
public boolean hasCustomers()
public int getNumberOfCustomers()
public Customer getCurrentCustomer()
public void addCustomer(Customer c)
c
- the customer to add to the back of the linepublic List<Customer> getCustomersAsList()
public Queue<Customer> update(double currentTime)
currentTime
.
The default behaviour is to dequeue the first customer from the front of the line ignoring the time. Subclasses should override this method to process customers in the line given the current time.
currentTime
- the current time in seconds of the simulation