Source:
<code>public static MISTPredicate<Map<String, Object>> cepConditionToPredicate(final AbstractCondition condition) { if (condition instanceof ComparisonCondition) { switch (condition.getConditionType()) { case LT: return new CepLTPredicate(((ComparisonCondition) condition).getFieldName(), ((ComparisonCondition) condition).getComparisonValue()); case GT: return new CepGTPredicate(((ComparisonCondition) condition).getFieldName(), ((ComparisonCondition) condition).getComparisonValue()); case EQ: return new CepEQPredicate(((ComparisonCondition) condition).getFieldName(), ((ComparisonCondition) condition).getComparisonValue()); default: throw new IllegalStateException("The wrong condition type!"); } } else if (condition instanceof UnionCondition) { switch (condition.getConditionType()) { case AND: { final List<AbstractCondition> conditionList = ((UnionCondition) condition).getConditions(); final List<MISTPredicate<Map<String, Object>>> predicateList = new ArrayList<>(); for (int i = 0; i < conditionList.size(); i++) { predicateList.add(cepConditionToPredicate(conditionList.get(i))); } return new CepANDPredicate(predicateList); } case OR: { <START> final List<AbstractCondition> conditionList = ((UnionCondition) condition).getConditions(); <END> final List<MISTPredicate<Map<String, Object>>> predicateList = new ArrayList<>(); for (int i = 0; i < conditionList.size(); i++) { predicateList.add(cepConditionToPredicate(conditionList.get(i))); } return new CepORPredicate(predicateList); } default: throw new IllegalStateException("The wrong condition type!"); } } else { throw new IllegalStateException("The wrong condition type!"); } }</code><technical_language>share codes 54-58</technical_language>

Target:
public static MISTPredicate<Map<String, Object>> cepConditionToPredicate(final AbstractCondition condition) { if (condition instanceof ComparisonCondition) { switch (condition.getConditionType()) { case LT: return new CepLTPredicate(((ComparisonCondition) condition).getFieldName(), ((ComparisonCondition) condition).getComparisonValue()); case GT: return new CepGTPredicate(((ComparisonCondition) condition).getFieldName(), ((ComparisonCondition) condition).getComparisonValue()); case EQ: return new CepEQPredicate(((ComparisonCondition) condition).getFieldName(), ((ComparisonCondition) condition).getComparisonValue()); case GE: return new CepGEPredicate(((ComparisonCondition) condition).getFieldName(), ((ComparisonCondition) condition).getComparisonValue()); case LE: return new CepLEPredicate(((ComparisonCondition) condition).getFieldName(), ((ComparisonCondition) condition).getComparisonValue()); default: throw new IllegalStateException("The wrong condition type!"); } } else if (condition instanceof UnionCondition) { final List<AbstractCondition> conditionList = ((UnionCondition) condition).getConditions(); final List<MISTPredicate<Map<String, Object>>> predicateList = new ArrayList<>(); for (int i = 0; i < conditionList.size(); i++) { predicateList.add(cepConditionToPredicate(conditionList.get(i))); } switch (condition.getConditionType()) { case AND: return new CepANDPredicate(predicateList); case OR: return new CepORPredicate(predicateList); default: throw new IllegalStateException("The wrong condition type!"); } } else { throw new IllegalStateException("The wrong condition type!"); } }