Solves the formula on the solver and returns the result.
@param handler a MaxSAT handler
@return the result (SAT, UNSAT, Optimum found, or UNDEF if canceled by the handler)
2019
public MaxSAT.MaxSATResult solve(final MaxSATHandler handler) {
    if (this.result != UNDEF)
      return this.result;
    if (this.solver.currentWeight() == 1)
      this.solver.setProblemType(MaxSAT.ProblemType.UNWEIGHTED);
    else
      this.solver.setProblemType(MaxSAT.ProblemType.WEIGHTED);
    this.result = this.solver.search(handler);
    return this.result;
  }
903813
@Override
	public int getMaxLength() {
		int max = 0;
		boolean found = false;
		for (Constraint c : constraints) {
			int cM = c.getMaxLength();
			if (cM != -1) {
				max += cM;
				found = true;
			}
		}
		return found ? max : -1;
	}
1208683
public static Object execExpr(ExprResolver exprResolver, String expression) {

        try {
            // 返回输出的内容
            return exprResolver.executeExpr(expression);

        } catch (Exception e) {

            // 输出日志
            if (logger.isDebugEnabled()) {
                logger.debug("Can't resolving expression: " + expression, e);
            }
        }

        return null;
    }
446524
public static Tristate searchSATSolver(final MiniSatStyleSolver s, final SATHandler handler, final LNGIntVector assumptions) {
    return s.solve(handler, assumptions);
  }
1305160
@FFDCIgnore({ NumberFormatException.class, ArithmeticException.class, ConfigEvaluatorException.class })
    private String tryEvaluateExpression(String expr, final EvaluationContext context, final boolean ignoreWarnings) {
        try {
            return new ConfigExpressionEvaluator() {

                @Override
                String getProperty(String argName) throws ConfigEvaluatorException {
                    return VariableEvaluator.this.getProperty(argName, context, ignoreWarnings, false);
                }

                @Override
                Object getPropertyObject(String argName) throws ConfigEvaluatorException {
                    return VariableEvaluator.this.getPropertyObject(argName, context, ignoreWarnings, false);
                }
            }.evaluateExpression(expr);

        } catch (NumberFormatException e) {
            // ${0+string}, or a number that exceeds MAX_LONG.
        } catch (ArithmeticException e) {
            // ${x/0}
        } catch (ConfigEvaluatorException e) {
            // If getPropertyObject fails
        }
        return null;
    }
348011
public AioSession write(ByteBuffer data, CompletionHandler<Integer, AioSession> handler) {
		this.channel.write(data, Math.max(this.writeTimeout, 0L), TimeUnit.MILLISECONDS, this, handler);
		return this;
	}
999841
public function run( $handler = null )
	{
		if ( !is_null( $handler ) )
		{
			$this->handler( $handler );
		}
		
		// if there is a special fetch handler defined pass him all the 
		// needed parameters and retrive the results
		if ( !is_null( $this->fetch_handler ) )
		{
			$results = call_user_func_array( $this->fetch_handler, array(
				&$this
			));
		}
		// otherwise simply do the default select fetch
		else 
		{
			$results = $this->handler->fetch( $this->build(), $this->handler->builder()->parameters, $this->fetch_arguments );
		}
		
		// In case we should forward a key means using a value
		// from every result as array key.
		if ( $this->forward_key !== false )
		{
			$raw_results = $results;
			$results = array();
			
			if ( in_array( 'assoc', $this->fetch_arguments ) )
			{
				foreach( $raw_results as $result )
				{
					$results[$result[$this->forward_key]] = $result;
				}
			}
			else
			{
				foreach( $raw_results as $result )
				{
					$results[$result->{$this->forward_key}] = $result;
				}
			}
		}
		
		// Group the results by a value
		if ( $this->group_result !== false )
		{
			$raw_results = $results;
			$results = array();
			
			if ( in_array( 'assoc', $this->fetch_arguments ) )
			{
				foreach( $raw_results as $key => $result )
				{
					$results[$result[$this->group_result]][$key] = $result;
				}
			}
			else
			{
				foreach( $raw_results as $key => $result )
				{
					$results[$result->{$this->group_result}][$key] = $result;
				}
			}
		}
		
		// when the limit is 1 we are going to return the 
		// result directly
		if ( $this->limit === 1 )
		{
			return reset( $results );
		}
		
		return $results;
	}
