java::util::Queue Class Reference

Inheritance diagram for java::util::Queue:

Inheritance graph
java::util::ListQueuejava::util::PriorityQueuejava::lang::Interfacejava::lang::Object
[legend]
Collaboration diagram for java::util::Queue:

Collaboration graph
java::lang::Interfacejava::lang::Object
[legend]

List of all members.


Detailed Description

The Queue interface represents a first-in-first-out (FIFO) queue of objects.

The usual enqueue and dequeue operations are provided, as well as a method to peek at the head item on the queue, a method to test for whether the queue isEmpty, and a method to search the queue for an item and discover how far it is from the head.

Author:
Yuh-Jye Chang
Version:
1.25, 12/03/01
Since:
DK1.0

Public Member Functions

virtual jint size () const =0
 The size of this queue.
virtual jboolean isEmpty () const =0
 Tests if this queue is empty.
virtual ObjectRef enqueue (const ObjectRef &item)=0
 Pushes an item onto the tail of this queue.
virtual ObjectRef dequeue ()=0
 Removes the object at the head of this queue and returns that object as the value of this function.
virtual ObjectRef requeue ()=0
 Removes the head object then pushes it onto the tail of this queue.
virtual ObjectRef head () const =0
 Looks at the object at the head of this queue without removing it from the queue.
virtual jint search (const ObjectRef &o) const =0
 Returns the 1-based position where an object is on this queue.
virtual void clear ()=0
 Removes all elements from the queue.
virtual Ref< ListgetInternalList () const =0
 return the internal list implementation

Static Public Member Functions

static Ref< QueuesynchronizedQueue (const Ref< Queue > &c, const Ref< Sync > &sync=0)
 Returns a synchronized (thread-safe) queue backed by the specified queue.

Member Function Documentation

static Ref<Queue> java::util::Queue::synchronizedQueue ( const Ref< Queue > &  c,
const Ref< Sync > &  sync = 0 
) [static]

Returns a synchronized (thread-safe) queue backed by the specified queue.

In order to guarantee serial access, it is critical that all access to the backing queue is accomplished through the returned queue.

Parameters:
c the queue to be "wrapped" in a synchronized queue.
Returns:
a synchronized view of the specified queue.

virtual jint java::util::Queue::size (  )  const [pure virtual]

The size of this queue.

Returns:
the number of objects in this queue.

Implemented in java::util::ListQueue, and java::util::PriorityQueue.

virtual jboolean java::util::Queue::isEmpty (  )  const [pure virtual]

Tests if this queue is empty.

Returns:
true if and only if this queue contains no items; false otherwise.

Implemented in java::util::ListQueue, and java::util::PriorityQueue.

virtual ObjectRef java::util::Queue::enqueue ( const ObjectRef item  )  [pure virtual]

Pushes an item onto the tail of this queue.

Parameters:
item the item to be pushed onto this queue.
Returns:
the item argument.
See also:
java.util.Vector::addElement

Implemented in java::util::ListQueue, and java::util::PriorityQueue.

virtual ObjectRef java::util::Queue::dequeue (  )  [pure virtual]

Removes the object at the head of this queue and returns that object as the value of this function.

Returns:
The object at the head of this stack (the last item of the Vector object).
Exceptions:
NoSuchElementException if this stack is empty.

Implemented in java::util::ListQueue, and java::util::PriorityQueue.

virtual ObjectRef java::util::Queue::requeue (  )  [pure virtual]

Removes the head object then pushes it onto the tail of this queue.

Usually happens when the head object was modified.

Returns:
the head object that been requeue.
See also:
java.util.Vector::addElement

Implemented in java::util::ListQueue, and java::util::PriorityQueue.

virtual ObjectRef java::util::Queue::head (  )  const [pure virtual]

Looks at the object at the head of this queue without removing it from the queue.

Returns:
the object at the head of this queue.
Exceptions:
NoSuchElementException if this queue is empty.

Implemented in java::util::ListQueue, and java::util::PriorityQueue.

virtual jint java::util::Queue::search ( const ObjectRef o  )  const [pure virtual]

Returns the 1-based position where an object is on this queue.

If the object o occurs as an item in this queue, this method returns the distance from the head of the queue of the occurrence nearest the head of the queue; the rear item on the queue is considered to be at distance 1. The equals method is used to compare o to the items in this queue.

Parameters:
o the desired object.
Returns:
the 1-based position from the head of the queue where the object is located; the return value -1 indicates that the object is not on the queue.

Implemented in java::util::ListQueue, and java::util::PriorityQueue.

virtual void java::util::Queue::clear (  )  [pure virtual]

Removes all elements from the queue.

Implemented in java::util::ListQueue, and java::util::PriorityQueue.

virtual Ref<List> java::util::Queue::getInternalList (  )  const [pure virtual]

return the internal list implementation

Implemented in java::util::ListQueue, and java::util::PriorityQueue.


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:51 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3