@Override public Expr copy(final QueryContext qc, final VarScope scp, final IntObjMap<Var> vs) { final Var v = scp.addCopy(var, qc); vs.put(var.id, v); final Spec spec = new Spec(info, v, expr.copy(qc, scp, vs), coll); spec.occluded = occluded; return spec; }
@Override public Expr copy(final QueryContext ctx, final VarScope o, final IntObjMap<Var> vs) { final VarScope scp = new VarScope(); final Var[] arg = new Var[args.length]; for (int i = 0; i < arg.length; i++) vs.put(args[i].id, arg[i] = scp.newCopyOf(ctx, args[i])); final Expr call = expr.copy(ctx, scp, vs); return new FuncLit(name, arg, call, (FuncType) type.type, scp, sc, info); }
/** * Binary search. * * @param token token to look for * @param start start position * @param end end position * @param ti entry length * @return position where the key was found, or would have been found */ private int find(final byte[] token, final int start, final int end, final int ti) { final int tl = ti + ENTRY; int l = 0, h = (end - start) / tl; while (l <= h) { final int m = l + h >>> 1; final int p = start + m * tl; byte[] txt = ctext.get(p); if (txt == null) { txt = inY.readBytes(p, ti); ctext.put(p, txt); } final int d = diff(txt, token); if (d == 0) return start + m * tl; if (d < 0) l = m + 1; else h = m - 1; } return start + l * tl; }
@Override public GroupBy copy(final QueryContext qc, final VarScope scp, final IntObjMap<Var> vs) { // copy the pre-grouping expressions final Expr[] pEx = Arr.copyAll(qc, scp, vs, preExpr); // create fresh copies of the post-grouping variables final Var[] ps = new Var[post.length]; final int pl = ps.length; for (int p = 0; p < pl; p++) { final Var old = post[p]; ps[p] = scp.addCopy(old, qc); vs.put(old.id, ps[p]); } // done return new GroupBy(Arr.copyAll(qc, scp, vs, specs), pEx, ps, nonOcc, info); }
@Override public Count copy(final QueryContext qc, final VarScope scp, final IntObjMap<Var> vs) { final Var v = scp.newCopyOf(qc, var); vs.put(var.id, v); return new Count(v, info); }