Class jgl.Queue
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jgl.Queue

java.lang.Object
   |
   +----jgl.Queue

public class Queue
extends Object
implements Container
A Queue is an adapter that allows you to use any Sequence as a first-in, first-out data structure. By default, a Queue uses an SList.

See Also:
Sequence, SList, QueueExamples

Constructor Index

 o Queue()
Construct myself to be an empty Queue.
 o Queue(Queue)
Construct myself to be a shallow copy of a specified Queue.
 o Queue(Sequence)
Construct myself with a specified Sequence as my underlying implementation.

Method Index

 o add(Object)
Add an object to my back.
 o back()
Return the object at my back.
 o clear()
Remove all of my objects.
 o clone()
Return a shallow copy of myself.
 o copy(Queue)
Become a shallow copy of a Queue.
 o elements()
Return an Enumeration of my components.
 o equals(Object)
Return true if object is a Queue whose underlying sequence is equal to mine.
 o equals(Queue)
Return true if a Queue's sequence is equal to mine.
 o finish()
Return an iterator positioned immediately afer my last item.
 o front()
Return the object at my front.
 o hashCode()
Return my hash code for support of hashing containers
 o isEmpty()
Return true if I contain no objects.
 o maxSize()
Return the maximum number of objects that I can contain.
 o pop()
Remove an object from my front and return it.
 o push(Object)
Add an object to my back.
 o size()
Return the number of objects that I contain.
 o start()
Return an iterator positioned at my first item.
 o swap(Queue)
Swap my contents with another Queue.
 o toString()
Return a string that describes me.

Constructors

 o Queue
  public Queue()
Construct myself to be an empty Queue. Use an SList for my underlying implementation.
 o Queue
  public Queue(Sequence sequence)
Construct myself with a specified Sequence as my underlying implementation.
Parameters:
sequence - The empty Sequence to be used for my implementation.
 o Queue
  public Queue(Queue queue)
Construct myself to be a shallow copy of a specified Queue.
Parameters:
queue - The Queue to be copied.

Methods

 o copy
  public void copy(Queue queue)
Become a shallow copy of a Queue.
Parameters:
queue - The Queue to be copied.
 o toString
  public String toString()
Return a string that describes me.
Overrides:
toString in class Object
 o equals
  public boolean equals(Object object)
Return true if object is a Queue whose underlying sequence is equal to mine.
Parameters:
object - Any object.
Overrides:
equals in class Object
 o equals
  public boolean equals(Queue queue)
Return true if a Queue's sequence is equal to mine.
Parameters:
queue - The Queue to compare myself against.
 o hashCode
  public int hashCode()
Return my hash code for support of hashing containers
Overrides:
hashCode in class Object
 o clone
  public Object clone()
Return a shallow copy of myself. A shallow copy is made of my underlying sequence.
Overrides:
clone in class Object
 o clear
  public void clear()
Remove all of my objects.
 o isEmpty
  public boolean isEmpty()
Return true if I contain no objects.
 o size
  public int size()
Return the number of objects that I contain.
 o maxSize
  public int maxSize()
Return the maximum number of objects that I can contain.
 o front
  public Object front()
Return the object at my front.
Throws: InvalidOperationException
If the Queue is empty.
 o back
  public Object back()
Return the object at my back.
Throws: InvalidOperationException
If the Queue is empty.
 o add
  public Object add(Object object)
Add an object to my back.
Parameters:
object - The object to add.
 o push
  public void push(Object object)
Add an object to my back.
 o pop
  public Object pop()
Remove an object from my front and return it.
Throws: InvalidOperationException
If the Queue is empty.
 o elements
  public Enumeration elements()
Return an Enumeration of my components.
 o start
  public ForwardIterator start()
Return an iterator positioned at my first item.
 o finish
  public ForwardIterator finish()
Return an iterator positioned immediately afer my last item.
 o swap
  public void swap(Queue queue)
Swap my contents with another Queue.
Parameters:
queue - The Queue that I will swap my contents with.

All Packages  Class Hierarchy  This Package  Previous  Next  Index