@Override public AclLineMatchExpr visitNotMatchExpr(NotMatchExpr notMatchExpr) { // eliminate double-negation return notMatchExpr.getOperand(); }
@Override public List<T> visitNotMatchExpr(NotMatchExpr notMatchExpr) { List<T> matchingExprs = new ArrayList<>(); if (_type.isAssignableFrom(NotMatchExpr.class)) { matchingExprs.add(_type.cast(notMatchExpr)); } matchingExprs.addAll(visit(notMatchExpr.getOperand())); return matchingExprs; }
@Override public Void visitNotMatchExpr(NotMatchExpr notMatchExpr) { visit(notMatchExpr.getOperand()); return null; }
@Override public Void visitNotMatchExpr(NotMatchExpr notMatchExpr) { // normalization retains negation on literals but not in general, so we recurse either way this.visit(notMatchExpr.getOperand()); return null; }
@Override public Void visitNotMatchExpr(NotMatchExpr notMatchExpr) { AclLineMatchExpr operand = notMatchExpr.getOperand(); if (operand instanceof MatchHeaderSpace) { forbidHeaderSpace((MatchHeaderSpace) operand); return null; } throw new IllegalArgumentException("Can only explain AclLineMatchExpr literals."); }
@Override public Boolean visitNotMatchExpr(NotMatchExpr notMatchExpr) { return notMatchExpr.getOperand().accept(this); }
@Override public Boolean visitNotMatchExpr(NotMatchExpr notMatchExpr) { return !notMatchExpr.getOperand().accept(this); }
/** * Smart constructor for {@link NotMatchExpr} that does constant-time simplifications (i.e. when * expr is {@link #TRUE} or {@link #FALSE}). */ public static AclLineMatchExpr not(AclLineMatchExpr expr) { if (expr == TRUE) { return FALSE; } if (expr == FALSE) { return TRUE; } if (expr instanceof NotMatchExpr) { return ((NotMatchExpr) expr).getOperand(); } return new NotMatchExpr(expr); }
@Override public AclLineMatchExpr visitNotMatchExpr(NotMatchExpr notMatchExpr) throws CircularReferenceException, UndefinedReferenceException { return new NotMatchExpr(visit(notMatchExpr.getOperand())); }
@Override public final AclLineMatchExpr visitNotMatchExpr(NotMatchExpr notMatchExpr) { AclLineMatchExpr subExpr = notMatchExpr.getOperand().accept(this); if (subExpr == TrueExpr.INSTANCE) { return FalseExpr.INSTANCE; } else if (subExpr == FalseExpr.INSTANCE) { return TrueExpr.INSTANCE; } else { return new NotMatchExpr(subExpr); } }
@Override public AclLineMatchExpr visitNotMatchExpr(NotMatchExpr notMatchExpr) { return new NotMatchExpr(notMatchExpr.getOperand().accept(this)); }
@Override public BoolExpr visitNotMatchExpr(NotMatchExpr notMatchExpr) { return _context.mkNot(notMatchExpr.getOperand().accept(this)); }
@Override public BooleanExpr visitNotMatchExpr(NotMatchExpr notMatchExpr) { return new NotExpr(notMatchExpr.getOperand().accept(this)); }
@Override public BDD visitNotMatchExpr(NotMatchExpr notMatchExpr) { return visit(notMatchExpr.getOperand()).not(); }
@Override public AclLineMatchExpr visitNotMatchExpr(NotMatchExpr notMatchExpr) { return new NotMatchExpr(notMatchExpr.getOperand().accept(this)); }
@Override public Void visitNotMatchExpr(NotMatchExpr notMatchExpr) { AclLineMatchExpr negatedOperand = Negate.negate(notMatchExpr.getOperand()); if (negatedOperand instanceof NotMatchExpr) { // negated leaf node. rather than recurse, just add to the conjuctsBuilders. addConstraint(notMatchExpr); } else { negatedOperand.accept(this); } return null; }
@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); } }
@Override public void add(AclLineMatchExpr expr) { /* * If expr is an OrMatchExpr (or can be simplified by one using deMorgan's law, then add each * disjunct separately (so we can detect and remove redundant disjuncts). This could create some * extra work though, so only do this if the conjunction won't be valid after adding. */ if (_ipAccessListToBDD.visit(expr).or(getBdd()).isOne()) { /* * expr is valid 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 OrMatchExpr) { ((OrMatchExpr) e).getDisjuncts().forEach(this::add); } else { addHelper(e); } } }