All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class COM.objectspace.jgl.Queue

java.lang.Object
   |
   +----COM.objectspace.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 remove(Enumeration)
Remove the element at a particular position.
 o remove(Enumeration, Enumeration)
Remove the elements in the specified range.
 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 synchronized void copy(Queue queue)
Become a shallow copy of a Queue.

Parameters:
queue - The Queue to be copied.
 o toString
 public synchronized 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 synchronized 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 synchronized int hashCode()
Return my hash code for support of hashing containers

Overrides:
hashCode in class Object
 o clone
 public synchronized 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 synchronized 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 synchronized Object front()
Return the object at my front.

Throws: InvalidOperationException
If the Queue is empty.
 o back
 public synchronized Object back()
Return the object at my back.

Throws: InvalidOperationException
If the Queue is empty.
 o add
 public synchronized 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 synchronized Object pop()
Remove an object from my front and return it.

Throws: InvalidOperationException
If the Queue is empty.
 o elements
 public synchronized Enumeration elements()
Return an Enumeration of my components.

 o start
 public synchronized ForwardIterator start()
Return an iterator positioned at my first item.

 o finish
 public synchronized ForwardIterator finish()
Return an iterator positioned immediately afer my last item.

 o swap
 public synchronized void swap(Queue queue)
Swap my contents with another Queue.

Parameters:
queue - The Queue that I will swap my contents with.
 o remove
 public Object remove(Enumeration pos)
Remove the element at a particular position.

Parameters:
pos - The enumeration representing of the object to remove.
Throws: InvalidOperationException
Thrown by default.
 o remove
 public int remove(Enumeration first,
                   Enumeration last)
Remove the elements in the specified range.

Parameters:
pos - The enumeration representing of the object to remove.
Throws: InvalidOperationException
Thrown by default.

All Packages  Class Hierarchy  This Package  Previous  Next  Index