KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xml > dtm > DTMAxisIterator


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17  * $Id: DTMAxisIterator.java,v 1.7 2004/02/16 23:03:44 minchau Exp $
18  */

19 package org.apache.xml.dtm;
20
21 /**
22  * This class iterates over a single XPath Axis, and returns node handles.
23  */

24 public interface DTMAxisIterator extends Cloneable JavaDoc
25 {
26
27   /** Specifies the end of the iteration, and is the same as DTM.NULL. */
28   public static final int END = DTM.NULL;
29
30   /**
31    * Get the next node in the iteration.
32    *
33    * @return The next node handle in the iteration, or END.
34    */

35   public int next();
36   
37
38   /**
39    * Resets the iterator to the last start node.
40    *
41    * @return A DTMAxisIterator, which may or may not be the same as this
42    * iterator.
43    */

44   public DTMAxisIterator reset();
45
46   /**
47    * @return the number of nodes in this iterator. This may be an expensive
48    * operation when called the first time.
49    */

50   public int getLast();
51
52   /**
53    * @return The position of the current node in the set, as defined by XPath.
54    */

55   public int getPosition();
56
57   /**
58    * Remembers the current node for the next call to gotoMark().
59    */

60   public void setMark();
61
62   /**
63    * Restores the current node remembered by setMark().
64    */

65   public void gotoMark();
66
67   /**
68    * Set start to END should 'close' the iterator,
69    * i.e. subsequent call to next() should return END.
70    *
71    * @param node Sets the root of the iteration.
72    *
73    * @return A DTMAxisIterator set to the start of the iteration.
74    */

75   public DTMAxisIterator setStartNode(int node);
76
77   /**
78    * Get start to END should 'close' the iterator,
79    * i.e. subsequent call to next() should return END.
80    *
81    * @return The root node of the iteration.
82    */

83   public int getStartNode();
84
85   /**
86    * @return true if this iterator has a reversed axis, else false.
87    */

88   public boolean isReverse();
89
90   /**
91    * @return a deep copy of this iterator. The clone should not be reset
92    * from its current position.
93    */

94   public DTMAxisIterator cloneIterator();
95   
96   /**
97    * Set if restartable.
98    */

99   public void setRestartable(boolean isRestartable);
100
101   /**
102    * Return the node at the given position.
103    *
104    * @param position The position
105    * @return The node at the given position.
106    */

107   public int getNodeByPosition(int position);
108 }
109
Popular Tags