All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Webcrawler.FIFOQueue.FIFOQueue

java.lang.Object
   |
   +----java.util.Observable
           |
           +----Webcrawler.FIFOQueue.FIFOQueue

public class FIFOQueue
extends Observable
implements Runnable
Implements a very simple but multi-thread-proof FIFO-Queue. For detecting movements in the queue, attach an Observer. If there is anything in the FIFOQueue it sends out a message to those Observers (messages have no content) once a second.

See Also:
QueueMessage

Variable Index

 o q

Constructor Index

 o FIFOQueue()

Method Index

 o add(Object)
Adds the object o to the end of the FIFO-Queue.
 o available()
 o get()
Retrieves the next object in the FIFO-Queue.
 o getElements()
 o noOfElements()
 o run()
every second this thread sends out a queuemessage if there is anything stored in this queue.

Variables

 o q
 private Vector q

Constructors

 o FIFOQueue
 public FIFOQueue()

Methods

 o add
 public synchronized void add(Object o)
Adds the object o to the end of the FIFO-Queue.

Parameters:
o - the object to be added to the queue
 o get
 public synchronized Object get()
Retrieves the next object in the FIFO-Queue.

Returns:
the next Object in the FIFO-Queue or null if the queue is empty
 o available
 public boolean available()
Returns:
Is there anything in the queue (true/false)
 o noOfElements
 public int noOfElements()
Returns:
How many Elements are in this queue.
 o getElements
 public Enumeration getElements()
Returns:
the Vector containing the elements in this FIFO-queue.
 o run
 public void run()
every second this thread sends out a queuemessage if there is anything stored in this queue. Attached Observers can react to this notification.


All Packages  Class Hierarchy  This Package  Previous  Next  Index