Class FuncType

java.lang.Object
org.basex.query.value.type.FuncType
All Implemented Interfaces:
Type
Direct Known Subclasses:
ArrayType, MapType

public class FuncType extends Object implements Type
XQuery 3.0 function types.
Author:
BaseX Team 2005-21, BSD License, Leo Woerteler
  • Field Details

    • FUNCTION

      public static final byte[] FUNCTION
      Name.
    • anns

      public final AnnList anns
      Annotations.
    • declType

      public final SeqType declType
      Return type of the function.
    • argTypes

      public final SeqType[] argTypes
      Argument types (can be null, indicated that no types were specified).
  • Method Details

    • 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 final 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
    • seqType

      public 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:
    • cast

      public FItem 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 final Item cast(Object value, QueryContext qc, StaticContext sc, InputInfo ii)
      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
    • castString

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

      public 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 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 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 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
    • get

      public static FuncType get(AnnList anns, SeqType declType, SeqType... args)
      Getter for function types.
      Parameters:
      anns - annotations
      declType - declared return type
      args - argument types
      Returns:
      function type
    • get

      public static FuncType get(SeqType declType, SeqType... args)
      Getter for function types without annotations.
      Parameters:
      declType - declared return type
      args - argument types
      Returns:
      function type
    • find

      public static Type find(QNm name)
      Finds and returns the specified function type.
      Parameters:
      name - name of type
      Returns:
      type or null
    • similar

      public static byte[] similar(QNm qname)
      Returns an info message for a similar function.
      Parameters:
      qname - name of type
      Returns:
      info string
    • get

      public static FuncType get(AnnList anns, SeqType declType, Var[] params)
      Getter for a function's type.
      Parameters:
      anns - annotations
      declType - declared return type (can be null)
      params - formal parameters
      Returns:
      function type
    • 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 String toString()
      Specified by:
      toString in interface Type
      Overrides:
      toString in class Object