org.basex.query.path
Class Test

java.lang.Object
  extended by org.basex.query.path.Test
Direct Known Subclasses:
DocTest, NameTest, NodeTest

public abstract class Test
extends java.lang.Object

Abstract node test.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Nested Class Summary
static class Test.Mode
          Name test types.
 
Field Summary
static org.basex.query.path.KindTest ATT
          Static attribute node test.
static org.basex.query.path.KindTest COM
          Static comment node test.
static org.basex.query.path.KindTest DOC
          Static document node test.
static org.basex.query.path.KindTest ELM
          Static element node test.
 Test.Mode mode
          Type of name test.
 QNm name
          Name test.
static Test NOD
          Static node test.
static org.basex.query.path.KindTest NSP
          Static comment node test.
static org.basex.query.path.KindTest PI
          Static PI node test.
static org.basex.query.path.KindTest TXT
          Static text node test.
 NodeType type
          Type of node test.
 
Constructor Summary
Test()
           
 
Method Summary
 boolean compile(QueryContext ctx)
          Optimizes and compiles the expression.
abstract  Test copy()
          Copies this test.
abstract  boolean eq(ANode node)
          Tests if the test yields true.
 boolean eq(Item item)
          Tests if the test yields true.
static Test get(NodeType t)
          Returns a test instance.
abstract  Test intersect(Test other)
          Computes the intersection between two tests.
 boolean nsSensitive()
          Checks if this test is namespace-sensitive.
 boolean sameAs(Test t)
          Checks the current and specified test for equality.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TXT

public static final org.basex.query.path.KindTest TXT
Static text node test.


PI

public static final org.basex.query.path.KindTest PI
Static PI node test.


ELM

public static final org.basex.query.path.KindTest ELM
Static element node test.


DOC

public static final org.basex.query.path.KindTest DOC
Static document node test.


ATT

public static final org.basex.query.path.KindTest ATT
Static attribute node test.


COM

public static final org.basex.query.path.KindTest COM
Static comment node test.


NSP

public static final org.basex.query.path.KindTest NSP
Static comment node test.


NOD

public static final Test NOD
Static node test.


type

public NodeType type
Type of node test.


mode

public Test.Mode mode
Type of name test. Set to null for other kind tests.


name

public QNm name
Name test. Set to null for other kind tests.

Constructor Detail

Test

public Test()
Method Detail

get

public static Test get(NodeType t)
Returns a test instance.

Parameters:
t - node type
Returns:
kind test

compile

public boolean compile(QueryContext ctx)
Optimizes and compiles the expression.

Parameters:
ctx - query context
Returns:
false if test always returns false

eq

public abstract boolean eq(ANode node)
Tests if the test yields true.

Parameters:
node - node to be checked
Returns:
result of check

eq

public boolean eq(Item item)
Tests if the test yields true.

Parameters:
item - item to be checked
Returns:
result of check

sameAs

public final boolean sameAs(Test t)
Checks the current and specified test for equality.

Parameters:
t - test to be compared
Returns:
result of check

copy

public abstract Test copy()
Copies this test.

Returns:
deep copy

nsSensitive

public boolean nsSensitive()
Checks if this test is namespace-sensitive.

Returns:
result of check

intersect

public abstract Test intersect(Test other)
Computes the intersection between two tests.

Parameters:
other - other test
Returns:
intersection if it exists, null otherwise