Class DebuggingValueStack<V>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clears all values.
      protected void log​(java.lang.String action)  
      void poke​(int down, V value)
      Replaces the element the given number of elements below the current top of the stack.
      V pop​(int down)
      Removes the value the given number of elements below the top of the stack.
      void push​(int down, V value)
      Inserts the given value a given number of elements below the current top of the stack.
      void push​(V value)
      Pushes the given value onto the stack.
      void restoreSnapshot​(java.lang.Object snapshot)
      Restores the stack state as previously returned by ValueStack.takeSnapshot().
      void swap()
      Swaps the top two stack values.
      void swap3()
      Reverses the order of the top 3 stack values.
      void swap4()
      Reverses the order of the top 4 stack values.
      void swap5()
      Reverses the order of the top 5 stack values.
      void swap6()
      Reverses the order of the top 5 stack values.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • log

        public final Sink<java.lang.String> log
    • Constructor Detail

      • DebuggingValueStack

        public DebuggingValueStack()
      • DebuggingValueStack

        public DebuggingValueStack​(Sink<java.lang.String> log)
      • DebuggingValueStack

        public DebuggingValueStack​(java.lang.Iterable<V> values)
      • DebuggingValueStack

        public DebuggingValueStack​(java.lang.Iterable<V> values,
                                   Sink<java.lang.String> log)
    • Method Detail

      • push

        public void push​(V value)
        Description copied from interface: ValueStack
        Pushes the given value onto the stack. Equivalent to push(0, value).
        Specified by:
        push in interface ValueStack<V>
        Overrides:
        push in class DefaultValueStack<V>
        Parameters:
        value - the value
      • push

        public void push​(int down,
                         V value)
        Description copied from interface: ValueStack
        Inserts the given value a given number of elements below the current top of the stack.
        Specified by:
        push in interface ValueStack<V>
        Overrides:
        push in class DefaultValueStack<V>
        Parameters:
        down - the number of elements to skip before inserting the value (0 being equivalent to push(value))
        value - the value
      • pop

        public V pop​(int down)
        Description copied from interface: ValueStack
        Removes the value the given number of elements below the top of the stack.
        Specified by:
        pop in interface ValueStack<V>
        Overrides:
        pop in class DefaultValueStack<V>
        Parameters:
        down - the number of elements to skip before removing the value (0 being equivalent to pop())
        Returns:
        the value
      • poke

        public void poke​(int down,
                         V value)
        Description copied from interface: ValueStack
        Replaces the element the given number of elements below the current top of the stack.
        Specified by:
        poke in interface ValueStack<V>
        Overrides:
        poke in class DefaultValueStack<V>
        Parameters:
        down - the number of elements to skip before replacing the value (0 being equivalent to poke(value))
        value - the value to replace with
      • log

        protected void log​(java.lang.String action)