コード例 #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
ファイル: 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;
  }