Package org.basex.query.value.map
Class XQMap
- All Implemented Interfaces:
Iterable<Item>,XQFunction,XQFunctionExpr
The map item.
- Author:
- BaseX Team 2005-21, BSD License, Leo Woerteler
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionaddAll(XQMap map, MergeDuplicates merge, QueryContext qc, InputInfo ii) Adds all bindings from the given map intothis.atomItem(QueryContext qc, InputInfo ii) Evaluates the expression and returns the resulting, atomized item, orEmpty.VALUEif the expression yields an empty sequence.atomValue(QueryContext qc, InputInfo ii) Evaluates the expression and returns the atomized items.voidCaches lazy values.booleanChecks if the given key exists in the map.booleanPerforms a deep comparison of two items.Deletes a key from this map.Returns a string description of the expression.forEach(FItem func, QueryContext qc, InputInfo ii) Applies a function on all entries.Gets a value from this item.intReturns a hash code for this value.booleaninstanceOf(Type tp) Checks if this item is instance of the specified type.keys()All keys defined in this map.intmapSize()Number of values contained in this map.materialize(QueryContext qc, boolean copy) Returns a materialized, context-independent version of this item.paramName(int pos) Name of the parameter at the given position.voidCreates a query plan.voidplan(QueryString qs) Creates a query string.Puts the given value into this map and replaces existing keys.voidrefineType(Expr expr) Refines the expression type.voidstring(boolean indent, TokenBuilder tb, int level, InputInfo ii) Returns a string representation of the item.toJava()Returns a Java representation of the value.voidvalues(ValueBuilder vb) Adds all values defined in this map to the specified value builder.Methods inherited from class org.basex.query.value.item.XQData
arity, coerceTo, equals, funcName, inline, invokeInternal, stackFrameSize, vacuousBodyMethods inherited from class org.basex.query.value.item.FItem
annotations, eq, funcType, sameKey, stringMethods inherited from class org.basex.query.value.item.Item
atomSize, bool, comparable, dbl, ddo, dec, diff, ebv, equiv, flt, input, item, itemAt, iter, itr, persistent, reverse, score, seqType, size, subsequence, test, typeId, xdmInfoMethods inherited from class org.basex.query.value.Value
accept, checkUp, compile, copy, count, exprSize, has, inline, inlineable, isEmpty, isItem, iter, iterator, materialize, serialize, serialize, serialize, valueMethods inherited from class org.basex.query.expr.Expr
arg, args, atomIter, data, data, hasFreeVars, indexAccessible, isSimple, markTailCalls, mergeEbv, optimize, simplifyFor, typeCheck, uses, vacuous, visitAllMethods inherited from class org.basex.query.expr.ExprInfo
toErrorString, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.basex.query.func.XQFunction
invoke, invokeTail
-
Field Details
-
EMPTY
The empty map.
-
-
Method Details
-
paramName
Description copied from interface:XQFunctionExprName of the parameter at the given position.- Parameters:
pos- position of the parameter- Returns:
- name of the parameter
-
refineType
Description copied from class:ExprRefines the expression type.- Overrides:
refineTypein classFItem- Parameters:
expr- original expression
-
cache
Description copied from class:Item- Overrides:
cachein classItem- Parameters:
lazy- lazy cachingii- input info- Throws:
QueryException- query exception
-
delete
Deletes a key from this map.- Parameters:
key- key to delete (must not benull)ii- input info- Returns:
- updated map if changed,
thisotherwise - Throws:
QueryException- query exception
-
get
Description copied from class:XQDataGets a value from this item.- Specified by:
getin classXQData- Parameters:
key- key to look for (must not benull)ii- input info- Returns:
- bound value if found, the empty sequence
()otherwise - Throws:
QueryException- query exception
-
contains
Checks if the given key exists in the map.- Parameters:
key- key to look for (must not benull)ii- input info- Returns:
true()if the key exists,false()otherwise- Throws:
QueryException- query exception
-
addAll
public XQMap addAll(XQMap map, MergeDuplicates merge, QueryContext qc, InputInfo ii) throws QueryException Adds all bindings from the given map intothis.- Parameters:
map- map to addmerge- merge duplicate keysqc- query contextii- input info- Returns:
- updated map if changed,
thisotherwise - Throws:
QueryException- query exception
-
atomValue
Description copied from class:ItemEvaluates the expression and returns the atomized items. Overwritten byXQArray,FuncItemandANode.- Overrides:
atomValuein classItem- Parameters:
qc- query contextii- input info (only required bySeqinstances, which have no input info)- Returns:
- atomized item
- Throws:
QueryException- query exception
-
atomItem
Description copied from class:ItemEvaluates the expression and returns the resulting, atomized item, orEmpty.VALUEif the expression yields an empty sequence. Overwritten byXQArray,FuncItemandANode.- Overrides:
atomItemin classItem- Parameters:
qc- query contextii- input info (only required bySeqinstances, which have no input info)- Returns:
- item or
Empty.VALUE - Throws:
QueryException- query exception
-
materialize
Description copied from class:ItemReturns a materialized, context-independent version of this item.- Overrides:
materializein classItem- Parameters:
qc- query context (ifnull, process cannot be interrupted)copy- create full copy- Returns:
- item copy, or
null) if the item cannot be materialized
-
instanceOf
Description copied from class:Item- Overrides:
instanceOfin classItem- Parameters:
tp- type- Returns:
- result of check
-
put
Puts the given value into this map and replaces existing keys.- Parameters:
key- key to insert (must not benull)value- value to insertii- input info- Returns:
- updated map if changed,
thisotherwise - Throws:
QueryException- query exception
-
mapSize
public int mapSize()Number of values contained in this map.- Returns:
- size
-
keys
All keys defined in this map.- Returns:
- list of keys
-
values
Adds all values defined in this map to the specified value builder.- Parameters:
vb- value builder
-
forEach
Applies a function on all entries.- Parameters:
func- function to apply on keys and valuesqc- query contextii- input info- Returns:
- resulting value
- Throws:
QueryException- query exception
-
deep
Description copied from class:FItemPerforms a deep comparison of two items.- Specified by:
deepin classFItem- Parameters:
item- item to be comparedcoll- collation (can benull)ii- input info- Returns:
- result of check
- Throws:
QueryException- query exception
-
toJava
Description copied from class:ValueReturns a Java representation of the value.- Specified by:
toJavain classValue- Returns:
- Java object
- Throws:
QueryException- query exception
-
hash
Description copied from class:ValueReturns a hash code for this value.- Overrides:
hashin classItem- Parameters:
ii- input info- Returns:
- hash code
- Throws:
QueryException- if atomization can't be applied (e.g. function item)
-
string
Description copied from class:XQDataReturns a string representation of the item.- Specified by:
stringin classXQData- Parameters:
indent- indent outputtb- token builderlevel- current levelii- input info- Throws:
QueryException- query exception
-
description
Description copied from class:ExprInfoReturns a string description of the expression. This method is only called by error messages. Contrary to theExprInfo.toString()method, arguments are not included in the output.- Overrides:
descriptionin classItem- Returns:
- result of check
-
plan
Description copied from class:ExprInfoCreates a query plan. -
plan
Description copied from class:ExprInfoCreates a query string.
-