public class Oscilloscope.IntegerFiFoCircularStack
extends java.lang.Object
Constructor and Description |
---|
IntegerFiFoCircularStack(int capacity)
Creates a stack with the indicated capacity.
|
IntegerFiFoCircularStack(int capacity,
Oscilloscope.IntegerFiFoCircularStack oldStack)
Creates stack with the indicated capacity and copies the old stack
into the new stack and the old stack will be empty after this action.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the stack.
|
int |
getCapacity() |
int |
getLoad() |
boolean |
isEmpty() |
boolean |
isFull() |
int |
peek(int valueIfEmpty)
Returns the oldest value from the stack without removing the value
from the stack.
|
int |
pop(int valueIfEmpty)
Returns the oldest value from the stack.
|
int |
popNegate(int valueIfEmpty)
Returns the oldest value from the stack and negates the value.
|
void |
push(int value)
Puts a value on the stack.
|
public IntegerFiFoCircularStack(int capacity)
capacity
- must be greater than 1public IntegerFiFoCircularStack(int capacity, Oscilloscope.IntegerFiFoCircularStack oldStack)
capacity
- must be greater than 1oldStack
- public void clear()
public int getCapacity()
public int getLoad()
public boolean isEmpty()
public boolean isFull()
public int peek(int valueIfEmpty)
valueIfEmpty
- public int pop(int valueIfEmpty)
valueIfEmpty
- public int popNegate(int valueIfEmpty)
valueIfEmpty
- public void push(int value)
value
-