edu.berkeley.cs.db.yfilter.filterinstance
Class Queue

java.lang.Object
  |
  +--edu.berkeley.cs.db.yfilter.filterinstance.Queue

public class Queue
extends java.lang.Object

Implements a circular queue.


Field Summary
protected  java.util.Vector data
          To store additional data, per element in the Vector.
protected static int DOC_QUEUE
          Indicates that the queue contains documents.
protected  java.util.Vector elements
          Stores the actual elements.
protected  EXfilter filter
          The filter object, used to handle query additions and deletions.
protected  int idInProcess
          The current obect being processed.
protected  int index
          A cumulative index for the elements passing through the queue.
protected  int max_index
          The max index present in the queue.
protected  int min_index
          The least index present in the queue.
static java.lang.String NO_RESULT
           
static java.lang.String OBJ_EXPIRED
           
static java.lang.String OBJ_NA
           
protected  int qType
          This queue is a document queue by default.
protected static int QUERY_QUEUE
          Indicates that the queue contains queries.
protected  java.util.Hashtable queryIDMap
          Handles the map between queue and filter ids for queries, since the filter asynchronously assignes IDs to queries.
static int WAIT
          For threads, the wait period for notification.
 
Constructor Summary
Queue()
          Default constructor.
Queue(int capacity)
           
Queue(int capacity, EXfilter filter)
           
 
Method Summary
 java.lang.Object get(int id)
          Gets an object from the queue.
 java.lang.Object getData(int id)
          Gets the data associated with the id.
 java.util.Hashtable processNext()
           
 int set(java.lang.Object o)
          Adds an object to the queue.
 boolean setData(java.lang.Object o, int id)
          Adds a data object corresponding to an id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WAIT

public static int WAIT
For threads, the wait period for notification.


NO_RESULT

public static java.lang.String NO_RESULT

OBJ_EXPIRED

public static java.lang.String OBJ_EXPIRED

OBJ_NA

public static java.lang.String OBJ_NA

DOC_QUEUE

protected static int DOC_QUEUE
Indicates that the queue contains documents.


QUERY_QUEUE

protected static int QUERY_QUEUE
Indicates that the queue contains queries.


qType

protected int qType
This queue is a document queue by default.


min_index

protected int min_index
The least index present in the queue.


max_index

protected int max_index
The max index present in the queue.


index

protected int index
A cumulative index for the elements passing through the queue.


elements

protected java.util.Vector elements
Stores the actual elements. e.g. queries (Query), documents (XMLTree)


data

protected java.util.Vector data
To store additional data, per element in the Vector. e.g. A document can have a Hashtable of matched queries. A query can have matched elements.


idInProcess

protected int idInProcess
The current obect being processed. e.g. the doc ID being processed by the filter.


filter

protected EXfilter filter
The filter object, used to handle query additions and deletions.


queryIDMap

protected java.util.Hashtable queryIDMap
Handles the map between queue and filter ids for queries, since the filter asynchronously assignes IDs to queries.

Constructor Detail

Queue

public Queue(int capacity)
Parameters:
capacity -

Queue

public Queue(int capacity,
             EXfilter filter)

Queue

public Queue()
Default constructor. constructs a document queue of length 100.

Method Detail

set

public int set(java.lang.Object o)
Adds an object to the queue. If the queue is full, pops out the oldest object.

Parameters:
o - The object to be added.
Returns:
int The id of the object in the queue.

get

public java.lang.Object get(int id)
Gets an object from the queue.

Parameters:
id - The object id
Returns:
Object A status string if the object is not in the queue else, the object.

getData

public java.lang.Object getData(int id)
Gets the data associated with the id. e.g. For documents, the data could be matching query elements.

Returns:
Object The data object

setData

public boolean setData(java.lang.Object o,
                       int id)
Adds a data object corresponding to an id. e.g. For a document, this could be the matching query elements.

Parameters:
o - The data object to be added.
id - The id of the corressponding object
Returns:
boolean the status of the action.

processNext

public java.util.Hashtable processNext()