Enum Class NodeType

java.lang.Object
java.lang.Enum<NodeType>
org.basex.query.value.type.NodeType
All Implemented Interfaces:
Serializable, Comparable<NodeType>, java.lang.constant.Constable, Type

public enum NodeType extends Enum<NodeType> implements Type
XQuery node types.
Author:
BaseX Team 2005-21, BSD License, Leo Woerteler
  • Enum Constant Details

    • NODE

      public static final NodeType NODE
      Node type.
    • TEXT

      public static final NodeType TEXT
      Text type.
    • PROCESSING_INSTRUCTION

      public static final NodeType PROCESSING_INSTRUCTION
      PI type.
    • ELEMENT

      public static final NodeType ELEMENT
      Element type.
    • DOCUMENT_NODE

      public static final NodeType DOCUMENT_NODE
      Document type.
    • DOCUMENT_NODE_ELEMENT

      public static final NodeType DOCUMENT_NODE_ELEMENT
      Document element type.
    • ATTRIBUTE

      public static final NodeType ATTRIBUTE
      Attribute type.
    • COMMENT

      public static final NodeType COMMENT
      Comment type.
    • NAMESPACE_NODE

      public static final NodeType NAMESPACE_NODE
      Namespace type.
    • SCHEMA_ELEMENT

      public static final NodeType SCHEMA_ELEMENT
      Schema-element.
    • SCHEMA_ATTRIBUTE

      public static final NodeType SCHEMA_ATTRIBUTE
      Schema-attribute.
  • Field Details

    • LEAF_TYPES

      public static final NodeType[] LEAF_TYPES
      Leaf node types.
  • Method Details

    • values

      public static NodeType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static NodeType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isNumber

      public final boolean isNumber()
      Description copied from interface: Type
      Checks if items with this type are numbers.
      Specified by:
      isNumber in interface Type
      Returns:
      result of check
    • isUntyped

      public final boolean isUntyped()
      Description copied from interface: Type
      Checks if items with this type are untyped.
      Specified by:
      isUntyped in interface Type
      Returns:
      result of check
    • isNumberOrUntyped

      public final boolean isNumberOrUntyped()
      Description copied from interface: Type
      Checks if items with this type are numbers or untyped.
      Specified by:
      isNumberOrUntyped in interface Type
      Returns:
      result of check
    • isStringOrUntyped

      public boolean isStringOrUntyped()
      Description copied from interface: Type
      Checks if items of this type are strings or untyped. Returns if this item is untyped or a string.
      Specified by:
      isStringOrUntyped in interface Type
      Returns:
      result of check
    • isSortable

      public final boolean isSortable()
      Description copied from interface: Type
      Checks if items of this type are sortable.
      Specified by:
      isSortable in interface Type
      Returns:
      result of check
    • cast

      public final Item cast(Item item, QueryContext qc, StaticContext sc, InputInfo ii) throws QueryException
      Description copied from interface: Type
      Casts the specified item to this type.
      Specified by:
      cast in interface Type
      Parameters:
      item - item to be converted
      qc - query context
      sc - static context
      ii - input info
      Returns:
      cast value
      Throws:
      QueryException - query exception
    • cast

      public Item cast(Object value, QueryContext qc, StaticContext sc, InputInfo ii) throws QueryException
      Description copied from interface: Type
      Casts the specified Java value to this type.
      Specified by:
      cast in interface Type
      Parameters:
      value - Java value
      qc - query context
      sc - static context
      ii - input info
      Returns:
      cast value
      Throws:
      QueryException - query exception
    • castString

      public final Item castString(String value, QueryContext qc, StaticContext sc, InputInfo ii) throws QueryException
      Description copied from interface: Type
      Casts the specified string to this type.
      Specified by:
      castString in interface Type
      Parameters:
      value - string object
      qc - query context
      sc - static context
      ii - input info
      Returns:
      cast value
      Throws:
      QueryException - query exception
    • seqType

      public final SeqType seqType(Occ occ)
      Description copied from interface: Type
      Internal function for creating a sequence type with the specified occurrence indicator.
      Specified by:
      seqType in interface Type
      Parameters:
      occ - occurrence indicator
      Returns:
      sequence type
      See Also:
    • qname

      public final QNm qname()
      Returns the name of a node type.
      Returns:
      name
    • eq

      public final boolean eq(Type type)
      Description copied from interface: Type
      Checks if this type is equal to the given one.
      Specified by:
      eq in interface Type
      Parameters:
      type - other type
      Returns:
      true if both types are equal, false otherwise
    • instanceOf

      public final boolean instanceOf(Type type)
      Description copied from interface: Type
      Checks if the current type is an instance of the specified type.
      Specified by:
      instanceOf in interface Type
      Parameters:
      type - type to be checked
      Returns:
      result of check
    • union

      public final Type union(Type type)
      Description copied from interface: Type
      Computes the union between this type and the given one, i.e. the least common ancestor of both types in the type hierarchy.
      Specified by:
      union in interface Type
      Parameters:
      type - other type
      Returns:
      union type
    • intersect

      public final Type intersect(Type type)
      Description copied from interface: Type
      Computes the intersection between this type and the given one, i.e. the least specific type that is sub-type of both types. If no such type exists, null is returned.
      Specified by:
      intersect in interface Type
      Parameters:
      type - other type
      Returns:
      intersection type or null
    • atomic

      public final AtomType atomic()
      Description copied from interface: Type
      Returns the atomic type.
      Specified by:
      atomic in interface Type
      Returns:
      atomic type (can be null, e.g. for function types)
    • id

      public final Type.ID id()
      Description copied from interface: Type
      Returns a type id to differentiate all types.
      Specified by:
      id in interface Type
      Returns:
      id
    • nsSensitive

      public boolean nsSensitive()
      Description copied from interface: Type
      Checks if the type is namespace-sensitive.
      Specified by:
      nsSensitive in interface Type
      Returns:
      result of check
    • toString

      public final String toString()
      Specified by:
      toString in interface Type
      Overrides:
      toString in class Enum<NodeType>
    • toString

      public final String toString(String arg)
      Returns a string representation with the specified argument.
      Parameters:
      arg - argument
      Returns:
      string representation
    • find

      public static NodeType find(QNm name)
      Finds and returns the specified node type.
      Parameters:
      name - name of type
      Returns:
      type or null