org.apache.xalan.xsltc.dom

## Class ForwardPositionIterator

- java.lang.Object
- - org.apache.xml.dtm.ref.DTMAxisIteratorBase
  - - org.apache.xalan.xsltc.dom.ForwardPositionIterator

- All Implemented Interfaces:
    java.lang.Cloneable, DTMAxisIterator

  Deprecated.
  This class exists only for backwards compatibility with old translets. New code should not reference it.

      public final class ForwardPositionIterator
      extends DTMAxisIteratorBase

  This iterator is a wrapper that always returns the position of a node in document order. It is needed for the case where a call to position() occurs in the context of an XSLT element such as xsl:for-each, xsl:apply-templates, etc. The getPosition() methods in DTMAxisIterators defined in DTMDefaultBaseIterators always return the position in document order, which is backwards for XPath in the case of the ancestor, ancestor-or-self, previous and previous-sibling. XSLTC implements position() with the BasisLibrary.positionF() method, and uses the DTMAxisIterator.isReverse() method to determine whether the result of getPosition() should be interpreted as being equal to position(). But when the expression appears in apply-templates of for-each, the position() function operates in document order. The only effect of the ForwardPositionIterator is to force the result of isReverse() to false, so that BasisLibrary.positionF() calculates position() in a way that's consistent with the context in which the iterator is being used." (Apparently the correction of isReverse() occurs implicitly, by inheritance. This class also appears to maintain its own position counter, which seems redundant.)

- - ### Field Summary

    - ### Fields inherited from interface org.apache.xml.dtm.DTMAxisIterator

      `END`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ForwardPositionIterator(DTMAxisIterator source)` Deprecated.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `DTMAxisIterator` | `cloneIterator()` Deprecated. Returns a deep copy of this iterator.
    `void` | `gotoMark()` Deprecated. Restores the current node remembered by setMark().
    `int` | `next()` Deprecated. Get the next node in the iteration.
    `DTMAxisIterator` | `reset()` Deprecated. Resets the iterator to the last start node.
    `void` | `setMark()` Deprecated. Remembers the current node for the next call to gotoMark().
    `DTMAxisIterator` | `setStartNode(int node)` Deprecated. Set start to END should 'close' the iterator, i.e. subsequent call to next() should return END.

    - ### Methods inherited from class org.apache.xml.dtm.ref.DTMAxisIteratorBase

      `getAxis, getLast, getNodeByPosition, getPosition, getStartNode, includeSelf, isDocOrdered, isReverse, setRestartable`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ForwardPositionIterator

          public ForwardPositionIterator(DTMAxisIterator source)

      Deprecated.

  - ### Method Detail

    - #### cloneIterator

          public DTMAxisIterator cloneIterator()

      Deprecated.
      Description copied from class: `DTMAxisIteratorBase`
      Returns a deep copy of this iterator. Cloned iterators may not be restartable. The iterator being cloned may or may not become non-restartable as a side effect of this operation.
      Specified by:
        `cloneIterator` in interface `DTMAxisIterator`
      Overrides:
        `cloneIterator` in class `DTMAxisIteratorBase`
      Returns:
        a deep copy of this iterator.

    - #### next

          public int next()

      Deprecated.
      Description copied from interface: `DTMAxisIterator`
      Get the next node in the iteration.
      Returns:
        The next node handle in the iteration, or END.

    - #### setStartNode

          public DTMAxisIterator setStartNode(int node)

      Deprecated.
      Description copied from interface: `DTMAxisIterator`
      Set start to END should 'close' the iterator, i.e. subsequent call to next() should return END.
      Parameters:
        `node` - Sets the root of the iteration.
      Returns:
        A DTMAxisIterator set to the start of the iteration.

    - #### reset

          public DTMAxisIterator reset()

      Deprecated.
      Description copied from interface: `DTMAxisIterator`
      Resets the iterator to the last start node.
      Specified by:
        `reset` in interface `DTMAxisIterator`
      Overrides:
        `reset` in class `DTMAxisIteratorBase`
      Returns:
        A DTMAxisIterator which has been reset to the start node, which may or may not be the same as this iterator.

    - #### setMark

          public void setMark()

      Deprecated.
      Description copied from interface: `DTMAxisIterator`
      Remembers the current node for the next call to gotoMark().

    - #### gotoMark

          public void gotoMark()

      Deprecated.
      Description copied from interface: `DTMAxisIterator`
      Restores the current node remembered by setMark().

Copyright © 2023 Apache XML Project. All Rights Reserved.