Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.saxon.expr
Class PositionIterator

    java.lang.Object
      net.sf.saxon.expr.PositionIterator

All Implemented Interfaces:
  LookaheadIterator, SequenceIterator

public class PositionIterator
extends java.lang.Object
implements SequenceIterator, LookaheadIterator

A PositionIterator selects a subsequence of a sequence

Method Summary
`Item` | `current()` Get the current value in the sequence (the one returned by the most recent call on next()).
`SequenceIterator` | `getAnother()` Get another iterator to return the same nodes
`boolean` | `hasNext()` Test whether there are any more items available in the enumeration
`static SequenceIterator` | `make(SequenceIterator base, int min, int max)` Static factory method.
`Item` | `next()` Get the next item if there is one
`int` | `position()` Get the current position.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### make

    public static SequenceIterator make(SequenceIterator base,
                                        int min,
                                        int max)
                                 throws XPathException

  Static factory method. Creates a PositionIterator, unless the base Iterator is an ArrayIterator, in which case it optimizes by creating a new ArrayIterator directly over the underlying array. This optimization is important when doing recursion over a node-set using repeated calls of $nodes[position()>1]

  Parameters:
    `base` - An iteration of the items to be filtered
    `min` - The position of the first item to be included (base 1)
    `max` - The position of the last item to be included (base 1)
  Throws:
    `XPathException`

### hasNext

    public boolean hasNext()

  Test whether there are any more items available in the enumeration

  Specified by:
    `hasNext` in interface `LookaheadIterator`
  Returns:
    true if there are more nodes

### next

    public Item next()
              throws XPathException

  Get the next item if there is one

  Specified by:
    `next` in interface `SequenceIterator`
  Returns:
    the next item, or null if there are no more items.
  Throws:
    `XPathException` - if an error occurs retrieving the next item

### current

    public Item current()

  Description copied from interface: `SequenceIterator`
  Get the current value in the sequence (the one returned by the most recent call on next()). This will be null before the first call of next().

  Specified by:
    `current` in interface `SequenceIterator`
  Returns:
    the current item, the one most recently returned by a call on next(); or null, if next() has not been called, or if the end of the sequence has been reached.

### position

    public int position()

  Description copied from interface: `SequenceIterator`
  Get the current position. This will be zero before the first call on next(), otherwise it will be the number of times that next() has been called.

  Specified by:
    `position` in interface `SequenceIterator`
  Returns:
    the current position, the position of the item returned by the most recent call of next()

### getAnother

    public SequenceIterator getAnother()
                                throws XPathException

  Get another iterator to return the same nodes

  Specified by:
    `getAnother` in interface `SequenceIterator`
  Returns:
    a SequenceIterator that iterates over the same items, positioned before the first item
  Throws:
    `XPathException` - if any error occurs

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD