Interface BitStack

All Superinterfaces:
Stack
All Known Subinterfaces:
MutableBitArray

public interface BitStack extends Stack

Stack of boolean values.

Author:
Daniel Alievsky
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Removes the element at the top of this stack and returns its value, or throws EmptyStackException if the stack is empty.
    void
    pushBit(boolean value)
    Appends value element to the end of this stack.

    Methods inherited from interface net.algart.arrays.Stack

    clear, length, popElement, pushElement, removeTop
  • Method Details

    • popBit

      boolean popBit()
      Removes the element at the top of this stack and returns its value, or throws EmptyStackException if the stack is empty.

      It this object is an AlgART boolean array, implementing MutableBitArray interface, and it is not empty, the same action may be performed by the following code:

       boolean result = booleanArray.getBit(booleanArray.length()-1);
       booleanArray.length(booleanArray.length()-1);
       
      Returns:
      the element at the top of this stack (it is removed from the stack by this method).
      Throws:
      EmptyStackException - if this stack is empty.
    • pushBit

      void pushBit(boolean value)
      Appends value element to the end of this stack.

      It this object is an AlgART boolean array, implementing MutableBitArray interface, the same action may be performed by the following code:

       booleanArray.length(booleanArray.length()+1);
       booleanArray.setBit(booleanArray.length()-1, value);
       
      Parameters:
      value - to be added to the top of this stack.
      Throws:
      TooLargeArrayException - if the resulting stack length is too large for this type of stacks.