Class SeqType

java.lang.Object
org.basex.query.value.type.SeqType

public final class SeqType extends Object
Stores a sequence type definition.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Details

    • EMPTY_SEQUENCE_Z

      public static final SeqType EMPTY_SEQUENCE_Z
      Zero items (single instance).
    • ITEM_O

      public static final SeqType ITEM_O
      Single item.
    • ITEM_ZO

      public static final SeqType ITEM_ZO
      Zero or one item.
    • ITEM_ZM

      public static final SeqType ITEM_ZM
      Zero or more items.
    • ITEM_OM

      public static final SeqType ITEM_OM
      One or more items.
    • ANY_ATOMIC_TYPE_O

      public static final SeqType ANY_ATOMIC_TYPE_O
      Zero or one xs:anyAtomicType.
    • ANY_ATOMIC_TYPE_ZO

      public static final SeqType ANY_ATOMIC_TYPE_ZO
      Zero or one xs:anyAtomicType.
    • ANY_ATOMIC_TYPE_ZM

      public static final SeqType ANY_ATOMIC_TYPE_ZM
      Zero or more xs:anyAtomicType.
    • NUMERIC_O

      public static final SeqType NUMERIC_O
      Zero or one xs:numeric.
    • NUMERIC_ZO

      public static final SeqType NUMERIC_ZO
      Zero or one xs:numeric.
    • DOUBLE_O

      public static final SeqType DOUBLE_O
      Double number.
    • DOUBLE_ZO

      public static final SeqType DOUBLE_ZO
      Zero or one double.
    • DOUBLE_ZM

      public static final SeqType DOUBLE_ZM
      Double number.
    • FLOAT_O

      public static final SeqType FLOAT_O
      Float number.
    • DECIMAL_ZO

      public static final SeqType DECIMAL_ZO
      Zero or one decimal number.
    • INTEGER_O

      public static final SeqType INTEGER_O
      Single integer.
    • INTEGER_ZO

      public static final SeqType INTEGER_ZO
      Zero or one integer.
    • INTEGER_ZM

      public static final SeqType INTEGER_ZM
      Zero or more integers.
    • BYTE_ZM

      public static final SeqType BYTE_ZM
      Zero or more bytes.
    • STRING_O

      public static final SeqType STRING_O
      Single string.
    • STRING_ZO

      public static final SeqType STRING_ZO
      Zero or one strings.
    • STRING_ZM

      public static final SeqType STRING_ZM
      Zero or more strings.
    • NCNAME_ZO

      public static final SeqType NCNAME_ZO
      Zero or one NCName.
    • LANGUAGE_O

      public static final SeqType LANGUAGE_O
      Single language.
    • ANY_URI_O

      public static final SeqType ANY_URI_O
      Single URI.
    • ANY_URI_ZO

      public static final SeqType ANY_URI_ZO
      Zero or one URIs.
    • ANY_URI_ZM

      public static final SeqType ANY_URI_ZM
      Zero or more URIs.
    • QNAME_O

      public static final SeqType QNAME_O
      Single QName.
    • QNAME_ZO

      public static final SeqType QNAME_ZO
      Zero or one QNames.
    • BOOLEAN_O

      public static final SeqType BOOLEAN_O
      Single xs:boolean.
    • BOOLEAN_ZO

      public static final SeqType BOOLEAN_ZO
      Zero or one xs:boolean.
    • DATE_O

      public static final SeqType DATE_O
      Single date.
    • DATE_ZO

      public static final SeqType DATE_ZO
      Zero or one date.
    • DAY_TIME_DURATION_O

      public static final SeqType DAY_TIME_DURATION_O
      One day-time-duration.
    • DAY_TIME_DURATION_ZO

      public static final SeqType DAY_TIME_DURATION_ZO
      Zero or one day-time-duration.
    • DATE_TIME_O

      public static final SeqType DATE_TIME_O
      One date-time.
    • DATE_TIME_ZO

      public static final SeqType DATE_TIME_ZO
      Zero or one date-time.
    • TIME_O

      public static final SeqType TIME_O
      One time.
    • TIME_ZO

      public static final SeqType TIME_ZO
      Zero or one time.
    • DURATION_ZO

      public static final SeqType DURATION_ZO
      Zero or one duration.
    • BINARY_O

      public static final SeqType BINARY_O
      Single binary.
    • HEX_BINARY_O

      public static final SeqType HEX_BINARY_O
      One xs:hexBinary.
    • HEX_BINARY_ZO

      public static final SeqType HEX_BINARY_ZO
      Zero or one xs:hexBinary.
    • BASE64_BINARY_O

      public static final SeqType BASE64_BINARY_O
      Single xs:base64Binary.
    • BASE64_BINARY_ZO

      public static final SeqType BASE64_BINARY_ZO
      Zero or one xs:base64Binary.
    • BASE64_BINARY_ZM

      public static final SeqType BASE64_BINARY_ZM
      Zero or more xs:base64Binary.
    • NODE_O

      public static final SeqType NODE_O
      Single node.
    • NODE_ZO

      public static final SeqType NODE_ZO
      Zero or one nodes.
    • NODE_ZM

      public static final SeqType NODE_ZM
      Zero or more nodes.
    • NODE_OM

      public static final SeqType NODE_OM
      One or more nodes.
    • ATTRIBUTE_O

      public static final SeqType ATTRIBUTE_O
      One attribute node.
    • ATTRIBUTE_ZM

      public static final SeqType ATTRIBUTE_ZM
      Zero or more attributes.
    • COMMENT_O

      public static final SeqType COMMENT_O
      One comment node.
    • DOCUMENT_NODE_O

      public static final SeqType DOCUMENT_NODE_O
      One document node.
    • DOCUMENT_NODE_ZO

      public static final SeqType DOCUMENT_NODE_ZO
      Zero or one document node.
    • DOCUMENT_NODE_ZM

      public static final SeqType DOCUMENT_NODE_ZM
      Zero or more document node.
    • ELEMENT_O

      public static final SeqType ELEMENT_O
      One element node.
    • ELEMENT_ZM

      public static final SeqType ELEMENT_ZM
      Zero or more element nodes.
    • NAMESPACE_NODE_O

      public static final SeqType NAMESPACE_NODE_O
      Namespace node.
    • PROCESSING_INSTRUCTION_O

      public static final SeqType PROCESSING_INSTRUCTION_O
      Processing instruction.
    • TEXT_ZO

      public static final SeqType TEXT_ZO
      Zero or one text node.
    • TEXT_ZM

      public static final SeqType TEXT_ZM
      Zero or more text nodes.
    • FUNCTION

      public static final FuncType FUNCTION
      Any function type.
    • MAP

      public static final MapType MAP
      The general map type.
    • ARRAY

      public static final ArrayType ARRAY
      The general array type.
    • FUNCTION_O

      public static final SeqType FUNCTION_O
      Single function.
    • FUNCTION_ZO

      public static final SeqType FUNCTION_ZO
      Zero of single function.
    • FUNCTION_ZM

      public static final SeqType FUNCTION_ZM
      Zero of more functions.
    • MAP_O

      public static final SeqType MAP_O
      Single map.
    • MAP_ZO

      public static final SeqType MAP_ZO
      Zero or one map.
    • MAP_ZM

      public static final SeqType MAP_ZM
      Zero or more maps.
    • ARRAY_O

      public static final SeqType ARRAY_O
      Single array.
    • ARRAY_ZM

      public static final SeqType ARRAY_ZM
      Zero or more arrays.
    • type

      public final Type type
      Item type.
    • occ

      public final Occ occ
      Occurrence indicator.
  • Method Details

    • get

      public static SeqType get(Type type, Occ occ)
      Returns a sequence type.
      Parameters:
      type - type
      occ - occurrence indicator
      Returns:
      sequence type
    • get

      public static SeqType get(Type type, Occ occ, Test test)
      Returns a sequence type.
      Parameters:
      type - type
      occ - occurrence indicator
      test - kind test (can be null; ignored if this is no node type)
      Returns:
      sequence type
    • with

      public SeqType with(Occ oc)
      Returns a sequence type with the specified occurrence indicator.
      Parameters:
      oc - occurrence indicator
      Returns:
      sequence type
    • union

      public SeqType union(Occ oc)
      Returns a sequence type with a new occurrence indicator.
      Parameters:
      oc - occurrence indicator
      Returns:
      sequence type
    • instance

      public boolean instance(Value value)
      Checks if the specified value is an instance of this type.
      Parameters:
      value - value to check
      Returns:
      result of check
    • instance

      public boolean instance(Item item)
      Checks if the specified item is an instance of this sequence type.
      Parameters:
      item - item to check
      Returns:
      result of check
    • cast

      public Value cast(Value value, boolean error, QueryContext qc, StaticContext sc, InputInfo ii) throws QueryException
      Casts a sequence to this type.
      Parameters:
      value - value to cast
      error - raise error (return null otherwise)
      qc - query context
      sc - static context
      ii - input info
      Returns:
      cast value
      Throws:
      QueryException - query exception
    • treat

      public void treat(Value value, QNm name, QueryContext qc, InputInfo ii) throws QueryException
      Treats the specified value as this sequence type.
      Parameters:
      value - value to check
      name - name of variable (can be null)
      qc - query context
      ii - input info
      Throws:
      QueryException - query exception
    • promote

      public Value promote(Value value, QNm name, QueryContext qc, StaticContext sc, InputInfo ii, boolean opt) throws QueryException
      Promotes the specified value to this sequence type.
      Parameters:
      value - value to promote
      name - variable name (can be null)
      qc - query context
      sc - static context
      ii - input info
      opt - if the result should be optimized
      Returns:
      converted value
      Throws:
      QueryException - if the conversion was not possible
    • promote

      public void promote(Item item, QNm name, ItemList items, QueryContext qc, StaticContext sc, InputInfo ii, boolean opt) throws QueryException
      Promotes the specified item to this item type.
      Parameters:
      item - item to promote
      name - variable name (can be null)
      items - item cache
      qc - query context
      sc - static context
      ii - input info
      opt - if the result should be optimized
      Throws:
      QueryException - query exception
    • promotable

      public boolean promotable(SeqType st)
      Checks if this type could be converted to the given one by function conversion.
      Parameters:
      st - type to convert to
      Returns:
      result of check
    • union

      public SeqType union(SeqType st)
      Computes the union of two sequence types, i.e. the lowest common ancestor of both types.
      Parameters:
      st - second type
      Returns:
      resulting type
    • intersect

      public SeqType intersect(SeqType st)
      Computes the intersection of two sequence types, i.e. the most general type that is sub-type of both types. If no such type exists, null is returned.
      Parameters:
      st - second type
      Returns:
      resulting type or null
    • zeroOrOne

      public boolean zeroOrOne()
      Tests if expressions of this type yield at most one item.
      Returns:
      result of check
    • zero

      public boolean zero()
      Tests if expressions of this type yield zero items.
      Returns:
      result of check
    • one

      public boolean one()
      Tests if expressions of this type yield one item.
      Returns:
      result of check
    • oneOrMore

      public boolean oneOrMore()
      Tests if expressions of this type yield one or more items.
      Returns:
      result of check
    • mayBeNumber

      public boolean mayBeNumber()
      Tests if expressions of this type may be numeric. User for predicate rewritings.
      Returns:
      result of check
    • mayBeArray

      public boolean mayBeArray()
      Tests if expressions of this type may be an array.
      Returns:
      result of check
    • instanceOf

      public boolean instanceOf(SeqType st)
      Checks if this sequence type is an instance of the specified sequence type.
      Parameters:
      st - sequence type to check
      Returns:
      result of check
    • kindInstanceOf

      public boolean kindInstanceOf(SeqType st)
      Checks if the kind of this sequence type is an instance of the kind of the specified sequence type.
      Parameters:
      st - sequence type to check
      Returns:
      result of check
    • eq

      public boolean eq(SeqType st)
      Checks the types for equality.
      Parameters:
      st - type
      Returns:
      result of check
    • equals

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

      public String typeString()
      Returns a string representation of the type.
      Returns:
      string
    • toString

      public String toString()
      Overrides:
      toString in class Object