2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 * $Id: DTMAxisIterator.java 468653 2006-10-28 07:07:05Z minchau $
21 package org.apache.xml.dtm;
24 * This class iterates over a single XPath Axis, and returns node handles.
26 public interface DTMAxisIterator extends Cloneable
29 /** Specifies the end of the iteration, and is the same as DTM.NULL. */
30 public static final int END = DTM.NULL;
33 * Get the next node in the iteration.
35 * @return The next node handle in the iteration, or END.
41 * Resets the iterator to the last start node.
43 * @return A DTMAxisIterator, which may or may not be the same as this
46 public DTMAxisIterator reset();
49 * @return the number of nodes in this iterator. This may be an expensive
50 * operation when called the first time.
55 * @return The position of the current node in the set, as defined by XPath.
57 public int getPosition();
60 * Remembers the current node for the next call to gotoMark().
62 public void setMark();
65 * Restores the current node remembered by setMark().
67 public void gotoMark();
70 * Set start to END should 'close' the iterator,
71 * i.e. subsequent call to next() should return END.
73 * @param node Sets the root of the iteration.
75 * @return A DTMAxisIterator set to the start of the iteration.
77 public DTMAxisIterator setStartNode(int node);
80 * Get start to END should 'close' the iterator,
81 * i.e. subsequent call to next() should return END.
83 * @return The root node of the iteration.
85 public int getStartNode();
88 * @return true if this iterator has a reversed axis, else false.
90 public boolean isReverse();
93 * @return a deep copy of this iterator. The clone should not be reset
94 * from its current position.
96 public DTMAxisIterator cloneIterator();
101 public void setRestartable(boolean isRestartable);
104 * Return the node at the given position.
106 * @param position The position
107 * @return The node at the given position.
109 public int getNodeByPosition(int position);