Class AbstractPushbackSequence<T>

  • Type Parameters:
    T -
    All Implemented Interfaces:
    PushbackSequence<T>
    Direct Known Subclasses:
    PushBackSequenceImpl, PushbackString

    public abstract class AbstractPushbackSequence<T>
    extends java.lang.Object
    implements PushbackSequence<T>
    This Abstract class provides the generic logic for using a PushbackSequence in regards to iterating strings. The final Impl is intended for the user to supply a type T such that the pushback interface can be utilized for sequences of type T. Presently this generic class is limited by the fact that input is a String.
    Author:
    Matt Seil
    • Field Detail

      • input

        protected java.lang.String input
      • pushback

        protected T pushback
      • temp

        protected T temp
      • index

        protected int index
      • mark

        protected int mark
    • Constructor Detail

      • AbstractPushbackSequence

        public AbstractPushbackSequence​(java.lang.String input)
    • Method Detail

      • index

        public int index()
        Get the current index of the PushbackString. Typically used in error messages.
        Specified by:
        index in interface PushbackSequence<T>
        Returns:
        The current index of the PushbackSequence.
      • hasNext

        public boolean hasNext()
        Determine if this sequence has another element.
        Specified by:
        hasNext in interface PushbackSequence<T>
        Returns:
        True if there is another element in this sequence. False otherwise.