27
27
import edu .mit .csail .sdg .alloy4compiler .ast .ExprVar ;
28
28
import edu .mit .csail .sdg .alloy4compiler .ast .Sig ;
29
29
import edu .mit .csail .sdg .alloy4compiler .ast .VisitQuery ;
30
- import edu .mit .csail .sdg .alloy4compiler .ast .Sig .SubsetSig ;
31
30
import edu .mit .csail .sdg .alloy4compiler .translator .ConvToConjunction ;
32
31
33
32
// - create an abstract sig Action
@@ -61,10 +60,10 @@ public void expand(final A4Reporter rep, final CompModule root, LinkedHashMap<Si
61
60
62
61
// create the parent Action signature
63
62
Sig action_sig = root .addSig ("_Action" , null , null , null , null , Attr .ABSTRACT , Attr .PRIVATE );
64
- System .out .println ("Created sig " +action_sig .label +" with " +action_sig .attributes +"." );
63
+ // System.out.println("Created sig "+action_sig.label+" with "+action_sig.attributes+".");
65
64
// create the Dummy argument signature
66
65
Sig dummy_sig = root .addSig ("_Dummy" , null , null , null , null , Attr .ONE , Attr .PRIVATE );
67
- System .out .println ("Created sig " +dummy_sig .label +" with " +dummy_sig .attributes +"." );
66
+ // System.out.println("Created sig "+dummy_sig.label+" with "+dummy_sig.attributes+".");
68
67
69
68
final ExprVar dummy_var = ExprVar .make (null , dummy_sig .label );
70
69
final ExprVar action_var = ExprVar .make (null , action_sig .label );
@@ -84,7 +83,7 @@ public void expand(final A4Reporter rep, final CompModule root, LinkedHashMap<Si
84
83
// define sig Arg as the sum of all argument types
85
84
// TODO: avoid repeated arg types
86
85
Sig arg_sig = root .addSig ("_Arg" , ExprVar .make (null ,"=" ), args , null , null , Attr .PRIVATE , Attr .VARIABLE );
87
- System .out .println ("Max args is " +max_args +", sig " +arg_sig .label +" defined = " + ((SubsetSig ) arg_sig ).parents + " with " +arg_sig .attributes +"." );
86
+ // System.out.println("Max args is "+max_args+", sig "+arg_sig.label+" defined = "+ ((SubsetSig) arg_sig).parents + " with "+arg_sig.attributes+".");
88
87
89
88
final ExprVar arg_var = ExprVar .make (null , arg_sig .label );
90
89
@@ -112,18 +111,18 @@ public void expand(final A4Reporter rep, final CompModule root, LinkedHashMap<Si
112
111
ev_names .add (ExprVar .make (null , "_event" ));
113
112
Expr ev_expr = padded_act_types ;
114
113
Decl ev = new Decl (Pos .UNKNOWN , Pos .UNKNOWN , null , null , ev_names , ev_expr );
115
- System .out .println ("Field " +ev_names .get (0 )+ " defined with " + ev_expr +"." );
114
+ // System.out.println("Field "+ev_names.get(0)+ " defined with "+ ev_expr+".");
116
115
117
116
List <Decl > fields = new ArrayList <Decl >();
118
117
fields .add (ev );
119
118
Sig e_sig = root .addSig ("_E" , null , null , fields , null , Attr .ONE , Attr .PRIVATE );
120
- System .out .println ("Created sig " +e_sig .label +" with " +e_sig .attributes +"." );
119
+ // System.out.println("Created sig "+e_sig.label+" with "+e_sig.attributes+".");
121
120
122
121
final ExprVar e_var = ExprVar .make (null , e_sig .label );
123
122
124
123
Expr mult = e_var .join (ExprVar .make (null , "_event" )).one ().always ();
125
124
root .addFact (null , "_e_mult" , mult );
126
- System .out .println ("Added event multiplicity fact: " +mult +"." );
125
+ // System.out.println("Added event multiplicity fact: "+mult+".");
127
126
128
127
129
128
// create the arguments for the fired predicate, action + args
@@ -151,9 +150,9 @@ public void expand(final A4Reporter rep, final CompModule root, LinkedHashMap<Si
151
150
// create the fired predicate
152
151
final String fired_name = "_fired" ;
153
152
root .addFunc (null , null , fired_name , null , fired_args , null , fired_expr );
154
- System .out .print ("Created predicate " +fired_name +" with " );
155
- for (Decl d : fired_args ) System .out .print (d .names +":" +d .expr +" " );
156
- System .out .println ("as " +fired_expr +"." );
153
+ // System.out.print("Created predicate "+fired_name+" with ");
154
+ // for (Decl d : fired_args) System.out.print(d.names+":"+d.expr+" ");
155
+ // System.out.println("as "+fired_expr+".");
157
156
158
157
final ExprVar fired_var = ExprVar .make (null , fired_name );
159
158
@@ -187,14 +186,14 @@ public void expand(final A4Reporter rep, final CompModule root, LinkedHashMap<Si
187
186
final String fire_fact_name = "_fire_" +act_name ;
188
187
root .addFact (null , fire_fact_name , fir );
189
188
190
- System .out .println (act_name +" firing condition: " + fir );
189
+ // System.out.println(act_name+" firing condition: "+ fir);
191
190
}
192
191
193
192
// create the fired predicates (free or fixed args) for each action
194
193
for (String act_name : acts_args .keySet ()) {
195
194
List <Decl > decls = new ArrayList <Decl >(acts_args .get (act_name ));
196
- System .out .print ((decls .size ()>0 ?"With" :"Without" )+" arguments " );
197
- for (Decl d : decls ) System .out .print (d .names +":" +d .expr +" " );
195
+ // System.out.print((decls.size()>0?"With":"Without")+" arguments ");
196
+ // for (Decl d : decls) System.out.print(d.names+":"+d.expr+" ");
198
197
199
198
Expr v0 = fired_var ;
200
199
for (int i = 0 ; i < max_args ; i ++) {
@@ -209,8 +208,8 @@ public void expand(final A4Reporter rep, final CompModule root, LinkedHashMap<Si
209
208
root .addFunc (null , null , curPredName (act_name ), null , null , null , v0 );
210
209
root .addFunc (null , null , act_name , null , null , null , v0 );
211
210
}
212
- System .out .println ("defined predicate " +act_name +" with " +v0 );
213
- System .out .println ("defined predicate " +curPredName (act_name )+" with " +v0 );
211
+ // System.out.println("defined predicate "+act_name+" with "+v0);
212
+ // System.out.println("defined predicate "+curPredName(act_name)+" with "+v0);
214
213
215
214
}
216
215
@@ -236,7 +235,7 @@ public void expand(final A4Reporter rep, final CompModule root, LinkedHashMap<Si
236
235
final String fc_name = "_fc" ;
237
236
fc_body = fc_body .always ();
238
237
root .addFact (null , fc_name , fc_body );
239
- System .out .println ("FC fact " +fc_name +" defined: " +fc_body );
238
+ // System.out.println("FC fact "+fc_name+" defined: "+fc_body);
240
239
}
241
240
242
241
/**
@@ -264,7 +263,7 @@ public void expandAction(CompModule root, Pos p, Pos isPrivate, String n, List<D
264
263
// creates a singleton sig representing th action, extending Action
265
264
List <ExprVar > sig_action = Util .asList (ExprVar .make (null , "_Action" ));
266
265
Sig sig_this = root .addSig (actSigName (n ), ExprVar .make (null , "extends" ), sig_action , null , null , Attr .ONE , Attr .PRIVATE );
267
- System .out .println ("Created sig " +sig_this .label +" with " +sig_this .attributes +"." );
266
+ // System.out.println("Created sig "+sig_this.label+" with "+sig_this.attributes+".");
268
267
269
268
// stores the arguments of this action (needed generating the succeeding constraints depending on total arguments)
270
269
if (decls == null ) decls = new ArrayList <Decl >();
@@ -285,11 +284,11 @@ public void expandAction(CompModule root, Pos p, Pos isPrivate, String n, List<D
285
284
286
285
root .addFunc (p , isPrivate , prePredName (n ), null , decls , null , ExprList .make (null , null , ExprList .Op .AND , v1 ));
287
286
root .addFunc (p , isPrivate , postPredName (n ), null , decls , null , ExprList .make (null , null , ExprList .Op .AND , v2 ));
288
- System .out .print ((decls .size ()>0 ?"With" :"Without" )+" arguments " );
289
- for (Decl d : decls ) System .out .print (d .names +":" +d .expr +" " );
290
- System .out .println ("defined:" );
291
- System .out .println ("predicate " +prePredName (n )+" with " +ExprList .make (null , null , ExprList .Op .AND , v1 ));
292
- System .out .println ("predicate " +postPredName (n )+" with " +ExprList .make (null , null , ExprList .Op .AND , v2 ));
287
+ // System.out.print((decls.size()>0?"With":"Without")+" arguments ");
288
+ // for (Decl d : decls) System.out.print(d.names+":"+d.expr+" ");
289
+ // System.out.println("defined:");
290
+ // System.out.println("predicate "+prePredName(n)+" with "+ExprList.make(null, null, ExprList.Op.AND, v1));
291
+ // System.out.println("predicate "+postPredName(n)+" with "+ExprList.make(null, null, ExprList.Op.AND, v2));
293
292
294
293
// store modified elements, cannot be expanded at this stage as it the modifies from other actions
295
294
if (mods == null ) mods = new ArrayList <ExprVar >();
0 commit comments