726458
@Override
    public List<AbstractExpression> bindingToIndexedExpression(AbstractExpression expr) {
        if (m_originalValue == null || ! m_originalValue.equals(expr)) {
            return null;
        }
        // This parameter's value was matched, so return this as one bound parameter.
        List<AbstractExpression> result = new ArrayList<AbstractExpression>();
        result.add(this);
        return result;
    }
1105049
public RouteMatcher head(String pattern, Handler<HttpServerRequest> handler) {
		addPattern(pattern, handler, headBindings);
		return this;
	}
380088
public RouteMatcher get(String pattern, Handler<HttpServerRequest> handler) {
		addPattern(pattern, handler, getBindings);
		return this;
	}
142191
private AbstractExpression optimizeInExpressions(AbstractExpression expr) {
        ExpressionType exprType = expr.getExpressionType();
        if (ExpressionType.CONJUNCTION_AND == exprType || ExpressionType.CONJUNCTION_OR == exprType) {
            AbstractExpression optimizedLeft = optimizeInExpressions(expr.getLeft());
            expr.setLeft(optimizedLeft);
            AbstractExpression optimizedRight = optimizeInExpressions(expr.getRight());
            expr.setRight(optimizedRight);
            return expr;
        }

        if (ExpressionType.COMPARE_EQUAL != exprType) {
            return expr;
        }

        assert(expr instanceof ComparisonExpression);
        if (((ComparisonExpression)expr).getQuantifier() != QuantifierType.ANY) {
            return expr;
        }

        /*
         * Verify that an IN expression can be safely converted to an EXISTS one
         * IN (SELECT" forms e.g. "(A, B) IN (SELECT X, Y, FROM ...) =>
         * EXISTS (SELECT 42 FROM ... AND|WHERE|HAVING A=X AND|WHERE|HAVING B=Y)
         */
        AbstractExpression inColumns = expr.getLeft();
        if (inColumns instanceof SelectSubqueryExpression) {
            // If the left child is a (SELECT ...) expression itself we can't convert it
            // to the EXISTS expression because the mandatory run time scalar check -
            // (expression must return a single row at most)
            return expr;
        }

        // The right hand operand of the equality operation must be a SELECT statement
        AbstractExpression rightExpr = expr.getRight();
        if (!(rightExpr instanceof SelectSubqueryExpression)) {
            return expr;
        }

        SelectSubqueryExpression subqueryExpr = (SelectSubqueryExpression) rightExpr;
        AbstractParsedStmt subquery = subqueryExpr.getSubqueryStmt();
        if (!(subquery instanceof ParsedSelectStmt)) {
            return expr;
        }

        ParsedSelectStmt selectStmt = (ParsedSelectStmt) subquery;

        // Must not have OFFSET or LIMIT set
        // EXISTS (select * from T where T.X = parent.X order by T.Y offset 10 limit 5)
        //      seems to require 11 matches
        // parent.X IN (select T.X from T order by T.Y offset 10 limit 5)
        //      seems to require 1 match that has exactly 10-14 rows (matching or not) with lesser or equal values of Y.
        if (selectStmt.hasLimitOrOffset()) {
            return expr;
        }

        ParsedSelectStmt.rewriteInSubqueryAsExists(selectStmt, inColumns);
        subqueryExpr.resolveCorrelations();
        AbstractExpression existsExpr = new OperatorExpression();
        existsExpr.setExpressionType(ExpressionType.OPERATOR_EXISTS);
        existsExpr.setLeft(subqueryExpr);
        return optimizeExistsExpression(existsExpr);
    }
118311
public static RequestToken fetchAll(BaasHandler<List<BaasUser>> handler) {
        return fetchAll(null, RequestOptions.DEFAULT, handler);
    }
159928
public RouteMatcher allWithRegEx(String regex, Handler<HttpServerRequest> handler) {
		addRegEx(regex, handler, getBindings);
		addRegEx(regex, handler, putBindings);
		addRegEx(regex, handler, postBindings);
		addRegEx(regex, handler, deleteBindings);
		addRegEx(regex, handler, optionsBindings);
		addRegEx(regex, handler, headBindings);
		addRegEx(regex, handler, traceBindings);
		addRegEx(regex, handler, connectBindings);
		addRegEx(regex, handler, patchBindings);
		return this;
	}
