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

Method get

basex-core/src/main/java/org/basex/query/expr/CmpSR.java:79–92  ·  view source on GitHub ↗

Tries to convert the specified expression into a range expression. @param cc compilation context @param cmp expression to be converted @return new or original expression @throws QueryException query exception

(final CompileContext cc, final CmpG cmp)

Source from the content-addressed store, hash-verified

77 * @throws QueryException query exception
78 */
79 static Expr get(final CompileContext cc, final CmpG cmp) throws QueryException {
80 final Expr cmp1 = cmp.exprs[0], cmp2 = cmp.exprs[1];
81 if(cmp1.has(Flag.NDT) || !(cmp2 instanceof final AStr str2)) return cmp;
82
83 final byte[] d = str2.string(cmp.info);
84 final ParseExpr expr = switch(cmp.op) {
85 case GE -> new CmpSR(cmp1, d, true, null, true, cmp.info);
86 case GT -> new CmpSR(cmp1, d, false, null, true, cmp.info);
87 case LE -> new CmpSR(cmp1, null, true, d, true, cmp.info);
88 case LT -> new CmpSR(cmp1, null, true, d, false, cmp.info);
89 default -> null;
90 };
91 return expr != null ? expr.optimize(cc) : cmp;
92 }
93
94 @Override
95 public Bln item(final QueryContext qc, final InputInfo ii) throws QueryException {

Callers 1

optimizeMethod · 0.95

Calls 3

hasMethod · 0.95
stringMethod · 0.45
optimizeMethod · 0.45

Tested by

no test coverage detected