Class MultipleNodeKindTest

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

public final class MultipleNodeKindTest extends Object implements NodeTest
An MultipleNodeKindTest is a nodetest that matches nodes belonging to any subset of possible node kinds, for example element and document nodes, or attribute and namespace nodes
  • Field Details

  • Constructor Details

    • MultipleNodeKindTest

      public MultipleNodeKindTest(UType u)
  • Method Details

    • getItemType

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

      public NodeTest asXNodeTest(Configuration config)
      Description copied from interface: NodeTest
      Get an XNodeTest that will match any XNode that this NodeTest matches: that is, eliminate the possibility of matching a JNode.
      Specified by:
      asXNodeTest in interface NodeTest
    • getUType

      public UType getUType()
      Get the corresponding UType. A UType is a union of primitive item types.
      Specified by:
      getUType in interface NodeTest
      Returns:
      the smallest UType that subsumes this item type
    • getQNameTest

      public QNameTest getQNameTest()
      Description copied from interface: NodeTest
      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
    • 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
    • test

      public boolean test(GNode node)
      Test whether this node test is satisfied by a given node. This alternative method is used in the case of nodes where calculating the fingerprint is expensive, for example DOM or JDOM nodes.
      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
    • getDefaultPriority

      public double getDefaultPriority()
      Determine the default priority to use if this pattern 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
    • toString

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

      public String toShortString()
      Description copied from interface: NodeTest
      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
    • hashCode

      public int hashCode()
      Returns a hash code value for the object.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object