Class Sequence2L<T>

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

public class Sequence2L<T> extends SequenceSecondary<T>
Sequence represented as a java.util.LinkedList with implementations of primary methods.
Abstraction Relation (interpretation mapping between $this and this):
this = [value of $this.rep]
  • Constructor Details

    • Sequence2L

      public Sequence2L()
      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