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

Method toGeneral

basex-core/src/main/java/org/basex/query/expr/CmpV.java:82–87  ·  view source on GitHub ↗

Tries to rewrite this expression to a general comparison. @param cc compilation context @param single operands must yield single values @return general comparison or original expression @throws QueryException query exception

(final CompileContext cc, final boolean single)

Source from the content-addressed store, hash-verified

80 * @throws QueryException query exception
81 */
82 private Expr toGeneral(final CompileContext cc, final boolean single) throws QueryException {
83 final Expr expr1 = exprs[0], expr2 = exprs[1];
84 final SeqType st1 = expr1.seqType(), st2 = expr2.seqType();
85 final Predicate<SeqType> p = st -> single ? st.one() : st.zeroOrOne();
86 return p.test(st1) && p.test(st2) ? new CmpG(info, expr1, expr2, op).optimize(cc) : this;
87 }
88
89 @Override
90 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {

Callers 2

optimizeMethod · 0.95
simplifyForMethod · 0.95

Calls 5

seqTypeMethod · 0.95
oneMethod · 0.80
zeroOrOneMethod · 0.80
testMethod · 0.65
optimizeMethod · 0.45

Tested by

no test coverage detected