示例#1
0
文件: Path.java 项目: nikhi/basex
  @Override
  public final Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e)
      throws QueryException {

    final Value oldVal = ctx.value;
    try {
      ctx.value = root(ctx);
      final Expr rt = root == null ? null : root.inline(ctx, scp, v, e);
      if (rt != null) {
        setRoot(ctx, rt);
        ctx.value = oldVal;
        ctx.value = root(ctx);
      }

      boolean change = rt != null;
      for (int i = 0; i < steps.length; i++) {
        final Expr nw = steps[i].inline(ctx, scp, v, e);
        if (nw != null) {
          steps[i] = nw;
          change = true;
        }
      }
      return change ? optimize(ctx, scp) : null;
    } finally {
      ctx.value = oldVal;
    }
  }
示例#2
0
  @Override
  public FTExpr inline(final QueryContext qc, final VarScope scp, final Var var, final Expr ex)
      throws QueryException {

    boolean change = occ != null && inlineAll(qc, scp, occ, var, ex);
    final Expr q = query.inline(qc, scp, var, ex);
    if (q != null) {
      query = q;
      change = true;
    }
    return change ? optimize(qc, scp) : null;
  }
示例#3
0
文件: Path.java 项目: runeengh/basex
  @Override
  public final Expr inline(final QueryContext qc, final VarScope scp, final Var var, final Expr ex)
      throws QueryException {

    boolean changed = false;
    if (root != null) {
      final Expr rt = root.inline(qc, scp, var, ex);
      if (rt != null) {
        root = rt;
        changed = true;
      }
    }

    final int sl = steps.length;
    for (int s = 0; s < sl; s++) {
      final Expr nw = steps[s].inline(qc, scp, var, ex);
      if (nw != null) {
        steps[s] = nw;
        changed = true;
      }
    }
    return changed ? optimize(qc, scp) : null;
  }