KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xpath > axes > ContextNodeList


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: ContextNodeList.java,v 1.9 2004/02/17 04:32:08 minchau Exp $
18  */

19 package org.apache.xpath.axes;
20
21 import org.w3c.dom.Node JavaDoc;
22 import org.w3c.dom.traversal.NodeIterator;
23
24 /**
25  * Classes who implement this interface can be a
26  * <a HREF="http://www.w3.org/TR/xslt#dt-current-node-list">current node list</a>,
27  * also refered to here as a <term>context node list</term>.
28  * @xsl.usage advanced
29  */

30 public interface ContextNodeList
31 {
32
33   /**
34    * Get the <a HREF="http://www.w3.org/TR/xslt#dt-current-node">current node</a>.
35    *
36    *
37    * @return The current node, or null.
38    */

39   public Node JavaDoc getCurrentNode();
40
41   /**
42    * Get the current position, which is one less than
43    * the next nextNode() call will retrieve. i.e. if
44    * you call getCurrentPos() and the return is 0, the next
45    * fetch will take place at index 1.
46    *
47    * @return The position of the
48    * <a HREF="http://www.w3.org/TR/xslt#dt-current-node">current node</a>
49    * in the <a HREF="http://www.w3.org/TR/xslt#dt-current-node-list">current node list</a>.
50    */

51   public int getCurrentPos();
52
53   /**
54    * Reset the iterator.
55    */

56   public void reset();
57
58   /**
59    * If setShouldCacheNodes(true) is called, then nodes will
60    * be cached. They are not cached by default.
61    *
62    * @param b true if the nodes should be cached.
63    */

64   public void setShouldCacheNodes(boolean b);
65
66   /**
67    * If an index is requested, NodeSetDTM will call this method
68    * to run the iterator to the index. By default this sets
69    * m_next to the index. If the index argument is -1, this
70    * signals that the iterator should be run to the end.
71    *
72    * @param index The index to run to, or -1 if the iterator should be run
73    * to the end.
74    */

75   public void runTo(int index);
76
77   /**
78    * Set the current position in the node set.
79    * @param i Must be a valid index.
80    */

81   public void setCurrentPos(int i);
82
83   /**
84    * Get the length of the list.
85    *
86    * @return The number of nodes in this node list.
87    */

88   public int size();
89
90   /**
91    * Tells if this NodeSetDTM is "fresh", in other words, if
92    * the first nextNode() that is called will return the
93    * first node in the set.
94    *
95    * @return true if the iteration of this list has not yet begun.
96    */

97   public boolean isFresh();
98
99   /**
100    * Get a cloned Iterator that is reset to the start of the iteration.
101    *
102    * @return A clone of this iteration that has been reset.
103    *
104    * @throws CloneNotSupportedException
105    */

106   public NodeIterator cloneWithReset() throws CloneNotSupportedException JavaDoc;
107
108   /**
109    * Get a clone of this iterator. Be aware that this operation may be
110    * somewhat expensive.
111    *
112    *
113    * @return A clone of this object.
114    *
115    * @throws CloneNotSupportedException
116    */

117   public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc;
118
119   /**
120    * Get the index of the last node in this list.
121    *
122    *
123    * @return the index of the last node in this list.
124    */

125   public int getLast();
126
127   /**
128    * Set the index of the last node in this list.
129    *
130    *
131    * @param last the index of the last node in this list.
132    */

133   public void setLast(int last);
134 }
135
Popular Tags