예제 #1
0
 @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;
 }
예제 #2
0
파일: FuncLit.java 프로젝트: JohnLeM/basex
 @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);
 }
예제 #3
0
파일: FTIndex.java 프로젝트: fpapai/basex
 /**
  * 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;
 }
예제 #4
0
  @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);
  }
예제 #5
0
파일: Count.java 프로젝트: james-jw/basex
 @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);
 }