예제 #1
0
 private LanguageNode handleInFunction(FunctionCall fc) {
   ExpressionNode lhs = fc.getParameters().get(0);
   if (EngineConstant.COLUMN.has(lhs) && parent.isQualifyingColumn((ColumnInstance) lhs)) {
     // only matches if all the rhs are constant
     for (ExpressionNode en : fc.getParameters(1)) {
       if (!EngineConstant.CONSTANT.has(en)) return fc;
     }
     ColumnInstance ci = (ColumnInstance) lhs;
     if (!parent.isQualifyingColumn(ci.getPEColumn())) return fc;
     ArrayList<ExpressionNode> subexprs = new ArrayList<ExpressionNode>();
     ArrayList<Part> parts = new ArrayList<Part>();
     for (ExpressionNode en : fc.getParameters(1)) {
       ColumnInstance tci = (ColumnInstance) ci.copy(null);
       ConstantExpression litex = (ConstantExpression) en;
       ExpressionNode subeq = new FunctionCall(FunctionName.makeEquals(), tci, litex);
       Part p = buildPart(subeq, tci, litex);
       parts.add(p);
       subexprs.add((ExpressionNode) p.getParent());
     }
     if (subexprs.size() > 1) {
       FunctionCall orcall = new FunctionCall(FunctionName.makeOr(), subexprs);
       OredParts pc = parent.buildOredParts(orcall, parts);
       if (pc.isComplete()) setComplete(pc);
       orcall.setGrouped();
       state.put(orcall, pc);
       return orcall;
     } else {
       Part p = parts.get(0);
       return p.getParent();
     }
   }
   return fc;
 }
예제 #2
0
 private LanguageNode handleEqualsFunction(FunctionCall fc) {
   ExpressionNode lhs = fc.getParameters().get(0);
   ExpressionNode rhs = fc.getParameters().get(1);
   if (EngineConstant.CONSTANT.has(rhs)
       && EngineConstant.COLUMN.has(lhs)
       && parent.isQualifyingColumn((ColumnInstance) lhs)) {
     ColumnInstance ci = (ColumnInstance) lhs;
     ConstantExpression litex = (ConstantExpression) rhs;
     PEColumn c = ci.getPEColumn();
     if (parent.isQualifyingColumn(c)) {
       Part p = buildPart(fc, ci, litex);
       return p.getParent();
     }
   }
   return fc;
 }