@Override
  public void acceptArrayPredicate(ArrayPredicate arrayPredicate) {
    List<Predicate> predicateList = new LinkedList<>();
    boolean hasOrs = false;

    Predicate[] predicates = arrayPredicate.getPredicates();
    if (predicates.length > 0) {
      for (Predicate predicate : predicates) {
        PredicateHelper.visit(predicate, this);
        predicateList.add(lastVisited);
        if (lastVisited instanceof OrPredicate) {
          hasOrs = true;
        }
      }
    }
    // distribute so that A && ( B || C ) becomes ( A && B ) || ( A && C )
    if (hasOrs && arrayPredicate instanceof AndPredicate) {
      int size = predicateList.size();
      List<Predicate> andPredicateList = new LinkedList<>();

      for (int i = 0; i < size; ++i) {
        for (int j = i + 1; j < size; ++j) {
          andPredicateList.addAll(distribute(predicateList.get(i), predicateList.get(j)));
        }
      }
      lastVisited = OrPredicate.instance(andPredicateList.toArray(new Predicate[andPredicateList.size()]));
    }
    else {
      lastVisited = arrayPredicate.create(predicateList.toArray(new Predicate[predicateList.size()]));
    }
  }
Obtain a list of simplified predicates based on the rules described in the class documentation.

@return a list of simplified predicates
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/SimplifyingPredicateVisitor.java