Class Oscilloscope.IntegerFiFoCircularStack

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

public class Oscilloscope.IntegerFiFoCircularStack
extends java.lang.Object
The stack can hold a limited number of values but will never overflow. Think of the stack as a tube with a given length. If you push too many values in, the oldest will be pushed out at the end.
  • Constructor Summary

    Constructors 
    Constructor 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.
  • Method Summary

    Modifier and Type Method 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IntegerFiFoCircularStack

      public IntegerFiFoCircularStack​(int capacity)
      Creates a stack with the indicated capacity.
      Parameters:
      capacity - must be greater than 1
    • IntegerFiFoCircularStack

      public 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.
      Parameters:
      capacity - must be greater than 1
      oldStack -
  • Method Details

    • clear

      public void clear()
      Clears the stack.
    • getCapacity

      public int getCapacity()
    • getLoad

      public int getLoad()
      Returns:
      boolean
    • isEmpty

      public boolean isEmpty()
      Returns:
      boolean
    • isFull

      public boolean isFull()
      Returns:
      boolean
    • peek

      public int peek​(int valueIfEmpty)
      Returns the oldest value from the stack without removing the value from the stack. Returns the supplied entry if the stack is empty.
      Parameters:
      valueIfEmpty -
      Returns:
      int
    • 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
    • popNegate

      public int popNegate​(int valueIfEmpty)
      Returns the oldest value from the stack and negates the value. Returns the supplied entry if the stack is empty.
      Parameters:
      valueIfEmpty -
      Returns:
      int
    • push

      public void push​(int value)
      Puts a value on the stack.
      Parameters:
      value -