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

Method optimize

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

Source from the content-addressed store, hash-verified

59 }
60
61 @Override
62 public Expr optimize(final CompileContext cc) throws QueryException {
63 cond = cond.simplifyFor(Simplify.STRING, cc);
64
65 // check if expression can be pre-evaluated
66 final Expr expr = opt(cc);
67 if(expr != this) return cc.replaceWith(this, expr);
68
69 // combine types of return expressions
70 exprType.assign(SeqType.union(groups, true)).data(groups);
71
72 return this;
73 }
74
75 @Override
76 public Expr simplifyFor(final Simplify mode, final CompileContext cc) throws QueryException {

Callers 6

compileMethod · 0.95
simplifyForMethod · 0.95
inlineMethod · 0.95
typeCheckMethod · 0.95
optMethod · 0.45
toIfMethod · 0.45

Calls 6

optMethod · 0.95
unionMethod · 0.95
replaceWithMethod · 0.80
simplifyForMethod · 0.45
dataMethod · 0.45
assignMethod · 0.45

Tested by

no test coverage detected