01: package net.sf.saxon.tree;
02:
03: import net.sf.saxon.om.SequenceIterator;
04: import net.sf.saxon.pattern.NodeTest;
05:
06: final class DescendantEnumeration extends TreeEnumeration {
07:
08: private NodeImpl root;
09: private boolean includeSelf;
10:
11: public DescendantEnumeration(NodeImpl node, NodeTest nodeTest,
12: boolean includeSelf) {
13: super (node, nodeTest);
14: root = node;
15: this .includeSelf = includeSelf;
16: if (!includeSelf || !conforms(node)) {
17: advance();
18: }
19: }
20:
21: protected void step() {
22: next = next.getNextInDocument(root);
23: }
24:
25: /**
26: * Get another enumeration of the same nodes
27: */
28:
29: public SequenceIterator getAnother() {
30: return new DescendantEnumeration(start, nodeTest, includeSelf);
31: }
32: }
33:
34: //
35: // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
36: // you may not use this file except in compliance with the License. You may obtain a copy of the
37: // License at http://www.mozilla.org/MPL/
38: //
39: // Software distributed under the License is distributed on an "AS IS" basis,
40: // WITHOUT WARRANTY OF ANY KIND, either express or implied.
41: // See the License for the specific language governing rights and limitations under the License.
42: //
43: // The Original Code is: all this file.
44: //
45: // The Initial Developer of the Original Code is Michael H. Kay.
46: //
47: // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
48: //
49: // Contributor(s): none.
50: //
|