KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icl > saxon > pattern > AnyNodeTest


1 package com.icl.saxon.pattern;
2 import com.icl.saxon.om.NodeInfo;
3 import com.icl.saxon.expr.XPathException;
4
5 /**
6   * NodeTest is an interface that enables a test of whether a node has a particular
7   * name and type. An AnyNodeTest matches any node.
8   *
9   * @author <A HREF="mailto:mhkay@iclway.co.uk>Michael H. Kay</A>
10   */

11
12 public final class AnyNodeTest extends NodeTest {
13     
14     static AnyNodeTest instance = new AnyNodeTest();
15     
16     public AnyNodeTest() {
17         originalText = "node()";
18     }
19     
20     /**
21     * Get an instance of AnyNodeTest
22     */

23     
24     public static AnyNodeTest getInstance() {
25         return instance;
26     }
27
28     /**
29     * Test whether this node test is satisfied by a given node
30     */

31
32     public final boolean matches(NodeInfo node) {
33         return true;
34     }
35
36     /**
37     * Test whether this node test is satisfied by a given node
38     * @param nodeType The type of node to be matched
39     * @param fingerprint identifies the expanded name of the node to be matched
40     */

41
42     public final boolean matches(short nodeType, int fingerprint) {
43         return true;
44     }
45
46     /**
47     * Determine the default priority of this node test when used on its own as a Pattern
48     */

49
50     public final double getDefaultPriority() {
51         return -0.5;
52     }
53     
54
55 }
56
57 //
58
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
59
// you may not use this file except in compliance with the License. You may obtain a copy of the
60
// License at http://www.mozilla.org/MPL/
61
//
62
// Software distributed under the License is distributed on an "AS IS" basis,
63
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
64
// See the License for the specific language governing rights and limitations under the License.
65
//
66
// The Original Code is: all this file.
67
//
68
// The Initial Developer of the Original Code is
69
// Michael Kay of International Computers Limited (mhkay@iclway.co.uk).
70
//
71
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
72
//
73
// Contributor(s): none.
74
//
75
Popular Tags