Class Resolver.Stack.Sequence

  • All Implemented Interfaces:
    java.util.Iterator<M>
    Enclosing class:
    Resolver.Stack

    private class Resolver.Stack.Sequence
    extends java.lang.Object
    implements java.util.Iterator<M>
    The is used to order the Match objects in the insertion order. Iterating in insertion order allows the resolver object to be serialized and deserialized to and from an XML document without disruption resolution order.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int cursor
      The cursor used to acquire objects from the stack.
    • Constructor Summary

      Constructors 
      Constructor Description
      Sequence()
      Constructor for the Sequence object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()
      This is used to determine if the cursor has reached the start of the list.
      M next()
      This returns the Match object at the cursor position.
      void remove()
      Removes the match from the cursor position.
      • Methods inherited from class java.lang.Object

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

        forEachRemaining
    • Field Detail

      • cursor

        private int cursor
        The cursor used to acquire objects from the stack.
    • Constructor Detail

      • Sequence

        public Sequence()
        Constructor for the Sequence object. This is used to position the cursor at the end of the list so the first inserted match is the first returned from this.
    • Method Detail

      • next

        public M next()
        This returns the Match object at the cursor position. If the cursor has reached the start of the list then this returns null instead of the first match.
        Specified by:
        next in interface java.util.Iterator<M extends Match>
        Returns:
        this returns the match from the cursor position
      • hasNext

        public boolean hasNext()
        This is used to determine if the cursor has reached the start of the list. When the cursor reaches the start of the list then this method returns false.
        Specified by:
        hasNext in interface java.util.Iterator<M extends Match>
        Returns:
        this returns true if there are more matches left
      • remove

        public void remove()
        Removes the match from the cursor position. This also ensures that the cache is cleared so that resolutions made before the removal do not affect the semantics.
        Specified by:
        remove in interface java.util.Iterator<M extends Match>