|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectalgoanim.primitives.Primitive
algoanim.primitives.VisualStack<T>
algoanim.primitives.ArrayBasedStack<T>
public class ArrayBasedStack<T>
Represents a stack which has an usual LIFO-functionality and
will be visualized using an array.
The stored objects are of the generic data type T, so it is generally possible
to use ArrayBasedStack with any objects.
| Field Summary |
|---|
| Fields inherited from class algoanim.primitives.Primitive |
|---|
gen |
| Constructor Summary | |
|---|---|
ArrayBasedStack(ArrayBasedStackGenerator<T> absg,
Node upperLeftCorner,
java.util.List<T> content,
java.lang.String name,
DisplayOptions display,
StackProperties sp,
int capacity)
Instantiates the ArrayBasedStack and calls the create() method
of the associated ArrayBasedStackGenerator. |
|
| Method Summary | |
|---|---|
int |
getCapacity()
Returns the capacity limit of the stack. |
void |
highlightTopCell(Timing delay,
Timing duration)
Highlights the cell which contains the top element of the stack. |
void |
highlightTopElem(Timing delay,
Timing duration)
Highlights the top element of the stack. |
boolean |
isEmpty(Timing delay,
Timing duration)
Tests if the stack is empty. This is the delayed version as specified by delay. |
boolean |
isFull(Timing delay,
Timing duration)
Tests if the stack is full. This is the delayed version as specified by delay. |
T |
pop(Timing delay,
Timing duration)
Removes and returns the element at the top of the stack. This is the delayed version as specified by delay. |
void |
push(T elem,
Timing delay,
Timing duration)
Pushes the element elem onto the top of the stack if it is not full. |
T |
top(Timing delay,
Timing duration)
Retrieves (without removing) the element at the top of the stack. This is the delayed version as specified by delay. |
void |
unhighlightTopCell(Timing delay,
Timing duration)
Unhighlights the cell which contains the top element of the stack. |
void |
unhighlightTopElem(Timing delay,
Timing duration)
Unhighlights the top element of the stack. |
| Methods inherited from class algoanim.primitives.VisualStack |
|---|
getInitContent, getProperties, getStack, getUpperLeft, isEmpty, pop, push, setName, top |
| 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 ArrayBasedStack(ArrayBasedStackGenerator<T> absg,
Node upperLeftCorner,
java.util.List<T> content,
java.lang.String name,
DisplayOptions display,
StackProperties sp,
int capacity)
ArrayBasedStack and calls the create() method
of the associated ArrayBasedStackGenerator.
absg - the appropriate code Generator.upperLeftCorner - the upper left corner of this ArrayBasedStack.content - the initial content of the ArrayBasedStack, consisting
of the elements of the generic type T.name - the name of this ArrayBasedStack.display - [optional] the DisplayOptions of this ArrayBasedStack.sp - [optional] the properties of this ArrayBasedStack.capacity - the capacity limit of this ArrayBasedStack; must be
nonnegative.
java.lang.IllegalArgumentException - - if the given capacity is negative.| Method Detail |
|---|
public void push(T elem,
Timing delay,
Timing duration)
elem onto the top of the stack if it is not full.
Unlike the push-method of java.util.Stack it doesn't return
the element to be pushed.delay.
The duration of this operation may also be specified.
elem - the element to be pushed onto the stack.delay - [optional] the delay which shall be applied to the operation.duration - [optional] the duration this action needs.
java.lang.IndexOutOfBoundsException - - if the stack is full.
public T pop(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.EmptyStackException - - if the stack is empty.
public T top(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.EmptyStackException - - if the stack 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 stack 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 stack is full; false otherwise.public int getCapacity()
public void highlightTopElem(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 unhighlightTopElem(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 highlightTopCell(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 unhighlightTopCell(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 | |||||||||