SK.gnome.dwarf.utils.queue
Interface Queue

All Known Implementing Classes:
FIFOQueue

public interface Queue

Provides interface for queue.

This class provides interface for a universal queue.


Method Summary
 boolean add(java.lang.Object object)
          Adds the object to the queue.
 void clear()
          Removes all objects from the queue.
 java.lang.Object get()
          Returns an object from the queue.
 java.lang.Object peek()
          Returns an object from the queue.
 int size()
          Returns the queue size.
 

Method Detail

add

public boolean add(java.lang.Object object)
Adds the object to the queue.

The method returns false if the given object could not be added to the queue. A common reason may be that the queue have a fixed capacity and the current number of the queued objects has reached the size limit.

Parameters:
object - the object to be added to the queue
Returns:
true if the object has been added to the queue successfully, false otherwise

get

public java.lang.Object get()
Returns an object from the queue.

The returned object is removed from the queue.

Returns:
the object or null if there is no object in the queue

peek

public java.lang.Object peek()
Returns an object from the queue.

The returned object remains in the queue.

Returns:
the object or null if there is no object in the queue

clear

public void clear()
Removes all objects from the queue.


size

public int size()
Returns the queue size.

Returns the current number of the objects in the queue.

Returns:
the queue size


Copyright (c) 1999-2005, Gnome Ltd. All rights reserved.