|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.egothor.util.BiQueue<T>
public abstract class BiQueue<T>
The Queue class should be extended by any class wishing to implement a priority queue (heap). The Queue object is used to aid in the merger of indices constructed for any number of document collections.
Constructor Summary | |
---|---|
BiQueue(int max)
Constructor for the Queue object. |
|
BiQueue(int init_size,
int delta)
Constructor for the Queue object |
Method Summary | |
---|---|
void |
append(T obj)
Add the given object to the end of the queue. |
int |
capacity()
Return the capacity of this Queue as defined in the constructor. |
void |
clear()
Description of the Method |
void |
cutOffLast()
Shrink the Queue by 1 (the last) position. |
void |
down()
Resize the queue beginning at the last Object. |
protected void |
down(int now)
Resize the Queue after an Object is pushed into it. |
void |
expand()
If push is called and we have not any space for a new element, this method is executed to enlarge the capacity of this queue. |
T |
item(int index)
Return the object at the given position in the Queue. |
void |
itemto(int index,
T obj)
Insert the given object in the Queue at the specified position. |
abstract boolean |
lessThan(T a,
T b)
Test whether a is less than b.. |
int |
linearize()
Transform this structure to a linear structure. |
T |
peek()
Return the first element in the queue. |
T |
pop()
Removes and returns the first element in the queue. |
void |
push(T o)
Insert a new object in the queue. |
T |
replace(T what,
T by)
Replace what (this object must be directly in this
queue) with by . |
int |
size()
Return the number of elements in the queue. |
void |
up()
When the first element changes, this method resizes the queue structure in O (logn ). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BiQueue(int max)
max
- the maximum size desired for the Queuepublic BiQueue(int init_size, int delta)
init_size
- Description of the Parameterdelta
- Description of the ParameterMethod Detail |
---|
public final void clear()
public final void expand()
public final int size()
public final T item(int index)
index
- the position of the desired object
public final int capacity()
public final void itemto(int index, T obj)
index
- the position at which to insertobj
- the object to insertpublic final void cutOffLast()
public final void append(T obj)
obj
- the object to appendpublic final T replace(T what, T by)
what
(this object must be directly in this
queue) with by
. The replacement operation is achieved
in time O (size+log size ).
what
- what will be replacedby
- this will replace what
public void push(T o)
o
- the Object to insertpublic final T peek()
public final T pop()
public void up()
public abstract boolean lessThan(T a, T b)
a
- the first Object to compareb
- the Object to compare param a to
public final void down()
protected final void down(int now)
now
- the last position in the Queue's arraypublic int linearize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |