Class Test

java.lang.Object
org.basex.query.expr.ExprInfo
org.basex.query.expr.path.Test
Direct Known Subclasses:
DocTest, KindTest, NameTest, UnionTest

public abstract class Test extends ExprInfo
Abstract node test.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Details

    • type

      public final NodeType type
      Node type.
  • Method Details

    • get

      public static Test get(NodeType type, QNm name)
      Returns a node test, a name test or null.
      Parameters:
      type - node type (element, attribute, processing instruction)
      name - node name
      Returns:
      test or null
    • get

      public static Test get(NodeType type, QNm name, Type ann, byte[] ns)
      Returns a node test, a name test or null.
      Parameters:
      type - node type (element, attribute, processing instruction)
      name - node name (can be null)
      ann - type annotation (can be null)
      ns - default element namespace (can be null)
      Returns:
      test or null
    • get

      public static Test get(Test... tests)
      Creates a single test with the same node type.
      Parameters:
      tests - tests to be merged (can contain null references)
      Returns:
      single test, union test, or null if test cannot be created.
    • noMatches

      public boolean noMatches(Data data)
      Checks if evaluation can be dropped.
      Parameters:
      data - data reference (can be null)
      Returns:
      result of check
    • matches

      public abstract boolean matches(ANode node)
      Checks if the specified node matches the test.
      Parameters:
      node - node to be checked
      Returns:
      result of check
    • matches

      public final boolean matches(Item item)
      Checks if the specified item matches the test.
      Parameters:
      item - item to be checked
      Returns:
      result of check
    • copy

      public abstract Test copy()
      Copies this test.
      Returns:
      deep copy
    • instanceOf

      public boolean instanceOf(Test test)
      Checks if the current test is an instance of the specified test.
      Parameters:
      test - test to be checked
      Returns:
      result of check
    • intersect

      public abstract Test intersect(Test test)
      Computes the intersection between two tests.
      Parameters:
      test - other test
      Returns:
      intersection if it exists, null otherwise
    • toString

      public abstract String toString(boolean full)
      Returns a string representation of this test.
      Parameters:
      full - include node type
      Returns:
      string
    • plan

      public void plan(QueryPlan plan)
      Description copied from class: ExprInfo
      Creates a query plan.
      Specified by:
      plan in class ExprInfo
      Parameters:
      plan - expression plan
    • plan

      public final void plan(QueryString qs)
      Description copied from class: ExprInfo
      Creates a query string.
      Specified by:
      plan in class ExprInfo
      Parameters:
      qs - query string builder