org.eclipse.nebula.widgets.oscilloscope
Class Oscilloscope.IntegerFiFoCircularStack

java.lang.Object
  extended by org.eclipse.nebula.widgets.oscilloscope.Oscilloscope.IntegerFiFoCircularStack
Enclosing class:
Oscilloscope

public class Oscilloscope.IntegerFiFoCircularStack
extends java.lang.Object

The stack will not overflow if you push too many values into it but it will rotate and overwrite the older values. Think of the stack as a closed ring with one hole to push values in and one that lets them out.


Constructor Summary
Oscilloscope.IntegerFiFoCircularStack(int capacity)
          Creates a stack with the indicated capacity.
Oscilloscope.IntegerFiFoCircularStack(int capacity, Oscilloscope.IntegerFiFoCircularStack oldStack)
          Creates stack with the indicated capacity and copies the old stack into the new stack.
 
Method Summary
 void clear()
          Clears the stack.
 boolean isEmpty()
           
 int pop(int valueIfEmpty)
          Returns the oldest value from the stack.
 void push(int value)
          Puts a value on the stack.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Oscilloscope.IntegerFiFoCircularStack

public Oscilloscope.IntegerFiFoCircularStack(int capacity)
Creates a stack with the indicated capacity.

Parameters:
capacity -

Oscilloscope.IntegerFiFoCircularStack

public Oscilloscope.IntegerFiFoCircularStack(int capacity,
                                             Oscilloscope.IntegerFiFoCircularStack oldStack)
Creates stack with the indicated capacity and copies the old stack into the new stack.

Parameters:
capacity -
oldStack -
Method Detail

clear

public void clear()
Clears the stack.


push

public void push(int value)
Puts a value on the stack.

Parameters:
value -

pop

public int pop(int valueIfEmpty)
Returns the oldest value from the stack. Returns the supplied entry if the stack is empty.

Parameters:
valueIfEmpty -
Returns:
int

isEmpty

public boolean isEmpty()
Returns:
boolean