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)
| 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 { |