use of org.batfish.datamodel.routing_policy.expr.CallExpr in project batfish by batfish.
the class AstVisitor method visit.
/*
* Walk starting from an AST boolean expression
*/
public void visit(Configuration conf, BooleanExpr e, Consumer<Statement> fs, Consumer<BooleanExpr> fe) {
fe.accept(e);
if (e instanceof Conjunction) {
Conjunction c = (Conjunction) e;
for (BooleanExpr be : c.getConjuncts()) {
visit(conf, be, fs, fe);
}
} else if (e instanceof Disjunction) {
Disjunction d = (Disjunction) e;
for (BooleanExpr be : d.getDisjuncts()) {
visit(conf, be, fs, fe);
}
} else if (e instanceof ConjunctionChain) {
ConjunctionChain c = (ConjunctionChain) e;
for (BooleanExpr be : c.getSubroutines()) {
visit(conf, be, fs, fe);
}
} else if (e instanceof DisjunctionChain) {
DisjunctionChain d = (DisjunctionChain) e;
for (BooleanExpr be : d.getSubroutines()) {
visit(conf, be, fs, fe);
}
} else if (e instanceof Not) {
Not n = (Not) e;
visit(conf, n.getExpr(), fs, fe);
} else if (e instanceof CallExpr) {
CallExpr c = (CallExpr) e;
RoutingPolicy rp = conf.getRoutingPolicies().get(c.getCalledPolicyName());
visit(conf, rp.getStatements(), fs, fe);
}
}
Aggregations