Package org.basex.query.value.type
Class SeqType
java.lang.Object
org.basex.query.value.type.SeqType
Stores a sequence type definition.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SeqTypeZero or one xs:anyAtomicType.static final SeqTypeZero or more xs:anyAtomicType.static final SeqTypeZero or one xs:anyAtomicType.static final SeqTypeSingle URI.static final SeqTypeZero or more URIs.static final SeqTypeZero or one URIs.static final ArrayTypeThe general array type.static final SeqTypeSingle array.static final SeqTypeZero or more arrays.static final SeqTypeOne attribute node.static final SeqTypeZero or more attributes.static final SeqTypeSingle xs:base64Binary.static final SeqTypeZero or more xs:base64Binary.static final SeqTypeZero or one xs:base64Binary.static final SeqTypeSingle binary.static final SeqTypeSingle xs:boolean.static final SeqTypeZero or one xs:boolean.static final SeqTypeZero or more bytes.static final SeqTypeOne comment node.static final SeqTypeSingle date.static final SeqTypeOne date-time.static final SeqTypeZero or one date-time.static final SeqTypeZero or one date.static final SeqTypeOne day-time-duration.static final SeqTypeZero or one day-time-duration.static final SeqTypeZero or one decimal number.static final SeqTypeOne document node.static final SeqTypeZero or more document node.static final SeqTypeZero or one document node.static final SeqTypeDouble number.static final SeqTypeDouble number.static final SeqTypeZero or one double.static final SeqTypeZero or one duration.static final SeqTypeOne element node.static final SeqTypeZero or more element nodes.static final SeqTypeZero items (single instance).static final SeqTypeFloat number.static final FuncTypeAny function type.static final SeqTypeSingle function.static final SeqTypeZero of more functions.static final SeqTypeZero of single function.static final SeqTypeOne xs:hexBinary.static final SeqTypeZero or one xs:hexBinary.static final SeqTypeSingle integer.static final SeqTypeZero or more integers.static final SeqTypeZero or one integer.static final SeqTypeSingle item.static final SeqTypeOne or more items.static final SeqTypeZero or more items.static final SeqTypeZero or one item.static final SeqTypeSingle language.static final MapTypeThe general map type.static final SeqTypeSingle map.static final SeqTypeZero or more maps.static final SeqTypeZero or one map.static final SeqTypeNamespace node.static final SeqTypeZero or one NCName.static final SeqTypeSingle node.static final SeqTypeOne or more nodes.static final SeqTypeZero or more nodes.static final SeqTypeZero or one nodes.static final SeqTypeZero or one xs:numeric.static final SeqTypeZero or one xs:numeric.final OccOccurrence indicator.static final SeqTypeProcessing instruction.static final SeqTypeSingle QName.static final SeqTypeZero or one QNames.static final SeqTypeSingle string.static final SeqTypeZero or more strings.static final SeqTypeZero or one strings.static final SeqTypeZero or more text nodes.static final SeqTypeZero or one text node.static final SeqTypeOne time.static final SeqTypeZero or one time.final TypeItem type. -
Method Summary
Modifier and TypeMethodDescriptioncast(Value value, boolean error, QueryContext qc, StaticContext sc, InputInfo ii) Casts a sequence to this type.booleanChecks the types for equality.booleanstatic SeqTypeReturns a sequence type.static SeqTypeReturns a sequence type.booleanChecks if the specified item is an instance of this sequence type.booleanChecks if the specified value is an instance of this type.booleaninstanceOf(SeqType st) Checks if this sequence type is an instance of the specified sequence type.Computes the intersection of two sequence types, i.e.booleanChecks if the kind of this sequence type is an instance of the kind of the specified sequence type.booleanTests if expressions of this type may be an array.booleanTests if expressions of this type may be numeric.booleanone()Tests if expressions of this type yield one item.booleanTests if expressions of this type yield one or more items.booleanpromotable(SeqType st) Checks if this type could be converted to the given one by function conversion.voidpromote(Item item, QNm name, ItemList items, QueryContext qc, StaticContext sc, InputInfo ii, boolean opt) Promotes the specified item to this item type.promote(Value value, QNm name, QueryContext qc, StaticContext sc, InputInfo ii, boolean opt) Promotes the specified value to this sequence type.toString()voidtreat(Value value, QNm name, QueryContext qc, InputInfo ii) Treats the specified value as this sequence type.Returns a string representation of the type.Returns a sequence type with a new occurrence indicator.Computes the union of two sequence types, i.e.Returns a sequence type with the specified occurrence indicator.booleanzero()Tests if expressions of this type yield zero items.booleanTests if expressions of this type yield at most one item.
-
Field Details
-
EMPTY_SEQUENCE_Z
Zero items (single instance). -
ITEM_O
Single item. -
ITEM_ZO
Zero or one item. -
ITEM_ZM
Zero or more items. -
ITEM_OM
One or more items. -
ANY_ATOMIC_TYPE_O
Zero or one xs:anyAtomicType. -
ANY_ATOMIC_TYPE_ZO
Zero or one xs:anyAtomicType. -
ANY_ATOMIC_TYPE_ZM
Zero or more xs:anyAtomicType. -
NUMERIC_O
Zero or one xs:numeric. -
NUMERIC_ZO
Zero or one xs:numeric. -
DOUBLE_O
Double number. -
DOUBLE_ZO
Zero or one double. -
DOUBLE_ZM
Double number. -
FLOAT_O
Float number. -
DECIMAL_ZO
Zero or one decimal number. -
INTEGER_O
Single integer. -
INTEGER_ZO
Zero or one integer. -
INTEGER_ZM
Zero or more integers. -
BYTE_ZM
Zero or more bytes. -
STRING_O
Single string. -
STRING_ZO
Zero or one strings. -
STRING_ZM
Zero or more strings. -
NCNAME_ZO
Zero or one NCName. -
LANGUAGE_O
Single language. -
ANY_URI_O
Single URI. -
ANY_URI_ZO
Zero or one URIs. -
ANY_URI_ZM
Zero or more URIs. -
QNAME_O
Single QName. -
QNAME_ZO
Zero or one QNames. -
BOOLEAN_O
Single xs:boolean. -
BOOLEAN_ZO
Zero or one xs:boolean. -
DATE_O
Single date. -
DATE_ZO
Zero or one date. -
DAY_TIME_DURATION_O
One day-time-duration. -
DAY_TIME_DURATION_ZO
Zero or one day-time-duration. -
DATE_TIME_O
One date-time. -
DATE_TIME_ZO
Zero or one date-time. -
TIME_O
One time. -
TIME_ZO
Zero or one time. -
DURATION_ZO
Zero or one duration. -
BINARY_O
Single binary. -
HEX_BINARY_O
One xs:hexBinary. -
HEX_BINARY_ZO
Zero or one xs:hexBinary. -
BASE64_BINARY_O
Single xs:base64Binary. -
BASE64_BINARY_ZO
Zero or one xs:base64Binary. -
BASE64_BINARY_ZM
Zero or more xs:base64Binary. -
NODE_O
Single node. -
NODE_ZO
Zero or one nodes. -
NODE_ZM
Zero or more nodes. -
NODE_OM
One or more nodes. -
ATTRIBUTE_O
One attribute node. -
ATTRIBUTE_ZM
Zero or more attributes. -
COMMENT_O
One comment node. -
DOCUMENT_NODE_O
One document node. -
DOCUMENT_NODE_ZO
Zero or one document node. -
DOCUMENT_NODE_ZM
Zero or more document node. -
ELEMENT_O
One element node. -
ELEMENT_ZM
Zero or more element nodes. -
NAMESPACE_NODE_O
Namespace node. -
PROCESSING_INSTRUCTION_O
Processing instruction. -
TEXT_ZO
Zero or one text node. -
TEXT_ZM
Zero or more text nodes. -
FUNCTION
Any function type. -
MAP
The general map type. -
ARRAY
The general array type. -
FUNCTION_O
Single function. -
FUNCTION_ZO
Zero of single function. -
FUNCTION_ZM
Zero of more functions. -
MAP_O
Single map. -
MAP_ZO
Zero or one map. -
MAP_ZM
Zero or more maps. -
ARRAY_O
Single array. -
ARRAY_ZM
Zero or more arrays. -
type
Item type. -
occ
Occurrence indicator.
-
-
Method Details
-
get
Returns a sequence type.- Parameters:
type- typeocc- occurrence indicator- Returns:
- sequence type
-
get
Returns a sequence type.- Parameters:
type- typeocc- occurrence indicatortest- kind test (can benull; ignored if this is no node type)- Returns:
- sequence type
-
with
Returns a sequence type with the specified occurrence indicator.- Parameters:
oc- occurrence indicator- Returns:
- sequence type
-
union
Returns a sequence type with a new occurrence indicator.- Parameters:
oc- occurrence indicator- Returns:
- sequence type
-
instance
Checks if the specified value is an instance of this type.- Parameters:
value- value to check- Returns:
- result of check
-
instance
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 casterror- raise error (returnnullotherwise)qc- query contextsc- static contextii- input info- Returns:
- cast value
- Throws:
QueryException- query exception
-
treat
Treats the specified value as this sequence type.- Parameters:
value- value to checkname- name of variable (can benull)qc- query contextii- 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 promotename- variable name (can benull)qc- query contextsc- static contextii- input infoopt- 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 promotename- variable name (can benull)items- item cacheqc- query contextsc- static contextii- input infoopt- if the result should be optimized- Throws:
QueryException- query exception
-
promotable
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
Computes the union of two sequence types, i.e. the lowest common ancestor of both types.- Parameters:
st- second type- Returns:
- resulting type
-
intersect
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,nullis 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
Checks if this sequence type is an instance of the specified sequence type.- Parameters:
st- sequence type to check- Returns:
- result of check
-
kindInstanceOf
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
Checks the types for equality.- Parameters:
st- type- Returns:
- result of check
-
equals
-
typeString
Returns a string representation of the type.- Returns:
- string
-
toString
-