Interface PrimitiveStack

All Known Implementing Classes:
FloatStack, IntegerStack

public interface PrimitiveStack
Simple primitive-type stack.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns this stack's current capacity.
    int
    Returns the grow size.
    int
    Returns the current position of this stack.
    void
    position(int newPosition)
    Sets the position of this stack.
    int
    Returns the remaining elements left before stack will grow about getGrowSize().
    void
    setGrowSize(int newGrowSize)
    Set new {@link #growSize().
  • Method Details

    • capacity

      int capacity()
      Returns this stack's current capacity.

      The capacity may grow with a put operation w/ insufficient remaining() elements left, if getGrowSize() > 0.

    • position

      int position()
      Returns the current position of this stack.

      Position is in the range: 0 ≤ position < capacity().

      The position equals to the number of elements stored.

    • position

      void position(int newPosition) throws IndexOutOfBoundsException
      Sets the position of this stack.
      Parameters:
      newPosition - the new position
      Throws:
      IndexOutOfBoundsException - if newPosition is outside of range: 0 ≤ position < capacity().
    • remaining

      int remaining()
      Returns the remaining elements left before stack will grow about getGrowSize().
         remaining := capacity() - position();
       

      0 denotes a full stack.

      See Also:
    • getGrowSize

      int getGrowSize()
      Returns the grow size. A stack grows by this size in case a put operation exceeds it's capacity().
    • setGrowSize

      void setGrowSize(int newGrowSize)
      Set new {@link #growSize().