-
Notifications
You must be signed in to change notification settings - Fork 0
/
YicesConstraint.java
executable file
·43 lines (34 loc) · 1.07 KB
/
YicesConstraint.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**************************************************************************
* @author Mahdi Eslamimehr
* @version 0.1
***************************************************************************/
package ContractGen;
import java.util.HashSet;
import java.util.Iterator;
public class YicesConstraint {
private String op;
private String lhs;
private String rhs;
private static HashSet vars = new HashSet();
public YicesConstraint(String op, String lhs, String rhs) {
this.op = op;
this.lhs = lhs;
this.rhs = rhs;
YicesConstraint.vars.add(lhs);
YicesConstraint.vars.add(rhs);
}
public static void clearInits() {
YicesConstraint.vars.clear();
}
public String toString() {
return "(assert ("+op+" "+lhs+" "+rhs+"))\n";
}
public static String initVars() {
String ret = new String();
for(Iterator it = vars.iterator(); it.hasNext(); ) {
String var = (String) it.next();
ret = ret + "(define "+var+"::int)\n";
}
return ret;
}
}