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

Method add

basex-core/src/main/java/org/basex/query/expr/path/Step.java:321–333  ·  view source on GitHub ↗

Adds path nodes to the list if they comply with the given test conditions. @param node root node @param nodes output nodes @param name name ID, or 0 as wildcard @param kind node kind, or -1 for all types

(final PathNode node, final ArrayList<PathNode> nodes, final int name,
      final int kind)

Source from the content-addressed store, hash-verified

319 * @param kind node kind, or {@code -1} for all types
320 */
321 private void add(final PathNode node, final ArrayList<PathNode> nodes, final int name,
322 final int kind) {
323
324 for(final PathNode pn : node.children) {
325 if(axis.oneOf(DESCENDANT, DESCENDANT_OR_SELF)) {
326 add(pn, nodes, name, kind);
327 }
328 if(kind == -1 && pn.kind != Data.ATTR ^ axis == ATTRIBUTE ||
329 kind == pn.kind && (name == 0 || name == pn.name)) {
330 if(!nodes.contains(pn)) nodes.add(pn);
331 }
332 }
333 }
334
335 /**
336 * Checks if the step will never yield results.

Callers 1

nodesMethod · 0.95

Calls 3

oneOfMethod · 0.65
containsMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected