Class SpecificJNodeType

All Implemented Interfaces:
NodePredicate, NodeTest, ItemType, ItemTypeWithSequenceTypeCache

public class SpecificJNodeType extends JNodeType
Represents the type jnode(S, T) where T is a sequence type giving the type of the JNode content and S is a selector value, or null meaning "*" indicating that the selector can be any value (including absent).
  • Constructor Details

  • Method Details

    • jTreeRoot

      public static SpecificJNodeType jTreeRoot(SequenceType valueType)
    • getValueType

      public SequenceType getValueType()
      Overrides:
      getValueType in class JNodeType
    • getSelector

      public AtomicValue getSelector()
    • matches

      public boolean matches(Item item)
      Test whether a given item conforms to this type
      Specified by:
      matches in interface ItemType
      Specified by:
      matches in class GNodeType
      Parameters:
      item - The item to be tested
      Returns:
      true if the item is an instance of this type; false otherwise
    • getAtomizedItemType

      public PlainType getAtomizedItemType()
      Get the item type of the atomic values that will be produced when an item of this type is atomized
      Specified by:
      getAtomizedItemType in interface ItemType
      Overrides:
      getAtomizedItemType in class GNodeType
      Returns:
      the best available item type of the atomic values that will be produced when an item of this type is atomized, or null if it is known that atomization will throw an error.
    • isAtomizable

      public boolean isAtomizable(TypeHierarchy th)
      Ask whether values of this type are atomizable
      Specified by:
      isAtomizable in interface ItemType
      Overrides:
      isAtomizable in class GNodeType
      Parameters:
      th - the type hierarchy cache
      Returns:
      true if some or all instances of this type can be successfully atomized; false if no instances of this type can be atomized
    • 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 ItemType
      Specified by:
      explainMismatch in interface NodeTest
      Overrides:
      explainMismatch in class GNodeType
      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
    • toString

      public String toString()
      Return a string representation of this ItemType.
      Overrides:
      toString in class Object
      Returns:
      the string representation
    • isNillable

      public boolean isNillable()
      Determine whether the content type (if present) is nillable
      Returns:
      true if the content test (when present) can match nodes that are nilled