KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icl > saxon > tree > ChildEnumeration


1 package com.icl.saxon.tree;
2 import com.icl.saxon.om.NodeInfo;
3 import com.icl.saxon.pattern.NodeTest;
4
5 final class ChildEnumeration extends TreeEnumeration {
6     
7     public ChildEnumeration(NodeImpl node, NodeTest nodeTest) {
8         super(node, nodeTest);
9         next = (NodeImpl)node.getFirstChild();
10         while (!conforms(next)) {
11             step();
12         }
13     }
14
15     protected void step() {
16         next = (NodeImpl)next.getNextSibling();
17     }
18
19     public boolean isSorted() {
20         return true;
21     }
22
23     public boolean isPeer() {
24         return true;
25     }
26
27     /**
28     * Get the last position, that is the number of nodes in the enumeration
29     */

30
31     public int getLastPosition() {
32         if (last>=0) return last;
33         ChildEnumeration enum =
34             new ChildEnumeration(start, nodeTest);
35         return enum.count();
36     }
37
38 }
39
40
41 //
42
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
43
// you may not use this file except in compliance with the License. You may obtain a copy of the
44
// License at http://www.mozilla.org/MPL/
45
//
46
// Software distributed under the License is distributed on an "AS IS" basis,
47
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
48
// See the License for the specific language governing rights and limitations under the License.
49
//
50
// The Original Code is: all this file.
51
//
52
// The Initial Developer of the Original Code is
53
// Michael Kay of International Computers Limited (mhkay@iclway.co.uk).
54
//
55
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
56
//
57
// Contributor(s): none.
58
//
59
Popular Tags