Class Sequence3<T>

java.lang.Object
components.sequence.SequenceSecondary<T>
components.sequence.Sequence3<T>
Type Parameters:
T - type of Sequence entries
All Implemented Interfaces:
Sequence<T>, SequenceKernel<T>, Standard<Sequence<T>>, Iterable<T>

public class Sequence3<T> extends SequenceSecondary<T>
Sequence represented as a pair of Stacks with implementations of primary methods.
Abstraction Relation (interpretation mapping between $this and this):
this = rev($this.left) * $this.right
  • Constructor Summary

    Constructors
    Constructor
    Description
    No-argument constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    add(int pos, T x)
    Adds the entry x at position pos of this.
    final void
    Resets this to an initial value.
    final T
    entry(int pos)
    Reports the entry at position pos of this.
    final void
    Reverses ("flips") this.
    final Iterator<T>
     
    final int
    Reports the length of this.
    final Sequence<T>
    Returns a new object with the same dynamic type as this, having an initial value.
    final T
    remove(int pos)
    Removes and returns the entry at position pos of this .
    final void
    Sets this to the incoming value of source, and resets source to an initial value; the declaration notwithstanding, the dynamic type of source must be the same as the dynamic type of this.

    Methods inherited from class components.sequence.SequenceSecondary

    append, equals, extract, hashCode, insert, replaceEntry, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Constructor Details

    • Sequence3

      public Sequence3()
      No-argument constructor.
  • Method Details

    • newInstance

      public final Sequence<T> newInstance()
      Description copied from interface: Standard
      Returns a new object with the same dynamic type as this, having an initial value. If the type T has a no-argument constructor, then the value of the new returned object satisfies the contract of the no-argument constructor for T. If T does not have a no-argument constructor, then the value of the new returned object satisfies the contract of the constructor call that was used to initialize this .
      Returns:
      new object "like" this with an initial value
    • clear

      public final void clear()
      Description copied from interface: Standard
      Resets this to an initial value. If the type T has a no-argument constructor, then this satisfies the contract of the no-argument constructor for T. If T does not have a no-argument constructor, then this satisfies the contract of the constructor call that was used to initialize #this.
    • transferFrom

      public final void transferFrom(Sequence<T> source)
      Description copied from interface: Standard
      Sets this to the incoming value of source, and resets source to an initial value; the declaration notwithstanding, the dynamic type of source must be the same as the dynamic type of this. If the type T has a no-argument constructor, then source satisfies the contract of the no-argument constructor for T. If T does not have a no-argument constructor, then source satisfies the contract of the constructor call that was used to initialize #source.
      Parameters:
      source - object whose value is to be transferred
    • add

      public final void add(int pos, T x)
      Description copied from interface: SequenceKernel
      Adds the entry x at position pos of this.
      Parameters:
      pos - the position at which to add an entry
      x - the entry to be added
    • remove

      public final T remove(int pos)
      Description copied from interface: SequenceKernel
      Removes and returns the entry at position pos of this .
      Parameters:
      pos - the position at which to remove an entry
      Returns:
      the entry removed
    • length

      public final int length()
      Description copied from interface: SequenceKernel
      Reports the length of this.
      Returns:
      the length
    • iterator

      public final Iterator<T> iterator()
    • entry

      public final T entry(int pos)
      Description copied from interface: Sequence
      Reports the entry at position pos of this.
      Specified by:
      entry in interface Sequence<T>
      Overrides:
      entry in class SequenceSecondary<T>
      Parameters:
      pos - the position of the entry
      Returns:
      the entry at that position
    • flip

      public final void flip()
      Description copied from interface: Sequence
      Reverses ("flips") this.
      Specified by:
      flip in interface Sequence<T>
      Overrides:
      flip in class SequenceSecondary<T>