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
-
q
-
-
FIFOQueue()
-
-
add(Object)
-
Adds the object o to the end of the FIFO-Queue.
-
available()
-
-
get()
-
Retrieves the next object in the FIFO-Queue.
-
getElements()
-
-
noOfElements()
-
-
run()
- every second this thread sends out a queuemessage if there is anything
stored in this queue.
q
private Vector q
FIFOQueue
public FIFOQueue()
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
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
available
public boolean available()
- Returns:
- Is there anything in the queue (true/false)
noOfElements
public int noOfElements()
- Returns:
- How many Elements are in this queue.
getElements
public Enumeration getElements()
- Returns:
- the Vector containing the elements in this FIFO-queue.
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