KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.icl.saxon.pattern;
2 import com.icl.saxon.om.NodeInfo;
3 import com.icl.saxon.pattern.Pattern;
4 import com.icl.saxon.Context;
5 import com.icl.saxon.expr.XPathException;
6
7 /**
8   * A NodeTest is a simple kind of pattern that enables a context-free test of whether
9   * a node has a particular
10   * name. There are five kinds of name test: a full name test, a prefix test, and an
11   * "any node of a given type" test, an "any node of any type" test, and a "no nodes"
12   * test (used, e.g. for "@comment()")
13   *
14   * @author <A HREF="mailto:mhkay@iclway.co.uk>Michael H. Kay</A>
15   */

16
17 public abstract class NodeTest extends Pattern {
18
19     /**
20     * Test whether this node test is satisfied by a given node
21     */

22
23     public abstract boolean matches(NodeInfo node);
24
25     /**
26     * Test whether this node test is satisfied by a given node
27     * @param nodeType The type of node to be matched
28     * @param fingerprint identifies the expanded name of the node to be matched.
29     * The value should be -1 for a node with no name.
30     */

31
32     public abstract boolean matches(short nodeType, int fingerprint);
33
34     /**
35     * Test whether this node test is satisfied by a given node, in a given Context
36     */

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