Using the Alloy API, I'm trying to execute a model changing Facts and Predicates in different ways, basically it should take a model and start running the model with different combinations of Facts or Predicates, it is to disassemble the given model and reassemble it but in different combinations of Predicates or Facts. In the Facts analysis part I use this function:
List<Expr> cand = new ArrayList<Expr>(part);
ExprList el = ExprList.make(null, null, ExprList.Op.AND, cand);
Where part is a List of objects of type Expr that contains the parts of the Facts that I want to test, for example if I have the Fact
fact {
Major in House.major
Color in House.color
H2.major = Phil
((H1.color = Red and H2.major = Phil) or (H2.color = Red and H3.major = Phil))
some h: House | h.color = Blue and h.major = CS
H2.major = Math
}
And I only wish to see the subsets generated by this part of the Fact
fact {
Major in House.major
((H1.color = Red and H2.major = Phil) or (H2.color = Red and H3.major = Phil))
}
I send in the part list only those 2 objects and execute them with an object of the type Command
Command cm = command.change(assemble(part));
A4Solution ans = TranslateAlloyToKodkod.execute_command(reporter, module.getAllReachableSigs(), cm, options);
Everything works perfectly for Facts, but when I try to do the same with the Predicates I get this error:
Exception in thread "main" java.lang.ClassCastException: class edu.mit.csail.sdg.alloy4.ErrorFatal cannot be cast to class net.sourceforge.argparse4j.inf.ArgumentParserException (edu.mit.csail.sdg.alloy4.ErrorFatal and net.sourceforge.argparse4j.inf.ArgumentParserException are in unnamed module of loader 'app')
I tried to use the make method of from Func class because the lists generated by alloy for the Predicates are Func type objects, but I keep getting the same error.
I would like to know if is there a method I can use to manipulate the Predicates?
Thanks for your support !
Cheers