org.basex.query.value.type
Interface Type

All Known Implementing Classes:
AtomType, FuncType, ListType, MapType, NodeType

public interface Type

XQuery data types.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Nested Class Summary
static class Type.ID
          Type IDs for client/server communication.
 
Method Summary
 Value cast(Item it, QueryContext ctx, InputInfo ii)
          Casts the specified item to the XQuery data type.
 Value cast(java.lang.Object o, QueryContext ctx, InputInfo ii)
          Casts the specified Java object to the XQuery data type.
 Value castString(java.lang.String s, QueryContext ctx, InputInfo ii)
          Casts the specified string to the XQuery data type.
 boolean eq(Type t)
          Checks if this type is equal to the given one.
 Type.ID id()
          Returns a type id to differentiate all types.
 boolean instanceOf(Type t)
          Checks if the current type is an instance of the specified type.
 Type intersect(Type t)
          Computes the intersection between this type and the given one, i.e.
 boolean isNode()
          Checks if the type refers to a node.
 boolean isNumber()
          Checks if the type refers to a number.
 boolean isNumberOrUntyped()
          Checks if the type refers to a number or an untyped item.
 boolean isStringOrUntyped()
          Checks if the type refers to a number or a string.
 boolean isUntyped()
          Checks if the type refers to an untyped item.
 boolean nsSensitive()
          Checks if the type is namespace-sensitive.
 SeqType seqType()
          Returns the sequence type of this data type.
 byte[] string()
          Returns the string representation of this type.
 java.lang.String toString()
           
 Type union(Type t)
          Computes the union between this type and the given one, i.e.
 

Method Detail

cast

Value cast(Item it,
           QueryContext ctx,
           InputInfo ii)
           throws QueryException
Casts the specified item to the XQuery data type.

Parameters:
it - item to be converted
ctx - query context
ii - input info
Returns:
new item
Throws:
QueryException - query exception

cast

Value cast(java.lang.Object o,
           QueryContext ctx,
           InputInfo ii)
           throws QueryException
Casts the specified Java object to the XQuery data type.

Parameters:
o - Java object
ctx - TODO
ii - input info
Returns:
new item
Throws:
QueryException - query exception

castString

Value castString(java.lang.String s,
                 QueryContext ctx,
                 InputInfo ii)
                 throws QueryException
Casts the specified string to the XQuery data type.

Parameters:
s - string object
ctx - TODO
ii - input info
Returns:
new item
Throws:
QueryException - query exception

seqType

SeqType seqType()
Returns the sequence type of this data type.

Returns:
sequence type

eq

boolean eq(Type t)
Checks if this type is equal to the given one.

Parameters:
t - other type
Returns:
true if both types are equal, false otherwise

instanceOf

boolean instanceOf(Type t)
Checks if the current type is an instance of the specified type.

Parameters:
t - type to be checked
Returns:
result of check

union

Type union(Type t)
Computes the union between this type and the given one, i.e. the least common ancestor of both types in the type hierarchy.

Parameters:
t - other type
Returns:
union type

intersect

Type intersect(Type t)
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.

Parameters:
t - other type
Returns:
intersection type or null

isNode

boolean isNode()
Checks if the type refers to a node.

Returns:
result of check

isNumber

boolean isNumber()
Checks if the type refers to a number.

Returns:
result of check

isUntyped

boolean isUntyped()
Checks if the type refers to an untyped item.

Returns:
result of check

isNumberOrUntyped

boolean isNumberOrUntyped()
Checks if the type refers to a number or an untyped item.

Returns:
result of check

isStringOrUntyped

boolean isStringOrUntyped()
Checks if the type refers to a number or a string. Returns if this item is untyped or a string.

Returns:
result of check

string

byte[] string()
Returns the string representation of this type.

Returns:
name

id

Type.ID id()
Returns a type id to differentiate all types.

Returns:
id

toString

java.lang.String toString()
Overrides:
toString in class java.lang.Object

nsSensitive

boolean nsSensitive()
Checks if the type is namespace-sensitive.

Returns:
result of check