Qizx/open API

net.axyana.qizxopen.dm
Class BaseNodeTest

java.lang.Object
  extended bynet.axyana.qizxopen.dm.BaseNodeTest
All Implemented Interfaces:
NodeTest, java.io.Serializable
Direct Known Subclasses:
AttributeTest, ElementTest

public class BaseNodeTest
extends java.lang.Object
implements NodeTest, java.io.Serializable

Tests a node by node kind, and by name if appropriate. Supports wildcards.

See Also:
Serialized Form

Field Summary
 int kind
          Tested kind (ELEMENT TEXT PI COMMENT..., or -1 for node())
 java.lang.String name
          Localname test: null if not specified (* or ns:*)
 Namespace namespace
          Namespace test: null if not specified (* or *:NCName)
 QName qname
          Accelerator, non-null if non-null namespace and name.
 
Constructor Summary
BaseNodeTest(int kind, Namespace namespace, java.lang.String name)
          Builds a node test specifying the node-kind and optionally the name of nodes to match.
 
Method Summary
 boolean accepts(int nodeKind, QName nodeName)
          Optimized test method.
 boolean accepts(Node node)
          Generic test method.
 int getNodeKind()
          Returns the node kind (Node.ELEMENT, Node.TEXT etc) specifically matched, or -1 if several kinds can be matched.
 boolean needsNode()
          Tells whether more information than the node kind and its name are necessary to perform the test.
 boolean staticallyCheckable()
          Returns true for simple node test (node kind only).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kind

public int kind
Tested kind (ELEMENT TEXT PI COMMENT..., or -1 for node())


namespace

public Namespace namespace
Namespace test: null if not specified (* or *:NCName)


name

public java.lang.String name
Localname test: null if not specified (* or ns:*)


qname

public QName qname
Accelerator, non-null if non-null namespace and name.

Constructor Detail

BaseNodeTest

public BaseNodeTest(int kind,
                    Namespace namespace,
                    java.lang.String name)
Builds a node test specifying the node-kind and optionally the name of nodes to match.

Parameters:
kind - the node-kind as defined in Node: ELEMENT, ATTRIBUTE, TEXT etc.
namespace - of the node name. If null, represents the wildcard *:NCName.
name - local part of node name. If null, represents the wildcard ns:* or *.
Method Detail

toString

public java.lang.String toString()

getNodeKind

public int getNodeKind()
Description copied from interface: NodeTest
Returns the node kind (Node.ELEMENT, Node.TEXT etc) specifically matched, or -1 if several kinds can be matched.

Specified by:
getNodeKind in interface NodeTest

staticallyCheckable

public boolean staticallyCheckable()
Description copied from interface: NodeTest
Returns true for simple node test (node kind only).

Specified by:
staticallyCheckable in interface NodeTest

accepts

public boolean accepts(int nodeKind,
                       QName nodeName)
Description copied from interface: NodeTest
Optimized test method. Can be used if only the node-kind and its name are necessary. This condition can be tested with method NodeTest.needsNode().

Specified by:
accepts in interface NodeTest
Returns:
true if node matched. A null name is always accepted.

needsNode

public boolean needsNode()
Description copied from interface: NodeTest
Tells whether more information than the node kind and its name are necessary to perform the test.

Specified by:
needsNode in interface NodeTest
Returns:
true if the node itself is necessary for checking (not only the kind and name). Allows optimization (avoids building a Node just for testing). Returns true for extended tests like DocumentTest.

accepts

public boolean accepts(Node node)
Description copied from interface: NodeTest
Generic test method.

Specified by:
accepts in interface NodeTest
Returns:
true if node matched. Used for extended tests like DocumentTest.

© 2005 Axyana Software