KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > om > AxisIteratorImpl


1 package net.sf.saxon.om;
2
3 /**
4  * A SequenceIterator is used to iterate over a sequence. An AxisIterator
5  * is a SequenceIterator that always iterates over a set of nodes, and that
6  * throws no exceptions; it also supports the ability
7  * to find the last() position, again with no exceptions.
8  * This class is an abstract implementation of AxisIterator that is used
9  * as a base class for many concrete implementations. The main functionality
10  * that it provides is maintaining the current position.
11  */

12
13 public abstract class AxisIteratorImpl implements AxisIterator, AtomizableIterator {
14
15     protected int position = 0;
16     protected Item current;
17     private boolean isAtomizing;
18
19     /**
20      * Get the current node in the sequence.
21      * @return the node returned by the most recent call on next()
22      */

23
24     public final Item current() {
25         return current;
26     }
27
28     /**
29      * Get the current position
30      * @return the position of the most recent node returned by next()
31      */

32
33     public final int position() {
34         return position;
35     }
36
37     /**
38      * Indicate that any nodes returned in the sequence will be atomized. This
39      * means that if it wishes to do so, the implementation can return the typed
40      * values of the nodes rather than the nodes themselves. The implementation
41      * is free to ignore this hint.
42      * @param atomizing true if the caller of this iterator will atomize any
43      * nodes that are returned, and is therefore willing to accept the typed
44      * value of the nodes instead of the nodes themselves.
45      */

46
47     public void setIsAtomizing(boolean atomizing) {
48         isAtomizing = atomizing;
49     }
50
51     /**
52      * Determine whether any nodes returned by this iterator will be atomized,
53      * in which case the supplier has the option of atomizing them eagerly.
54      */

55
56     protected final boolean isAtomizing() {
57         return isAtomizing;
58     }
59
60     /**
61      * Get properties of this iterator, as a bit-significant integer.
62      *
63      * @return the properties of this iterator. This will be some combination of
64      * properties such as {@link GROUNDED}, {@link LAST_POSITION_FINDER},
65      * and {@link LOOKAHEAD}. It is always
66      * acceptable to return the value zero, indicating that there are no known special properties.
67      * It is acceptable for the properties of the iterator to change depending on its state.
68      */

69
70     public int getProperties() {
71         return 0;
72     }
73
74 }
75
76
77
78 //
79
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
80
// you may not use this file except in compliance with the License. You may obtain a copy of the
81
// License at http://www.mozilla.org/MPL/
82
//
83
// Software distributed under the License is distributed on an "AS IS" basis,
84
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
85
// See the License for the specific language governing rights and limitations under the License.
86
//
87
// The Original Code is: all this file.
88
//
89
// The Initial Developer of the Original Code is Michael H. Kay.
90
//
91
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
92
//
93
// Contributor(s): none.
94
//
95
Popular Tags