use of org.btrplace.safeplace.spec.prop.NEq in project scheduler by btrplace.
the class MyCstrSpecVisitor method visitTermComparison.
@Override
public Proposition visitTermComparison(@NotNull CstrSpecParser.TermComparisonContext c) {
CstrSpecParser.ComparisonContext ctx = c.comparison();
Term t1 = (Term<?>) visit(ctx.t1);
Term t2 = (Term<?>) visit(ctx.t2);
switch(ctx.op.getType()) {
case CstrSpecParser.INCL:
assertEqualsTypes(ctx.op, t1.type(), t2.type());
return new Inc(t1, t2);
case CstrSpecParser.NOT_INCL:
assertEqualsTypes(ctx.op, t1.type(), t2.type());
return new NInc(t1, t2);
case CstrSpecParser.EQ:
assertEqualsTypes(ctx.op, t1.type(), t2.type());
return new Eq(t1, t2);
case CstrSpecParser.NOT_EQ:
assertEqualsTypes(ctx.op, t1.type(), t2.type());
return new NEq(t1, t2);
case CstrSpecParser.LT:
assertEqualsTypes(ctx.op, IntType.getInstance(), t1.type(), t2.type());
return new Lt(t1, t2);
case CstrSpecParser.LEQ:
assertEqualsTypes(ctx.op, IntType.getInstance(), t1.type(), t2.type());
return new Leq(t1, t2);
case CstrSpecParser.GT:
assertEqualsTypes(ctx.op, IntType.getInstance(), t1.type(), t2.type());
return new Lt(t2, t1);
case CstrSpecParser.GEQ:
assertEqualsTypes(ctx.op, IntType.getInstance(), t1.type(), t2.type());
return new Leq(t2, t1);
case CstrSpecParser.IN:
assertIn(ctx.op, t1, t2);
return new In(t1, t2);
case CstrSpecParser.NOT_IN:
assertIn(ctx.op, t1, t2);
return new NIn(t1, t2);
case CstrSpecParser.PART:
assertIn(ctx.op, t2, t1);
return new Packings(t1, t2);
case CstrSpecParser.NOT_PART:
assertIn(ctx.op, t2, t1);
return new NoPackings(t1, t2);
default:
throw SpecException.unsupportedOperation(filename, t1.type(), ctx.op, t2.type());
}
}
Aggregations