public abstract class QueueAbstract<T> extends Object
Modifier and Type | Field and Description |
---|---|
int |
factor |
Modifier and Type | Method and Description |
---|---|
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.
|
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 ).
|
public int lowestSonOf(int father)
public abstract int size()
public abstract T item(int index)
index
- Description of the Parameterpublic 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 topublic final void down()
Copyright © 2016 Egothor. All Rights Reserved.