@Override public Void visitAndMatchExpr(AndMatchExpr andMatchExpr) { andMatchExpr.getConjuncts().forEach(this::visit); return null; }
@Override public List<T> visitAndMatchExpr(AndMatchExpr andMatchExpr) { List<T> matchingExprs = new ArrayList<>(); if (_type.isAssignableFrom(AndMatchExpr.class)) { matchingExprs.add(_type.cast(andMatchExpr)); } for (AclLineMatchExpr conjunct : andMatchExpr.getConjuncts()) { matchingExprs.addAll(visit(conjunct)); } return matchingExprs; }
@Override public Void visitAndMatchExpr(AndMatchExpr andMatchExpr) { andMatchExpr.getConjuncts().forEach(this::visit); return null; }
@Override protected SortedSet<AclLineMatchExpr> featureValueOf(AndMatchExpr actual) { return actual.getConjuncts(); } }
@Override public Void visitAndMatchExpr(AndMatchExpr andMatchExpr) { andMatchExpr.getConjuncts().forEach(this::visit); return null; }
@Override public AclLineMatchExpr visitAndMatchExpr(AndMatchExpr andMatchExpr) throws CircularReferenceException, UndefinedReferenceException { return new AndMatchExpr( andMatchExpr.getConjuncts().stream().map(this::visit).collect(Collectors.toList())); }
@Override public BoolExpr visitAndMatchExpr(AndMatchExpr andMatchExpr) { return _context.mkAnd( andMatchExpr.getConjuncts().stream().map(this::toBoolExpr).toArray(BoolExpr[]::new)); }
/** A factor is either a literal or a conjunction of literals. */ static AclLineMatchExprWithProvenance<AclLineMatchExpr> explainFactor(AclLineMatchExpr factor) { if (factor instanceof AndMatchExpr) { return explainLiterals(((AndMatchExpr) factor).getConjuncts()); } return explainLiterals(ImmutableList.of(factor)); }
@Override public Boolean visitAndMatchExpr(AndMatchExpr andMatchExpr) { return andMatchExpr.getConjuncts().stream().allMatch(c -> c.accept(this)); }
@Override public Boolean visitAndMatchExpr(AndMatchExpr andMatchExpr) { return andMatchExpr.getConjuncts().stream().anyMatch(expr -> expr.accept(this)); }
@Override public AclLineMatchExpr visitAndMatchExpr(AndMatchExpr andMatchExpr) { return new AndMatchExpr( andMatchExpr.getConjuncts().stream() .map(this::visit) .collect(ImmutableSortedSet.toImmutableSortedSet(Ordering.natural()))); }
@Override public AclLineMatchExpr visitAndMatchExpr(AndMatchExpr andMatchExpr) { return and( andMatchExpr.getConjuncts().stream() .map(this::visit) .collect(ImmutableSortedSet.toImmutableSortedSet(Comparator.naturalOrder()))); }
@Override public BDD visitAndMatchExpr(AndMatchExpr andMatchExpr) { return _bddOps.and( andMatchExpr.getConjuncts().stream() .map(this::visit) .collect(ImmutableList.toImmutableList())); }
@Override public BooleanExpr visitAndMatchExpr(AndMatchExpr andMatchExpr) { return new AndExpr( andMatchExpr.getConjuncts().stream() .map(this::toBooleanExpr) .collect(ImmutableList.toImmutableList())); }
@Override public AclLineMatchExpr visitAndMatchExpr(AndMatchExpr andMatchExpr) { return new OrMatchExpr(negate(andMatchExpr.getConjuncts())); }
@Override public final AclLineMatchExpr visitAndMatchExpr(AndMatchExpr andMatchExpr) { List<AclLineMatchExpr> conjuncts = andMatchExpr.getConjuncts().stream() .map(expr -> expr.accept(this)) .filter(expr -> expr != TrueExpr.INSTANCE) .collect(ImmutableList.toImmutableList()); if (conjuncts.isEmpty()) { return TrueExpr.INSTANCE; } if (conjuncts.contains(FalseExpr.INSTANCE)) { return FalseExpr.INSTANCE; } return new AndMatchExpr(conjuncts); }
@Override public Boolean visitAndMatchExpr(AndMatchExpr andMatchExpr) { return andMatchExpr.getConjuncts().stream() .allMatch( c -> { newTrace(); Boolean result = c.accept(this); endTrace(); return result; }); }
@Override public void add(AclLineMatchExpr expr) { /* * If expr is an AndMatchExpr (or can be simplified by one using deMorgan's law, then add each * conjunct separately (so we can detect and remove redundant conjuncts). This could create some * extra work though, so only do this if the conjunction won't be unsat after adding. */ if (_ipAccessListToBDD.visit(expr).and(getBdd()).isZero()) { /* * expr is inconsistent with the other conjuncts. Just add it now. */ addHelper(expr); return; } AclLineMatchExpr e = expr; if (e instanceof NotMatchExpr) { /* * Try to apply deMorgan. */ e = Negate.negate(((NotMatchExpr) e).getOperand()); } if (e instanceof AndMatchExpr) { ((AndMatchExpr) e).getConjuncts().forEach(this::add); } else { addHelper(e); } }