MCPcopy Create free account
hub / github.com/BaseXdb/basex / record

Method record

basex-core/src/main/java/org/basex/query/func/fn/PlanFn.java:447–467  ·  view source on GitHub ↗

Returns a record item. @param node node @param plan plan @param qc query context @return array @throws QueryException query exception

(final GNode node, final Plan plan, final QueryContext qc)

Source from the content-addressed store, hash-verified

445 * @throws QueryException query exception
446 */
447 private XQMap record(final GNode node, final Plan plan, final QueryContext qc)
448 throws QueryException {
449 final MapBuilder map = attributes(node, plan, qc);
450 final TokenObjectMap<GNodeList> cache = new TokenObjectMap<>();
451 for(final GNode ch : children(Kind.ELEMENT, node)) {
452 cache.computeIfAbsent(nodeName(ch, node, plan, qc), GNodeList::new).add(ch);
453 }
454 for(final byte[] name : cache) {
455 final GNodeList children = cache.get(name);
456 final PlanEntry pe = entry(children.get(0), plan);
457 if(pe.layout != PlanLayout.DEEP_SKIP) {
458 final ArrayBuilder ab = new ArrayBuilder(qc, children.size());
459 for(final GNode ch : children) {
460 ab.add(pe.apply(ch, node, plan, qc));
461 }
462 final XQArray array = ab.array();
463 map.put(name, array.structSize() == 1 ? array.valueAt(0) : array);
464 }
465 }
466 return map.map();
467 }
468
469 /**
470 * Returns a mixed-layout item.

Callers 2

createMethod · 0.45
optMethod · 0.45

Calls 15

attributesMethod · 0.95
childrenMethod · 0.95
computeIfAbsentMethod · 0.95
nodeNameMethod · 0.95
getMethod · 0.95
entryMethod · 0.95
getMethod · 0.95
sizeMethod · 0.95
addMethod · 0.95
applyMethod · 0.95
arrayMethod · 0.95
putMethod · 0.95

Tested by

no test coverage detected