942901
@SuppressWarnings("deprecation")
	public static Handler getHandler(List<Handler> handlerList, Handler actionHandler) {
		Handler result = actionHandler;
		
		for (int i=handlerList.size()-1; i>=0; i--) {
			Handler temp = handlerList.get(i);
			temp.next = result;
			temp.nextHandler = result;
			result = temp;
		}
		
		return result;
	}
1323740
private Boolean getKnownValue(Expression expr) {
    Object value = expr.getConstantValue();
    if (value instanceof Boolean) {
      return (Boolean) value;
    }
    switch (expr.getKind()) {
      case BOOLEAN_LITERAL:
        return ((BooleanLiteral) expr).booleanValue();
      case INFIX_EXPRESSION:
        {
          InfixExpression infixExpr = (InfixExpression) expr;
          InfixExpression.Operator op = infixExpr.getOperator();
          if (op == CONDITIONAL_AND || op == CONDITIONAL_OR) {
            // We assume that this node has already been visited and pruned so
            // if it has a known value, it will be equal to the last operand.
            List<Expression> operands = infixExpr.getOperands();
            Boolean lastOperand = getKnownValue(operands.get(operands.size() - 1));
            if (lastOperand != null && lastOperand.booleanValue() == (op == CONDITIONAL_OR)) {
              return lastOperand;
            }
          }
          return null;
        }
      case PARENTHESIZED_EXPRESSION:
        return getKnownValue(((ParenthesizedExpression) expr).getExpression());
      default:
        return null;
    }
  }
598073
private ConstraintSet solveEquality() {
    List<Constraint> current = eqConstraints;
    List<Constraint> next = Lists.newArrayList();
    boolean done = false;
    boolean solvable = this.solvable;

    TypeReplacement nextBindings = new TypeReplacement(bindings);
    while (!done) {
      done = true;
      // Iterative constraint solving algorithm with four cases
      for (Constraint c : current) {
        Type subtype = c.subtype.substitute(nextBindings.getBindings());
        Type supertype = c.supertype.substitute(nextBindings.getBindings());
        
        if (subtype.isFunctional() && supertype.isFunctional()) {
          // Case 1: <a,b> = <c,d> => a = c && b = d
          
          // Replace this constraint with the entailed subtype
          // constraints on argument/return types.
          next.add(new Constraint(supertype.getArgumentType(), subtype.getArgumentType()));
          next.add(new Constraint(subtype.getReturnType(), supertype.getReturnType()));
          done = false;
        } else if (!subtype.isFunctional() && supertype.isFunctional()) {
          // Case 2: A = <c,d> => A = <c,d> (if A is a type var, else fail)
          if (subtype.hasTypeVariables()) {
            nextBindings.add(subtype.getAtomicTypeVar(), supertype);
            done = false;
          } else {
            solvable = false;
          }
        } else if (subtype.isFunctional() && !supertype.isFunctional()) {
          // Case 3: <c,d> = A => A = <c,d> (if A is a type var, else fail)
          if (supertype.hasTypeVariables()) {
            nextBindings.add(supertype.getAtomicTypeVar(), subtype);
            done = false;
          } else {
            solvable = false;
          }
        } else {
          // Case 4: A = B => A = B
          if (subtype.hasTypeVariables() && supertype.hasTypeVariables()) {
            if (subtype.getAtomicTypeVar() != supertype.getAtomicTypeVar()) {
              nextBindings.add(subtype.getAtomicTypeVar(), supertype);
            }
          } else if (subtype.hasTypeVariables()) {
            nextBindings.add(subtype.getAtomicTypeVar(), supertype);
            done = false;
          } else if (supertype.hasTypeVariables()) {
            nextBindings.add(supertype.getAtomicTypeVar(), subtype);
            done = false;
          } else {
            if (!subtype.equals(supertype)) {
              solvable = false;
            }
          }
        }
      }

      current = next;
      next = Lists.newArrayList();
    }
    
    List<Constraint> newSubConstraints = Lists.newArrayList();
    for (Constraint c : subConstraints) {
      newSubConstraints.add(c.substitute(nextBindings.getBindings()));
    }
    return new ConstraintSet(Lists.newArrayList(), newSubConstraints, nextBindings,
        solvable, typeVarCounter);
  }
84664
public RouteMatcher connect(String pattern, Handler<HttpServerRequest> handler) {
		addPattern(pattern, handler, connectBindings);
		return this;
	}