Class NodeTestStar

java.lang.Object
net.sf.saxon.pattern.nodetest.NodeTestStar
All Implemented Interfaces:
NodePredicate, NodeTest

public class NodeTestStar extends Object implements NodeTest
A node test representing the syntax * - meaning either all children of a JNode, or all children of the principal node kind of the axis in the case of an XNode
  • Constructor Details

    • NodeTestStar

      public NodeTestStar(int defaultNodeKind)
      Create the test
      Parameters:
      defaultNodeKind - the default node kind for the axis on which the node test appears. This is relevant only when the step is used to select within an XTree, but we need to keep the information "just in case".
  • Method Details

    • getDefaultNodeKind

      public int getDefaultNodeKind()
      Get the default node kind of the axis used in the containing step.
      Returns:
      the default node kind (always element, attribute, or namespace)
    • getDefaultPriority

      public double getDefaultPriority()
      Determine the default priority to use if this node-test appears as a match pattern for a template with no explicit priority attribute.
      Specified by:
      getDefaultPriority in interface NodeTest
      Returns:
      the default priority for the pattern
    • getQNameTest

      public QNameTest getQNameTest()
      Extract a QNameTest (the strongest one possible) that must be satisfied by a node if it is to satisfy this NodeTest
      Specified by:
      getQNameTest in interface NodeTest
      Returns:
      the strongest possible QNameTest
    • asXNodeTest

      public NodeTest asXNodeTest(Configuration config)
      Convert to a test that only matches XNodes
      Specified by:
      asXNodeTest in interface NodeTest
    • test

      public boolean test(GNode node)
      Test whether this node test is satisfied by a given node.
      Specified by:
      test in interface NodePredicate
      Specified by:
      test in interface NodeTest
      Parameters:
      node - the node to be matched
      Returns:
      true if the node test is satisfied by the supplied node, false otherwise
    • getItemType

      public ItemType getItemType()
      Get an item type that all matching nodes must satisfy
      Specified by:
      getItemType in interface NodeTest
      Returns:
      an item type
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getUType

      public UType getUType()
      Get a UType that all matching nodes must satisfy
      Specified by:
      getUType in interface NodeTest
      Returns:
      a UType
    • isNillable

      public boolean isNillable()
      Determine whether the content type (if present) is nillable
      Specified by:
      isNillable in interface NodeTest
      Returns:
      true if the content test (when present) can match nodes that are nilled
    • explainMismatch

      public Optional<String> explainMismatch(Item item, TypeHierarchy th)
      Get extra diagnostic information about why a supplied item does not conform to this item type, if available. If extra information is returned, it should be in the form of a complete sentence, minus the closing full stop. No information should be returned for obvious cases.
      Specified by:
      explainMismatch in interface NodeTest
      Parameters:
      item - the item that doesn't match this type
      th - the type hierarchy cache
      Returns:
      optionally, a message explaining why the item does not match the type
    • toShortString

      public String toShortString()
      Get a concise string representation of this node test for use in diagnostics
      Specified by:
      toShortString in interface NodeTest
      Returns:
      a suitably abbreviated respresention of the node test