|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectalgoanim.primitives.Primitive
algoanim.primitives.VisualQueue<T>
algoanim.primitives.ArrayBasedQueue<T>
public class ArrayBasedQueue<T>
Represents a queue which has an usual FIFO-functionality and
will be visualized as an array.
The stored objects are of the generic data type T, so it is generally possible
to use ArrayBasedQueue with any objects.
| Field Summary |
|---|
| Fields inherited from class algoanim.primitives.Primitive |
|---|
gen |
| Constructor Summary | |
|---|---|
ArrayBasedQueue(ArrayBasedQueueGenerator<T> abqg,
Node upperLeftCorner,
java.util.List<T> content,
java.lang.String name,
DisplayOptions display,
QueueProperties qp,
int capacity)
Instantiates the ArrayBasedQueue and calls the create() method
of the associated ArrayBasedQueueGenerator. |
|
| Method Summary | |
|---|---|
T |
dequeue(Timing delay,
Timing duration)
Removes and returns the first element of the queue. This is the delayed version as specified by delay. |
void |
enqueue(T elem,
Timing delay,
Timing duration)
Adds the element elem as the last element to the end of the queue.This is the delayed version as specified by delay. |
T |
front(Timing delay,
Timing duration)
Retrieves (without removing) the first element of the queue. This is the delayed version as specified by delay. |
int |
getCapacity()
Returns the capacity limit of the queue. |
void |
highlightFrontCell(Timing delay,
Timing duration)
Highlights the cell which contains the first element of the queue. |
void |
highlightFrontElem(Timing delay,
Timing duration)
Highlights the first element of the queue. |
void |
highlightTailCell(Timing delay,
Timing duration)
Highlights the cell which contains the last element of the queue. |
void |
highlightTailElem(Timing delay,
Timing duration)
Highlights the last element of the queue. |
boolean |
isEmpty(Timing delay,
Timing duration)
Tests if the queue is empty. This is the delayed version as specified by delay. |
boolean |
isFull(Timing delay,
Timing duration)
Tests if the queue is full. This is the delayed version as specified by delay. |
T |
tail(Timing delay,
Timing duration)
Retrieves (without removing) the last element of the queue. This is the delayed version as specified by delay. |
void |
unhighlightFrontCell(Timing delay,
Timing duration)
Unhighlights the cell which contains the first element of the queue. |
void |
unhighlightFrontElem(Timing delay,
Timing duration)
Unhighlights the first element of the queue. |
void |
unhighlightTailCell(Timing delay,
Timing duration)
Unhighlights the cell which contains the last element of the queue. |
void |
unhighlightTailElem(Timing delay,
Timing duration)
Unhighlights the last element of the queue. |
| Methods inherited from class algoanim.primitives.VisualQueue |
|---|
dequeue, enqueue, front, getInitContent, getProperties, getQueue, getUpperLeft, isEmpty, setName, tail |
| Methods inherited from class algoanim.primitives.Primitive |
|---|
changeColor, exchange, getDisplayOptions, getName, hide, hide, moveBy, moveTo, moveVia, rotate, rotate, show, show |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ArrayBasedQueue(ArrayBasedQueueGenerator<T> abqg,
Node upperLeftCorner,
java.util.List<T> content,
java.lang.String name,
DisplayOptions display,
QueueProperties qp,
int capacity)
ArrayBasedQueue and calls the create() method
of the associated ArrayBasedQueueGenerator.
abqg - the appropriate code Generator.upperLeftCorner - the upper left corner of this ArrayBasedQueue.content - the initial content of the ArrayBasedQueue, consisting
of the elements of the generic type T.name - the name of this ArrayBasedQueue.display - [optional] the DisplayOptions of this ArrayBasedQueue.qp - [optional] the properties of this ArrayBasedQueue.capacity - the capacity limit of this ArrayBasedQueue; must be
nonnegative.
java.lang.IllegalArgumentException - - if the given capacity is negative.| Method Detail |
|---|
public void enqueue(T elem,
Timing delay,
Timing duration)
elem as the last element to the end of the queue.delay.
The duration of this operation may also be specified.
elem - the element to be added to the end of the queue.delay - [optional] the delay which shall be applied to the operation.duration - [optional] the duration this action needs.
java.lang.IndexOutOfBoundsException - - if the queue is full.
public T dequeue(Timing delay,
Timing duration)
delay.
The duration of this operation may also be specified.
delay - [optional] the delay which shall be applied to the operation.duration - [optional] the duration this action needs.
java.util.NoSuchElementException - - if the queue is empty.
public T front(Timing delay,
Timing duration)
delay.
The duration of this operation may also be specified.
delay - [optional] the delay which shall be applied to the operation.duration - [optional] the duration this action needs.
java.util.NoSuchElementException - - if the queue is empty.
public T tail(Timing delay,
Timing duration)
delay.
The duration of this operation may also be specified.
delay - [optional] the delay which shall be applied to the operation.duration - [optional] the duration this action needs.
java.util.NoSuchElementException - - if the queue is empty.
public boolean isEmpty(Timing delay,
Timing duration)
delay.
The duration of this operation may also be specified.
delay - [optional] the delay which shall be applied to the operation.duration - [optional] the duration this action needs.
true if and only if the queue contains no elements;
false otherwise.
public boolean isFull(Timing delay,
Timing duration)
delay.
The duration of this operation may also be specified.
delay - [optional] the delay which shall be applied to the operation.duration - [optional] the duration this action needs.
true if and only if the queue is full; false otherwise.public int getCapacity()
public void highlightFrontElem(Timing delay,
Timing duration)
delay.
The duration of this operation may also be specified.
delay - [optional] the delay which shall be applied to the operation.duration - [optional] the duration this action needs.
public void unhighlightFrontElem(Timing delay,
Timing duration)
delay.
The duration of this operation may also be specified.
delay - [optional] the delay which shall be applied to the operation.duration - [optional] the duration this action needs.
public void highlightFrontCell(Timing delay,
Timing duration)
delay.
The duration of this operation may also be specified.
delay - [optional] the delay which shall be applied to the operation.duration - [optional] the duration this action needs.
public void unhighlightFrontCell(Timing delay,
Timing duration)
delay.
The duration of this operation may also be specified.
delay - [optional] the delay which shall be applied to the operation.duration - [optional] the duration this action needs.
public void highlightTailElem(Timing delay,
Timing duration)
delay.
The duration of this operation may also be specified.
delay - [optional] the delay which shall be applied to the operation.duration - [optional] the duration this action needs.
public void unhighlightTailElem(Timing delay,
Timing duration)
delay.
The duration of this operation may also be specified.
delay - [optional] the delay which shall be applied to the operation.duration - [optional] the duration this action needs.
public void highlightTailCell(Timing delay,
Timing duration)
delay.
The duration of this operation may also be specified.
delay - [optional] the delay which shall be applied to the operation.duration - [optional] the duration this action needs.
public void unhighlightTailCell(Timing delay,
Timing duration)
delay.
The duration of this operation may also be specified.
delay - [optional] the delay which shall be applied to the operation.duration - [optional] the duration this action needs.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||