View Javadoc
1   /*
2    * reserved comment block
3    * DO NOT REMOVE OR ALTER!
4    */
5   /*
6    * Copyright 1999-2004 The Apache Software Foundation.
7    *
8    * Licensed under the Apache License, Version 2.0 (the "License");
9    * you may not use this file except in compliance with the License.
10   * You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  /*
21   * $Id: DTMAxisIterator.java,v 1.2.4.1 2005/09/15 08:14:52 suresh_emailid Exp $
22   */
23  package com.sun.org.apache.xml.internal.dtm;
24  
25  /**
26   * This class iterates over a single XPath Axis, and returns node handles.
27   */
28  public interface DTMAxisIterator extends Cloneable
29  {
30  
31    /** Specifies the end of the iteration, and is the same as DTM.NULL.  */
32    public static final int END = DTM.NULL;
33  
34    /**
35     * Get the next node in the iteration.
36     *
37     * @return The next node handle in the iteration, or END.
38     */
39    public int next();
40  
41  
42    /**
43     * Resets the iterator to the last start node.
44     *
45     * @return A DTMAxisIterator, which may or may not be the same as this
46     *         iterator.
47     */
48    public DTMAxisIterator reset();
49  
50    /**
51     * @return the number of nodes in this iterator.  This may be an expensive
52     * operation when called the first time.
53     */
54    public int getLast();
55  
56    /**
57     * @return The position of the current node in the set, as defined by XPath.
58     */
59    public int getPosition();
60  
61    /**
62     * Remembers the current node for the next call to gotoMark().
63     */
64    public void setMark();
65  
66    /**
67     * Restores the current node remembered by setMark().
68     */
69    public void gotoMark();
70  
71    /**
72     * Set start to END should 'close' the iterator,
73     * i.e. subsequent call to next() should return END.
74     *
75     * @param node Sets the root of the iteration.
76     *
77     * @return A DTMAxisIterator set to the start of the iteration.
78     */
79    public DTMAxisIterator setStartNode(int node);
80  
81    /**
82     * Get start to END should 'close' the iterator,
83     * i.e. subsequent call to next() should return END.
84     *
85     * @return The root node of the iteration.
86     */
87    public int getStartNode();
88  
89    /**
90     * @return true if this iterator has a reversed axis, else false.
91     */
92    public boolean isReverse();
93  
94    /**
95     * @return a deep copy of this iterator. The clone should not be reset
96     * from its current position.
97     */
98    public DTMAxisIterator cloneIterator();
99  
100   /**
101    * Set if restartable.
102    */
103   public void setRestartable(boolean isRestartable);
104 
105   /**
106    * Return the node at the given position.
107    *
108    * @param position The position
109    * @return The node at the given position.
110    */
111   public int getNodeByPosition(int position);
112 }