use of org.btrplace.safeplace.spec.term.UserVar in project scheduler by btrplace.
the class MyCstrSpecVisitor method visitTypedef.
@Override
public List<UserVar<?>> visitTypedef(@NotNull CstrSpecParser.TypedefContext ctx) {
Term<?> parent = (Term<?>) visit(ctx.term());
if (parent.type() instanceof Atomic) {
throw new SpecException(filename, ctx.op.getCharPositionInLine(), "The right-hand side must be a collection");
}
List<UserVar<?>> vars = new ArrayList<>();
for (TerminalNode n : ctx.ID()) {
String lbl = n.getText();
UserVar v = new UserVar(lbl, ctx.op.getText(), parent);
symbols.put(v);
vars.add(v);
}
return vars;
}
use of org.btrplace.safeplace.spec.term.UserVar in project scheduler by btrplace.
the class MyCstrSpecVisitor method visitExists.
@Override
public Exists visitExists(@NotNull CstrSpecParser.ExistsContext ctx) {
List<UserVar<?>> vars = visitTypedef(ctx.typedef());
Proposition p = (Proposition) visit(ctx.formula());
return new Exists(vars, p);
}
use of org.btrplace.safeplace.spec.term.UserVar in project scheduler by btrplace.
the class MyCstrSpecVisitor method visitListInComprehension.
@Override
public ListBuilder<?> visitListInComprehension(@NotNull CstrSpecParser.ListInComprehensionContext ctx) {
// Get the binder
List<UserVar<?>> v = visitTypedef(ctx.typedef());
Proposition p = Proposition.True;
if (ctx.COMMA() != null) {
p = (Proposition) visit(ctx.formula());
}
Term<?> t = (Term<?>) visit(ctx.term());
return new ListBuilder<>(t, v.get(0), p);
}
use of org.btrplace.safeplace.spec.term.UserVar in project scheduler by btrplace.
the class ForAll method toString.
@Override
public String toString() {
StringBuilder b = new StringBuilder("!(");
Iterator<UserVar<?>> ite = vars.iterator();
while (ite.hasNext()) {
Var v = ite.next();
if (ite.hasNext()) {
b.append(v.label());
b.append(',');
} else {
b.append(v.pretty());
}
}
return b.append(") ").append(prop).toString();
}
use of org.btrplace.safeplace.spec.term.UserVar in project scheduler by btrplace.
the class MyCstrSpecVisitor method visitAll.
@Override
public Proposition visitAll(@NotNull CstrSpecParser.AllContext ctx) {
List<UserVar<?>> vars = visitTypedef(ctx.typedef());
Proposition p = (Proposition) visit(ctx.formula());
return new ForAll(vars, p);
}
Aggregations