@@ -49,7 +49,8 @@ public static HashMap<String, List<Signature>> get_operator_map() {
4949 List <String > clockInteger = Arrays .asList ("Clock" , "Integer" );
5050
5151 // Default operand names in built-in functions
52- List <String > params = Arrays .asList ("r1" , "r2" );
52+ List <String > param1 = Arrays .asList ("r1" );
53+ List <String > params2 = Arrays .asList ("r1" , "r2" );
5354
5455 // SetLists
5556 List <Boolean > setOnset = Arrays .asList (true , true );
@@ -71,10 +72,10 @@ public static HashMap<String, List<Signature>> get_operator_map() {
7172 new Signature ("+" , intstring , "String" , Type .OPERATOR ),
7273 new Signature ("+" , stringreal , "String" , Type .OPERATOR ),
7374 new Signature ("+" , realstring , "String" , Type .OPERATOR ),
74- new Signature ("CRMLtoModelica.Blocks.ClockAdd" , periodReal , params , "Clock" , Type .BLOCK ),
75- new Signature ("CRMLtoModelica.Blocks.ClockAdd" , clockReal , params , "Clock" , Type .BLOCK ),
76- new Signature ("CRMLtoModelica.Blocks.ClockAdd" , clockInteger , params , "Clock" , Type .BLOCK ),
77- new Signature ("CRMLtoModelica.Functions.add4" , bool2 , params , "Boolean" , Type .FUNCTION ));
75+ new Signature ("CRMLtoModelica.Blocks.ClockAdd" , periodReal , params2 , "Clock" , Type .BLOCK ),
76+ new Signature ("CRMLtoModelica.Blocks.ClockAdd" , clockReal , params2 , "Clock" , Type .BLOCK ),
77+ new Signature ("CRMLtoModelica.Blocks.ClockAdd" , clockInteger , params2 , "Clock" , Type .BLOCK ),
78+ new Signature ("CRMLtoModelica.Functions.add4" , bool2 , params2 , "Boolean" , Type .FUNCTION ));
7879
7980 built_in_operators .put ("+" , plus_sigs );
8081
@@ -83,14 +84,14 @@ public static HashMap<String, List<Signature>> get_operator_map() {
8384 new Signature ("-" , int1 , "Integer" , Type .OPERATOR ),
8485 new Signature ("-" , real1 , "Real" , Type .OPERATOR ),
8586 new Signature ("-" , real2 , "Real" , Type .OPERATOR ),
86- new Signature ("CRMLtoModelica.Functions.diff4" , bool2 , params , "Boolean" , Type .FUNCTION ));
87+ new Signature ("CRMLtoModelica.Functions.diff4" , bool2 , params2 , "Boolean" , Type .FUNCTION ));
8788
8889 built_in_operators .put ("-" , minus_sigs );
8990
9091 // * operators
9192 List <Signature > mult_sigs = Arrays .asList (new Signature ("*" , int2 , "Integer" , Type .OPERATOR ),
9293 new Signature ("*" , real2 , "Real" , Type .OPERATOR ),
93- new Signature ("CRMLtoModelica.Functions.mul4" , bool2 , params , "Boolean" , Type .FUNCTION ));
94+ new Signature ("CRMLtoModelica.Functions.mul4" , bool2 , params2 , "Boolean" , Type .FUNCTION ));
9495
9596 built_in_operators .put ("*" , mult_sigs );
9697
@@ -113,9 +114,9 @@ public static HashMap<String, List<Signature>> get_operator_map() {
113114 new Signature ("<=" , real2 , "Boolean" , Type .OPERATOR ),
114115 new Signature ("<=" , intreal , "Boolean" , Type .OPERATOR ),
115116 new Signature ("<=" , realint , "Boolean" , Type .OPERATOR ),
116- new Signature ("CRMLtoModelica.realPeriodleq" , realPeriod , params , "Boolean" , "leq" , Type .BLOCK ),
117- new Signature ("CRMLtoModelica.Blocks.Logical4.leq" , bool2 , params , "Boolean" , "leq" , Type .BLOCK ),
118- new Signature ("CRMLtoModelica.Functions.lEV" , event2 , params , "Boolean" , Type .FUNCTION ));
117+ new Signature ("CRMLtoModelica.realPeriodleq" , realPeriod , params2 , "Boolean" , "leq" , Type .BLOCK ),
118+ new Signature ("CRMLtoModelica.Blocks.Logical4.leq" , bool2 , params2 , "Boolean" , "leq" , Type .BLOCK ),
119+ new Signature ("CRMLtoModelica.Functions.lEV" , event2 , params2 , "Boolean" , Type .FUNCTION ));
119120
120121 built_in_operators .put ("<=" , leq_sigs );
121122
@@ -124,10 +125,10 @@ public static HashMap<String, List<Signature>> get_operator_map() {
124125 new Signature ("<" , real2 , "Boolean" , Type .OPERATOR ),
125126 new Signature ("<" , intreal , "Boolean" , Type .OPERATOR ),
126127 new Signature ("<" , realint , "Boolean" , Type .OPERATOR ),
127- new Signature ("leqArray" , realint , params , "Boolean" , Type .SET_OP , setOnvar , true ),
128- new Signature ("CRMLtoModelica.Blocks.realPeriodleq" , realPeriod , params , "Boolean" , Type .BLOCK ),
129- new Signature ("CRMLtoModelica.Blocks.Logical4.leq" , bool2 , params , "Boolean" , "leq" , Type .BLOCK ),
130- new Signature ("CRMLtoModelica.Functions.leqEV" , event2 , params , "Boolean" , Type .FUNCTION ));
128+ new Signature ("leqArray" , realint , params2 , "Boolean" , Type .SET_OP , setOnvar , true ),
129+ new Signature ("CRMLtoModelica.Blocks.realPeriodleq" , realPeriod , params2 , "Boolean" , Type .BLOCK ),
130+ new Signature ("CRMLtoModelica.Blocks.Logical4.leq" , bool2 , params2 , "Boolean" , "leq" , Type .BLOCK ),
131+ new Signature ("CRMLtoModelica.Functions.leqEV" , event2 , params2 , "Boolean" , Type .FUNCTION ));
131132
132133 built_in_operators .put ("<" , le_sigs );
133134
@@ -136,8 +137,8 @@ public static HashMap<String, List<Signature>> get_operator_map() {
136137 new Signature (">=" , real2 , "Boolean" , Type .OPERATOR ),
137138 new Signature (">=" , intreal , "Boolean" , Type .OPERATOR ),
138139 new Signature (">=" , realint , "Boolean" , Type .OPERATOR ),
139- new Signature ("CRMLtoModelica.Blocks.Logical4.geq" , bool2 , params , "Boolean" , Type .FUNCTION ),
140- new Signature ("CRMLtoModelica.Functions.gEV" , event2 , params , "Boolean" , Type .FUNCTION ));
140+ new Signature ("CRMLtoModelica.Blocks.Logical4.geq" , bool2 , params2 , "Boolean" , Type .FUNCTION ),
141+ new Signature ("CRMLtoModelica.Functions.gEV" , event2 , params2 , "Boolean" , Type .FUNCTION ));
141142
142143
143144 built_in_operators .put (">=" , geq_sigs );
@@ -147,8 +148,8 @@ public static HashMap<String, List<Signature>> get_operator_map() {
147148 new Signature (">" , real2 , "Boolean" , Type .OPERATOR ),
148149 new Signature (">" , intreal , "Boolean" , Type .OPERATOR ),
149150 new Signature (">" , realint , "Boolean" , Type .OPERATOR ),
150- new Signature ("CRMLtoModelica.Functions.geq" , bool2 , params , "Boolean" , Type .FUNCTION ),
151- new Signature ("CRMLtoModelica.Functions.geqEV" , event2 , params , "Boolean" , Type .FUNCTION ));
151+ new Signature ("CRMLtoModelica.Functions.geq" , bool2 , params2 , "Boolean" , Type .FUNCTION ),
152+ new Signature ("CRMLtoModelica.Functions.geqEV" , event2 , params2 , "Boolean" , Type .FUNCTION ));
152153
153154 built_in_operators .put (">" , gr_sigs );
154155
@@ -157,9 +158,9 @@ public static HashMap<String, List<Signature>> get_operator_map() {
157158 new Signature ("==" , real2 , "Boolean" , Type .OPERATOR ),
158159 new Signature ("==" , intreal , "Boolean" , Type .OPERATOR ),
159160 new Signature ("==" , realint , "Boolean" , Type .OPERATOR ),
160- new Signature ("eqArray" , realint , params , "Boolean" , Type .SET_OP , setOnvar , true ),
161- new Signature ("CRMLtoModelica.Blocks.realPeriodeq" , realPeriod , params , "Boolean" , Type .BLOCK ),
162- new Signature ("CRMLtoModelica.Blocks.Logical4.eq" , bool2 , params , "Boolean" , "eq" , Type .BLOCK ));
161+ new Signature ("eqArray" , realint , params2 , "Boolean" , Type .SET_OP , setOnvar , true ),
162+ new Signature ("CRMLtoModelica.Blocks.realPeriodeq" , realPeriod , params2 , "Boolean" , Type .BLOCK ),
163+ new Signature ("CRMLtoModelica.Blocks.Logical4.eq" , bool2 , params2 , "Boolean" , "eq" , Type .BLOCK ));
163164
164165 built_in_operators .put ("==" , eq_sigs );
165166
@@ -168,9 +169,9 @@ public static HashMap<String, List<Signature>> get_operator_map() {
168169 new Signature ("<>" , real2 , "Boolean" , Type .OPERATOR ),
169170 new Signature ("<>" , intreal , "Boolean" , Type .OPERATOR ),
170171 new Signature ("<>" , realint , "Boolean" , Type .OPERATOR ),
171- new Signature ("neqArray" , realint , params , "Boolean" , Type .SET_OP , setOnvar , true ),
172- new Signature ("CRMLtoModelica.realPeriodneq" , realPeriod , params , "Boolean" , Type .BLOCK ),
173- new Signature ("CRMLtoModelica.Blocks.Logical4.neq" , bool2 , params , "Boolean" , "neq" , Type .BLOCK ));
172+ new Signature ("neqArray" , realint , params2 , "Boolean" , Type .SET_OP , setOnvar , true ),
173+ new Signature ("CRMLtoModelica.realPeriodneq" , realPeriod , params2 , "Boolean" , Type .BLOCK ),
174+ new Signature ("CRMLtoModelica.Blocks.Logical4.neq" , bool2 , params2 , "Boolean" , "neq" , Type .BLOCK ));
174175
175176 built_in_operators .put ("<>" , neq_sigs );
176177
@@ -226,85 +227,92 @@ public static HashMap<String, List<Signature>> get_operator_map() {
226227
227228 // and operators
228229 List <Signature > and_sigs = Arrays .asList (
229- new Signature ("CRMLtoModelica.Functions.and4" , bool2 , params , "Boolean" , Type .FUNCTION ),
230- new Signature ("arrayAnd " , bool1 , params , "Boolean" , Type .SET_OP , setUnary , false ),
231- new Signature ("CRMLtoModelica.Blocks.unaryBoolAnd" , bool1 , params , "Boolean" , Type .BLOCK ),
232- new Signature ("andOnPeriod" , Arrays .asList ("Periods" ), params , "Boolean" , Type .FUNCTION ));
230+ new Signature ("CRMLtoModelica.Functions.and4" , bool2 , params2 , "Boolean" , Type .FUNCTION ),
231+ new Signature ("CRMLtoModelica.Blocks.setAnd " , bool1 , param1 , "Boolean" , Type .SET_OP , setUnary , false ),
232+ new Signature ("CRMLtoModelica.Blocks.unaryBoolAnd" , bool1 , param1 , "Boolean" , Type .BLOCK ),
233+ new Signature ("andOnPeriod" , Arrays .asList ("Periods" ), param1 , "Boolean" , Type .FUNCTION ));
233234 built_in_operators .put ("and" , and_sigs );
234235
235236 // or operators
236237 List <Signature > or_sigs = Arrays .asList (
237- new Signature ("CRMLtoModelica.Functions.or4" , bool2 , params , "Boolean" , Type .FUNCTION ),
238- new Signature ("arrayOr" , bool1 , params , "Boolean" , Type .SET_OP , setUnary , false ));
238+ new Signature ("CRMLtoModelica.Functions.or4" , bool2 , params2 , "Boolean" , Type .FUNCTION ),
239+ new Signature ("arrayOr" , bool1 , param1 , "Boolean" , Type .SET_OP , setUnary , false ));
239240
240241 built_in_operators .put ("or" , or_sigs );
241242
242243 // not operators
243244 List <Signature > not_sigs = Arrays .asList (
244- new Signature ("CRMLtoModelica.Functions.not4" , bool1 , params , "Boolean" , Type .FUNCTION ),
245- new Signature ("arrayNot" , bool1 , params , "Boolean" , Type .SET_OP , setUnary , false ));
245+ new Signature ("CRMLtoModelica.Functions.not4" , bool1 , param1 , "Boolean" , Type .FUNCTION ),
246+ new Signature ("arrayNot" , bool1 , param1 , "Boolean" , Type .SET_OP , setUnary , false ));
246247
247248 built_in_operators .put ("not" , not_sigs );
248249
249250 // end operators TODO proper implementation
250251 built_in_operators .put ("end" ,
251- Arrays .asList (new Signature ("CRMLtoModelica.Functions.PEnd" , Arrays .asList ("Period" ), params , "Event" ,
252+ Arrays .asList (new Signature ("CRMLtoModelica.Functions.PEnd" , Arrays .asList ("Period" ), param1 , "Event" ,
252253 Type .FUNCTION )));
253254 built_in_operators .put ("start" ,
254- Arrays .asList (new Signature ("CRMLtoModelica.Functions.PStart" , Arrays .asList ("Period" ), params , "Event" ,
255+ Arrays .asList (new Signature ("CRMLtoModelica.Functions.PStart" , Arrays .asList ("Period" ), param1 , "Event" ,
255256 Type .FUNCTION )));
256257
257258 // tick operator
258259 built_in_operators .put ("tick" ,
259- Arrays .asList (new Signature ("CRMLtoModelica.Blocks.ClockTick" , Arrays .asList ("Clock" ), params , "Event" ,
260+ Arrays .asList (new Signature ("CRMLtoModelica.Blocks.ClockTick" , Arrays .asList ("Clock" ), param1 , "Event" ,
260261 Type .BLOCK )));
261262
262263 // filter operator
263264 built_in_operators .put ("filter" ,
264- Arrays .asList (new Signature ("CRMLtoModelica.Blocks.EventFilter" , Arrays .asList ("Clock" , "Boolean" ), params ,
265+ Arrays .asList (new Signature ("CRMLtoModelica.Blocks.EventFilter" , Arrays .asList ("Clock" , "Boolean" ), params2 ,
265266 "Clock" , Type .BLOCK )));
266267
267268 // card operator
268269 built_in_operators .put ("card" ,
269- Arrays .asList (new Signature ("CRMLtoModelica.Blocks.CardClock" , Arrays .asList ("Clock" ), params ,
270+ Arrays .asList (new Signature ("CRMLtoModelica.Blocks.CardClock" , Arrays .asList ("Clock" ), param1 ,
270271 "Integer" , Type .BLOCK )));
271272
272273 // integrate operator
273274 built_in_operators .put ("integrate" ,
274- Arrays .asList (new Signature ("CRMLtoModelica.Blocks.Integrate" , Arrays .asList ("Boolean" , "Period" ), params ,
275+ Arrays .asList (new Signature ("CRMLtoModelica.Blocks.Integrate" , Arrays .asList ("Boolean" , "Period" ), param1 ,
275276 "Integer" , Type .BLOCK )));
276277
277278 // CONSTRUCTORS TODO finalize constructor table
278279
279280 // String
280- List <Signature > string_sigs = Arrays .asList (new Signature ("String" , int1 , params , "String" , Type .FUNCTION ),
281- new Signature ("String" , real1 , params , "String" , Type .FUNCTION ),
282- new Signature ("CRMLtoModelica.Functions.Bool4toString" , bool1 , params , "String" , Type .FUNCTION ));
281+ List <Signature > string_sigs = Arrays .asList (new Signature ("String" , int1 , param1 , "String" , Type .FUNCTION ),
282+ new Signature ("String" , real1 , param1 , "String" , Type .FUNCTION ),
283+ new Signature ("CRMLtoModelica.Functions.Bool4toString" , bool1 , param1 , "String" , Type .FUNCTION ));
283284
284285 built_in_operators .put ("String" , string_sigs );
285286
286287 // Integer
287- List <Signature > integer_sigs = Arrays .asList (new Signature ("Integer" , int1 , params , "Integer" , Type .FUNCTION ),
288- new Signature ("Integer" , real1 , params , "integer" , Type .FUNCTION ));
288+ List <Signature > integer_sigs = Arrays .asList (new Signature ("Integer" , int1 , param1 , "Integer" , Type .FUNCTION ),
289+ new Signature ("Integer" , real1 , param1 , "integer" , Type .FUNCTION ));
289290
290291 built_in_operators .put ("Integer" , integer_sigs );
291292
292293 // Real
293- List <Signature > real_sigs = Arrays .asList (new Signature ("Real" , int1 , params , "Real" , Type .FUNCTION ),
294- new Signature ("Real" , real1 , params , "real" , Type .FUNCTION ));
294+ List <Signature > real_sigs = Arrays .asList (new Signature ("Real" , int1 , param1 , "Real" , Type .FUNCTION ),
295+ new Signature ("Real" , real1 , param1 , "real" , Type .FUNCTION ));
295296
296297 built_in_operators .put ("Real" , real_sigs );
297298
298299 // Boolean
299- List <Signature > bool_sigs = Arrays .asList (new Signature ("CRMLtoModelica.Functions.Event2Boolean" , Arrays .asList ("Event" ), params , "Boolean" , Type .FUNCTION ));
300+ List <Signature > bool_sigs = Arrays .asList (new Signature ("CRMLtoModelica.Functions.Event2Boolean" , Arrays .asList ("Event" ), param1 , "Boolean" , Type .FUNCTION ));
300301
301302 built_in_operators .put ("Boolean" , bool_sigs );
302303
303304 // Event
304- List <Signature > event_sigs = Arrays .asList (new Signature ("CRMLtoModelica.Types.Event" , bool1 , params , "Event" , Type .BLOCK ));
305+ List <Signature > event_sigs = Arrays .asList (new Signature ("CRMLtoModelica.Types.Event" , bool1 , param1 , "Event" , Type .BLOCK ));
305306
306307 built_in_operators .put ("Event" , event_sigs );
307308
309+ // Periods
310+ List <Signature > periods_sigs = Arrays .asList (new Signature ("CRMLtoModelica.Types.Periods" , Arrays .asList ("Event" ), param1 , "Periods" , Type .BLOCK , Arrays .asList (true ), false ));
311+
312+ built_in_operators .put ("Periods" , periods_sigs );
313+
314+
315+
308316 return built_in_operators ;
309317 }
310318
@@ -316,10 +324,14 @@ public static Signature is_defined(HashMap<String, List<Signature>> operator_map
316324 if (sigs == null )
317325 return null ;
318326
319- for (Signature s : sigs )
327+ for (Signature s : sigs ){
328+ System .out .println ("SIG NAME: " + s .function_name + " " +s .variable_is_set .toString ());
320329 if (s .variable_types .size () == 1 && s .variable_types .get (0 ).equals (type )
321330 && s .variable_is_set .get (0 ) == isSet )
322- return s ;
331+
332+ return s ;
333+ }
334+
323335
324336 return null ;
325337 }
0 commit comments