KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.icl.saxon.tree;
2 import com.icl.saxon.pattern.NodeTest;
3
4 final class PrecedingSiblingEnumeration extends TreeEnumeration {
5     
6     public PrecedingSiblingEnumeration(NodeImpl node, NodeTest nodeTest) {
7         super(node, nodeTest);
8         advance();
9     }
10
11     protected void step() {
12         next = (NodeImpl)next.getPreviousSibling();
13     }
14
15     /**
16     * Get the last position, that is the number of nodes in the enumeration
17     */

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