Class MutableStack<E>

  • All Implemented Interfaces:
    IDynamicStack<E>

    public abstract class MutableStack<E>
    extends java.lang.Object
    implements IDynamicStack<E>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int index  
      private int size  
      private java.lang.Object[] stack  
    • Constructor Summary

      Constructors 
      Constructor Description
      MutableStack​(int argInitSize)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      private void extendStack​(int argSize)  
      protected abstract E newInstance()
      Creates a new instance of the object contained by this stack.
      E pop()
      Pops an item off the stack
      void push​(E argObject)
      Pushes an item back on the stack
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • stack

        private java.lang.Object[] stack
      • index

        private int index
      • size

        private int size
    • Constructor Detail

      • MutableStack

        public MutableStack​(int argInitSize)
    • Method Detail

      • extendStack

        private void extendStack​(int argSize)
      • pop

        public final E pop()
        Description copied from interface: IDynamicStack
        Pops an item off the stack
        Specified by:
        pop in interface IDynamicStack<E>
        Returns:
      • push

        public final void push​(E argObject)
        Description copied from interface: IDynamicStack
        Pushes an item back on the stack
        Specified by:
        push in interface IDynamicStack<E>
      • newInstance

        protected abstract E newInstance()
        Creates a new instance of the object contained by this stack.