use of org.batfish.datamodel.routing_policy.expr.IncrementMetric in project batfish by batfish.
the class TransferBDD method applyLongExprModification.
/*
* Apply the effect of modifying a long value (e.g., to set the metric)
*/
private BDDInteger applyLongExprModification(TransferParam<BDDRoute> p, BDDInteger x, LongExpr e) {
if (e instanceof LiteralLong) {
LiteralLong z = (LiteralLong) e;
p.debug("LiteralLong: " + z.getValue());
return BDDInteger.makeFromValue(x.getFactory(), 32, z.getValue());
}
if (e instanceof DecrementMetric) {
DecrementMetric z = (DecrementMetric) e;
p.debug("Decrement: " + z.getSubtrahend());
return x.sub(BDDInteger.makeFromValue(x.getFactory(), 32, z.getSubtrahend()));
}
if (e instanceof IncrementMetric) {
IncrementMetric z = (IncrementMetric) e;
p.debug("Increment: " + z.getAddend());
return x.add(BDDInteger.makeFromValue(x.getFactory(), 32, z.getAddend()));
}
throw new BatfishException("int expr transfer function: " + e);
}
Aggregations