Class RootJNodeType

All Implemented Interfaces:
NodePredicate, NodeTest, ItemType, ItemTypeWithSequenceTypeCache

public class RootJNodeType extends JNodeType
Represents the type jnode((), T) where T is a sequence type giving the type of the JNode content; the node must be a root JNode (that is, its selector and parent properties must be absent)
  • Constructor Details

    • RootJNodeType

      public RootJNodeType(SequenceType valueType)
  • Method Details

    • getValueType

      public SequenceType getValueType()
      Overrides:
      getValueType in class JNodeType
    • 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
    • getBasicAlphaCode

      public String getBasicAlphaCode()
      Get an alphabetic code representing the type, or at any rate, the nearest built-in type from which this type is derived. The codes are designed so that for any two built-in types A and B, alphaCode(A) is a prefix of alphaCode(B) if and only if A is a supertype of B.
      Specified by:
      getBasicAlphaCode in interface ItemType
      Overrides:
      getBasicAlphaCode in class JNodeType
      Returns:
      the alphacode for the nearest containing built-in type. For example: for xs:string return "AS", for xs:boolean "AB", for node() "N", for element() "NE", for map(*) "FM", for array(*) "FA".