|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.egothor.util.QueueAbstract<T>
public abstract class QueueAbstract<T>
This class represents a priority queue (heap). The Queue object is used to aid in the merger of indices constructed for any number of document collections. This class is abstract, and it does not care about the heap storage method.
Field Summary | |
---|---|
int |
factor
|
Constructor Summary | |
---|---|
protected |
QueueAbstract(int factor)
|
Method Summary | |
---|---|
abstract void |
append(T item)
Appends a new object to the heap's array (at the end). |
abstract int |
capacity()
Return the maximum capacity of this Queue. |
abstract void |
cutOffLast()
Cuts off the last element of the heap's array, and reduces the array size by one. |
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. |
abstract T |
item(int index)
Returns the object that is stored in index-th cell of the heap's array. |
abstract void |
itemto(int index,
T obj)
Saves the object to the given index-th cell of the heap's array. |
abstract boolean |
lessThan(T a,
T b)
Test whether a is less than b.. |
int |
lowestSonOf(int father)
Find an item with the lowest value amongst sons of a father. |
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 . |
abstract int |
size()
Returns 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 |
Field Detail |
---|
public final int factor
Constructor Detail |
---|
protected QueueAbstract(int factor)
Method Detail |
---|
public int lowestSonOf(int father)
public abstract int size()
public abstract T item(int index)
index
- Description of the Parameter
public abstract void itemto(int index, T obj)
index
- Description of the Parameterobj
- Description of the Parameterpublic 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 abstract int capacity()
public abstract void append(T item)
item
- Description of the Parameterpublic void expand()
public void push(T o)
o
- the Object to insertpublic final T peek()
public abstract void cutOffLast()
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 array
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |