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

Method optimize

basex-core/src/main/java/org/basex/query/expr/Set.java:39–54  ·  view source on GitHub ↗
(final CompileContext cc)

Source from the content-addressed store, hash-verified

37 }
38
39 @Override
40 public final Expr optimize(final CompileContext cc) throws QueryException {
41 Expr expr = opt(cc);
42 if(expr == null) {
43 final int el = exprs.length;
44 if(el == 0) return Empty.VALUE;
45 if(el == 1) return cc.function(Function.DISTINCT_ORDERED_NODES, info, exprs[0]);
46 // try to merge operands
47 expr = mergePaths(cc);
48 if(expr == null) expr = mergeFilters(cc);
49 }
50 if(expr != null) return cc.replaceWith(this, expr);
51
52 iterative = ((Checks<Expr>) Expr::ddo).all(exprs);
53 return this;
54 }
55
56 /**
57 * Performs function specific optimizations.

Callers 3

mergePathsMethod · 0.45
mergeFiltersMethod · 0.45
newPredicateMethod · 0.45

Calls 6

optMethod · 0.95
mergePathsMethod · 0.95
mergeFiltersMethod · 0.95
replaceWithMethod · 0.80
allMethod · 0.65
functionMethod · 0.45

Tested by

no test coverage detected