use of org.btrplace.safeplace.spec.term.Mult in project scheduler by btrplace.
the class MyCstrSpecVisitor method visitTermOp.
@Override
public Term<?> visitTermOp(@NotNull CstrSpecParser.TermOpContext ctx) {
Term t1 = (Term<?>) visit(ctx.t1);
Term t2 = (Term<?>) visit(ctx.t2);
assertEqualsTypes(ctx.op, t1.type(), t2.type());
switch(ctx.op.getType()) {
case CstrSpecParser.PLUS:
if (t1.type() == IntType.getInstance()) {
return new IntPlus(t1, t2);
} else if (t1.type() instanceof SetType) {
return new SetPlus(t1, t2);
}
break;
case CstrSpecParser.MINUS:
if (t1.type() == IntType.getInstance()) {
return new IntMinus(t1, t2);
} else if (t1.type() instanceof SetType) {
return new SetMinus(t1, t2);
}
break;
case CstrSpecParser.MULT:
return new Mult(t1, t2);
default:
}
throw SpecException.unsupportedOperation(filename, t1.type(), ctx.op, t2.type());
}
Aggregations