scone.robot
Class GenericURLQueue

java.lang.Object
  extended by scone.robot.GenericURLQueue
All Implemented Interfaces:
URLQueue
Direct Known Subclasses:
BreadthSearchURLQueue, FairBreadthSearchURLQueue

public abstract class GenericURLQueue
extends java.lang.Object
implements URLQueue

Implementation of a generic queue

Author:
Frank Wollenweber

Field Summary
protected  int numberOfElements
           
protected  java.util.Vector queue
           
 
Constructor Summary
GenericURLQueue()
          The constructor
 
Method Summary
 int getNumberOfPendingQueueEntries(RobotTask robotTask)
          Get the number of entries belonging to the robotTask
 int getNumberOfPendingQueueEntries(SimpleUri uri)
          The number of queueEntries from different tasks waiting to download this url
 java.util.Vector getPendingQueueEntries(RobotTask robotTask)
          Get vector with all entries belonging to the robotTask
 java.util.Vector getPendingQueueEntries(SimpleUri uri)
          The vector with all queueEntries from different tasks waiting to download this url
 QueueEntry getPendingURL(SimpleUri uri, RobotTask robotTask)
          Get the entry belonging to robotTask and waiting to download url
 boolean isPendingURL(SimpleUri uri, RobotTask robotTask)
          Checks, if there is an entry belonging to robotTask, which is waiting to download url
 void queue(QueueEntry qe)
          Adds a new entry to the queue
 void removeAllQueueEntries(RobotTask robotTask)
          Remove all queueEntries of the specified robotTask
 void removeQueueEntry(QueueEntry qe)
          Remove an entry from the queue
 int size()
          Get the number of entries waiting in the queue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface scone.robot.URLQueue
dequeue
 

Field Detail

queue

protected java.util.Vector queue

numberOfElements

protected int numberOfElements
Constructor Detail

GenericURLQueue

public GenericURLQueue()
The constructor

Method Detail

queue

public void queue(QueueEntry qe)
Adds a new entry to the queue

Specified by:
queue in interface URLQueue
Parameters:
qe - The new entry

size

public int size()
Get the number of entries waiting in the queue

Specified by:
size in interface URLQueue
Returns:
Number of elements

getNumberOfPendingQueueEntries

public int getNumberOfPendingQueueEntries(RobotTask robotTask)
Get the number of entries belonging to the robotTask

Specified by:
getNumberOfPendingQueueEntries in interface URLQueue
Parameters:
robotTask - only entries of this task are counted
Returns:
Number of entries

getPendingQueueEntries

public java.util.Vector getPendingQueueEntries(RobotTask robotTask)
Get vector with all entries belonging to the robotTask

Specified by:
getPendingQueueEntries in interface URLQueue
Parameters:
robotTask - only entries of this task are added to the vector
Returns:
Vector with queueEntries

removeAllQueueEntries

public void removeAllQueueEntries(RobotTask robotTask)
Remove all queueEntries of the specified robotTask

Specified by:
removeAllQueueEntries in interface URLQueue
Parameters:
robotTask - removes all queue entries of this task

getNumberOfPendingQueueEntries

public int getNumberOfPendingQueueEntries(SimpleUri uri)
The number of queueEntries from different tasks waiting to download this url

Specified by:
getNumberOfPendingQueueEntries in interface URLQueue
Parameters:
url - Only queueEntries with this url are counted
Returns:
Number of entries

getPendingQueueEntries

public java.util.Vector getPendingQueueEntries(SimpleUri uri)
The vector with all queueEntries from different tasks waiting to download this url

Specified by:
getPendingQueueEntries in interface URLQueue
Parameters:
url - Only queueEntries with this url are added to the vector
Returns:
Vector with queueEntries

isPendingURL

public boolean isPendingURL(SimpleUri uri,
                            RobotTask robotTask)
Checks, if there is an entry belonging to robotTask, which is waiting to download url

Specified by:
isPendingURL in interface URLQueue
Parameters:
url - The url to check
robotTask - Only entries of this task are checked
Returns:
True, if there is an entry waiting

getPendingURL

public QueueEntry getPendingURL(SimpleUri uri,
                                RobotTask robotTask)
Get the entry belonging to robotTask and waiting to download url

Specified by:
getPendingURL in interface URLQueue
Parameters:
url - The url to check
robotTask - Only entries of this task are checked
Returns:
The waiting queueEntry

removeQueueEntry

public void removeQueueEntry(QueueEntry qe)
Remove an entry from the queue

Specified by:
removeQueueEntry in interface URLQueue
Parameters:
qe - The entry to remove