Class WaitingLine

java.lang.Object
  extended by WaitingLine

public class WaitingLine
extends java.lang.Object

Class for simulation FIFO waiting line (queue). A waiting line has two associated statistics, a WeightedStatistic for line length, and a Statistic for waiting time.
COMP 2100
Project 3
October 2014


Constructor Summary
WaitingLine(java.lang.String name)
          Creates new WaitingLine that is empty.
 
Method Summary
 void enter(Customer c)
          Place customer into the line.
 Statistic getLineLengthStat()
          Retrieve WeightedStatistic for line length
 java.lang.String getName()
          Retrieve name given to this waiting line
 Statistic getWaitTimeStat()
          Retrieve Statistic for waiting time
 boolean isEmpty()
          Reports whether any customers are waiting in line
 Customer leave()
          Removes a customer from the front of the line
 int length()
          Determine how many customers are waiting in line
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WaitingLine

public WaitingLine(java.lang.String name)
Creates new WaitingLine that is empty.

Parameters:
name - Descriptive name for this line
Method Detail

isEmpty

public boolean isEmpty()
Reports whether any customers are waiting in line

Returns:
true if line is empty and false otherwise

length

public int length()
Determine how many customers are waiting in line

Returns:
Number of customers waiting in line.

getName

public java.lang.String getName()
Retrieve name given to this waiting line

Returns:
String containing waiting line's name

getWaitTimeStat

public Statistic getWaitTimeStat()
Retrieve Statistic for waiting time

Returns:
Statistic object for waiting time

getLineLengthStat

public Statistic getLineLengthStat()
Retrieve WeightedStatistic for line length

Returns:
WeightedStatistic object for line length

enter

public void enter(Customer c)
Place customer into the line.

Parameters:
c - the customer

leave

public Customer leave()
Removes a customer from the front of the line

Returns:
the customer, or null if line is empty