use of org.batfish.datamodel.routing_policy.expr.DecrementLocalPreference in project batfish by batfish.
the class TransferBDD method applyIntExprModification.
/*
* Apply the effect of modifying an integer value (e.g., to set the local pref)
*/
private BDDInteger applyIntExprModification(TransferParam<BDDRoute> p, BDDInteger x, IntExpr e) {
if (e instanceof LiteralInt) {
LiteralInt z = (LiteralInt) e;
p.debug("LiteralInt: " + z.getValue());
return BDDInteger.makeFromValue(x.getFactory(), 32, z.getValue());
}
if (e instanceof IncrementLocalPreference) {
IncrementLocalPreference z = (IncrementLocalPreference) e;
p.debug("IncrementLocalPreference: " + z.getAddend());
return x.add(BDDInteger.makeFromValue(x.getFactory(), 32, z.getAddend()));
}
if (e instanceof DecrementLocalPreference) {
DecrementLocalPreference z = (DecrementLocalPreference) e;
p.debug("DecrementLocalPreference: " + z.getSubtrahend());
return x.sub(BDDInteger.makeFromValue(x.getFactory(), 32, z.getSubtrahend()));
}
throw new BatfishException("TODO: int expr transfer function: " + e);
}
Aggregations