public abstract class BiQueue<T> extends Object
Constructor and Description |
---|
BiQueue(int max)
Constructor for the Queue object.
|
BiQueue(int init_size,
int delta)
Constructor for the Queue object
|
Modifier and Type | Method and Description |
---|---|
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.
|
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 ).
|
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 Parameterpublic final void clear()
public final void expand()
public final int size()
public final T item(int index)
index
- the position of the desired objectpublic 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 topublic final void down()
public int linearize()
Copyright © 2016 Egothor. All Rights Reserved.