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

## org.jaxen.util
Class PrecedingAxisIterator

    java.lang.Object
      org.jaxen.util.PrecedingAxisIterator

All Implemented Interfaces:
  Iterator

public class PrecedingAxisIterator
extends Object
implements Iterator

This implementation of 'preceding' works like so: the preceding axis includes preceding-siblings of this node and their descendants. Also, for each ancestor node of this node, it includes all preceding-siblings of that ancestor, and their descendants. Finally, it includes the ancestor nodes themselves.

The reversed descendant-or-self axes that are required are calculated using a stack of reversed 'child-or-self' axes. When asked for a node, it is always taken from a child-or-self axis. If it was the last node on that axis, the node is returned. Otherwise, this axis is pushed on the stack, and the process is repeated with the child-or-self of the node. Eventually this recurses down to the last descendant of any node, then works back up to the root.

I reckon most object models could provide a faster implementation of the reversed 'children-or-self' used here.

Constructor Summary
`PrecedingAxisIterator(Object contextNode, Navigator navigator)`

Method Summary
`boolean` | `hasNext()`
`Object` | `next()`
`void` | `remove()`

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

Constructor Detail

### PrecedingAxisIterator

    public PrecedingAxisIterator(Object contextNode,
                                 Navigator navigator)
                          throws UnsupportedAxisException

Method Detail

### hasNext

    public boolean hasNext()

  Specified by:
    `hasNext` in interface `Iterator`

### next

    public Object next()
                throws NoSuchElementException

  Specified by:
    `next` in interface `Iterator`
  Throws:
    `NoSuchElementException`

### remove

    public void remove()
                throws UnsupportedOperationException

  Specified by:
    `remove` in interface `Iterator`
  Throws:
    `UnsupportedOperationException`

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

Copyright © 2001-2005 Codehaus. All Rights Reserved.