org.apache.xml.dtm.ref

## Class DTMAxisIteratorBase

- java.lang.Object
- - org.apache.xml.dtm.ref.DTMAxisIteratorBase

- All Implemented Interfaces:
    java.lang.Cloneable, DTMAxisIterator
  Direct Known Subclasses:
    AbsoluteIterator, CachedNodeListIterator, ClonedNodeListIterator, CurrentNodeListIterator, DTMDefaultBaseIterators.InternalAxisIteratorBase, DupFilterIterator, FilterIterator, ForwardPositionIterator, KeyIndex, MatchingIterator, MultiValuedNodeHeapIterator, NthIterator, SimpleResultTreeImpl.SimpleIterator, SimpleResultTreeImpl.SingletonIterator, SingletonIterator, SortingIterator, StepIterator

      public abstract class DTMAxisIteratorBase
      extends java.lang.Object
      implements DTMAxisIterator

  This class serves as a default base for implementations of mutable DTMAxisIterators.

- - ### Field Summary

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

      `END`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DTMAxisIteratorBase()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `DTMAxisIterator` | `cloneIterator()` Returns a deep copy of this iterator.
    `int` | `getAxis()` Returns the axis being iterated, if it is known.
    `int` | `getLast()` Returns the position of the last node within the iteration, as defined by XPath.
    `int` | `getNodeByPosition(int position)` Return the node at the given position.
    `int` | `getPosition()`
    `int` | `getStartNode()` Get start to END should 'close' the iterator, i.e. subsequent call to next() should return END.
    `DTMAxisIterator` | `includeSelf()` Set the flag to include the start node in the iteration.
    `boolean` | `isDocOrdered()` Returns true if all the nodes in the iteration well be returned in document order.
    `boolean` | `isReverse()`
    `DTMAxisIterator` | `reset()` Resets the iterator to the last start node.
    `void` | `setRestartable(boolean isRestartable)` Set if restartable.

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

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

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

      `gotoMark, next, setMark, setStartNode`

- - ### Constructor Detail

    - #### DTMAxisIteratorBase

          public DTMAxisIteratorBase()

  - ### Method Detail

    - #### getStartNode

          public int getStartNode()

      Get start to END should 'close' the iterator, i.e. subsequent call to next() should return END.
      Specified by:
        `getStartNode` in interface `DTMAxisIterator`
      Returns:
        The root node of the iteration.

    - #### reset

          public DTMAxisIterator reset()

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

    - #### includeSelf

          public DTMAxisIterator includeSelf()

      Set the flag to include the start node in the iteration.
      Returns:
        This default method returns just returns this DTMAxisIterator, after setting the flag. (Returning "this" permits C++-style chaining of method calls into a single expression.)

    - #### getLast

          public int getLast()

      Returns the position of the last node within the iteration, as defined by XPath. In a forward iterator, I believe this equals the number of nodes which this iterator will yield. In a reverse iterator, I believe it should return 1 (since the "last" is the first produced.) This may be an expensive operation when called the first time, since it may have to iterate through a large part of the document to produce its answer.
      Specified by:
        `getLast` in interface `DTMAxisIterator`
      Returns:
        The number of nodes in this iterator (forward) or 1 (reverse).

    - #### getPosition

          public int getPosition()

      Specified by:
        `getPosition` in interface `DTMAxisIterator`
      Returns:
        The position of the current node within the set, as defined by XPath. Note that this is one-based, not zero-based.

    - #### isReverse

          public boolean isReverse()

      Specified by:
        `isReverse` in interface `DTMAxisIterator`
      Returns:
        true if this iterator has a reversed axis, else false

    - #### cloneIterator

          public DTMAxisIterator cloneIterator()

      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`
      Returns:
        a deep copy of this iterator.

    - #### isDocOrdered

          public boolean isDocOrdered()

      Returns true if all the nodes in the iteration well be returned in document order.
      Returns:
        true as a default.

    - #### getAxis

          public int getAxis()

      Returns the axis being iterated, if it is known.
      Returns:
        Axis.CHILD, etc., or -1 if the axis is not known or is of multiple types.

    - #### setRestartable

          public void setRestartable(boolean isRestartable)

      Description copied from interface: `DTMAxisIterator`
      Set if restartable.
      Specified by:
        `setRestartable` in interface `DTMAxisIterator`

    - #### getNodeByPosition

          public int getNodeByPosition(int position)

      Return the node at the given position.
      Specified by:
        `getNodeByPosition` in interface `DTMAxisIterator`
      Parameters:
        `position` - The position
      Returns:
        The node at the given position.

Copyright © 2023 Apache XML Project. All Rights Reserved.