m865.simulation
Class BalkingQueue

java.lang.Object
  extended by m865.simulation.BalkingQueue

public class BalkingQueue
extends java.lang.Object

Write a description of class BalkingQueue here.


Constructor Summary
BalkingQueue()
          Constructor for objects of class BalkingQueue
 
Method Summary
 Passenger dequeue()
          The dequeue method
 void enqueue(Passenger p)
          The enqueue method
 boolean isEmpty()
          The isEmpty method
static void main(java.lang.String[] args)
          This main method tests the BalkingQueue
 Passenger peek()
          The peek method
 boolean remove(Passenger p)
          Removes the specified passenger from this balking queue.
 int size()
          The size method
 java.lang.String toString()
          List the objects in the queue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BalkingQueue

public BalkingQueue()
Constructor for objects of class BalkingQueue

Method Detail

enqueue

public void enqueue(Passenger p)
The enqueue method

Parameters:
p - The passenger to be added to the queue

dequeue

public Passenger dequeue()
The dequeue method

Returns:
p The passenger from the front of the queue The value is null if the queue is empty.

peek

public Passenger peek()
The peek method

Returns:
p A copy of the passenger from the front of the queue The value is null if the queue is empty.

isEmpty

public boolean isEmpty()
The isEmpty method

Returns:
true if the queue is empty and false if not

size

public int size()
The size method

Returns:
The number of passengers in the queue

remove

public boolean remove(Passenger p)
Removes the specified passenger from this balking queue.

Parameters:
p - the specified passenger to be removed
Returns:
true if the passenger is found in the queue

toString

public java.lang.String toString()
List the objects in the queue

Overrides:
toString in class java.lang.Object
Returns:
a formatted string listing the objects in this queue

main

public static void main(java.lang.String[] args)
This main method tests the BalkingQueue