public static LogicalExpression createLogicalExpression(LogicalOperator op) throws InvalidQueryException {
    switch (op.getType()) {
      case AND:
      case OR:
        return new LogicalExpression(op);
      case NOT :
        return new NotLogicalExpression(op);
      default:
        throw new RuntimeException("An invalid logical operator type was encountered: " + op);
    }
  }
Create a logical expression instance.

@param op  the logical operator

@return a new logical expression instance
@throws InvalidQueryException
ambari-server/src/main/java/org/apache/ambari/server/api/predicate/expressions/LogicalExpressionFactory.java