示例#1
0
 @Override
 public int exprSize() {
   int sz = 1;
   if (occ != null) for (final Expr o : occ) sz += o.exprSize();
   for (final Expr e : exprs) sz += e.exprSize();
   return sz + query.exprSize();
 }
示例#2
0
  @Override
  public FTWords compile(final QueryContext qc, final VarScope scp) throws QueryException {
    if (occ != null) {
      final int ol = occ.length;
      for (int o = 0; o < ol; ++o) occ[o] = occ[o].compile(qc, scp);
    }

    // compile only once
    if (tokens == null) {
      query = query.compile(qc, scp);
      if (query.isValue()) tokens = tokens(qc);
      // choose fast evaluation for default settings
      fast = mode == FTMode.ANY && tokens != null && occ == null;
      if (ftt == null) ftt = new FTTokenizer(this, qc);
    }
    return this;
  }
示例#3
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;
  }
示例#4
0
 @Override
 public FTExpr copy(final QueryContext qc, final VarScope scp, final IntObjMap<Var> vs) {
   final FTWords ftw =
       new FTWords(
           info,
           query.copy(qc, scp, vs),
           mode,
           occ == null ? null : Arr.copyAll(qc, scp, vs, occ));
   if (ftt != null) ftw.ftt = ftt.copy(ftw);
   ftw.tokens = tokens;
   ftw.data = data;
   ftw.first = first;
   ftw.pos = pos;
   ftw.fast = fast;
   return ftw;
 }
示例#5
0
 @Override
 public boolean accept(final ASTVisitor visitor) {
   return super.accept(visitor)
       && query.accept(visitor)
       && (occ == null || visitAll(visitor, occ));
 }
示例#6
0
 @Override
 public VarUsage count(final Var var) {
   return occ != null ? VarUsage.sum(var, occ).plus(query.count(var)) : query.count(var);
 }
示例#7
0
 @Override
 public boolean removable(final Var var) {
   if (occ != null) for (final Expr o : occ) if (!o.removable(var)) return false;
   return query.removable(var);
 }
示例#8
0
 @Override
 public boolean has(final Flag flag) {
   if (occ != null) for (final Expr o : occ) if (o.has(flag)) return true;
   return query.has(flag);
 }