Newer
Older
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package ui;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
import myutil.Conversion;
import myutil.TraceManager;
import tmltranslator.SecurityPattern;
import tmltranslator.TMLActionState;
import tmltranslator.TMLActivity;
import tmltranslator.TMLActivityElement;
import tmltranslator.TMLAttribute;
import tmltranslator.TMLChannel;
import tmltranslator.TMLCheckingError;
import tmltranslator.TMLChoice;
import tmltranslator.TMLDelay;
import tmltranslator.TMLEvent;
import tmltranslator.TMLExecC;
import tmltranslator.TMLExecCInterval;
import tmltranslator.TMLExecI;
import tmltranslator.TMLExecIInterval;
import tmltranslator.TMLForLoop;
import tmltranslator.TMLJunction;
import tmltranslator.TMLModeling;
import tmltranslator.TMLNotifiedEvent;
import tmltranslator.TMLRandom;
import tmltranslator.TMLRandomSequence;
import tmltranslator.TMLReadChannel;
import tmltranslator.TMLRequest;
import tmltranslator.TMLSelectEvt;
import tmltranslator.TMLSendEvent;
import tmltranslator.TMLSendRequest;
import tmltranslator.TMLSequence;
import tmltranslator.TMLStartState;
import tmltranslator.TMLStopState;
import tmltranslator.TMLTask;
import tmltranslator.TMLType;
import tmltranslator.TMLWaitEvent;
import tmltranslator.TMLWriteChannel;
import translator.CheckingError;
import ui.tmlad.TMLADActionState;
import ui.tmlad.TMLADChoice;
import ui.tmlad.TMLADDecrypt;
import ui.tmlad.TMLADDelay;
import ui.tmlad.TMLADDelayInterval;
import ui.tmlad.TMLADEncrypt;
import ui.tmlad.TMLADExecC;
import ui.tmlad.TMLADExecCInterval;
import ui.tmlad.TMLADExecI;
import ui.tmlad.TMLADExecIInterval;
import ui.tmlad.TMLADForEverLoop;
import ui.tmlad.TMLADForLoop;
import ui.tmlad.TMLADForStaticLoop;
import ui.tmlad.TMLADNotifiedEvent;
import ui.tmlad.TMLADRandom;
import ui.tmlad.TMLADReadChannel;
import ui.tmlad.TMLADReadRequestArg;
import ui.tmlad.TMLADSelectEvt;
import ui.tmlad.TMLADSendEvent;
import ui.tmlad.TMLADSendRequest;
import ui.tmlad.TMLADSequence;
import ui.tmlad.TMLADStartState;
import ui.tmlad.TMLADStopState;
import ui.tmlad.TMLADUnorderedSequence;
import ui.tmlad.TMLADWaitEvent;
import ui.tmlad.TMLADWriteChannel;
import ui.tmlad.TMLActivityDiagramPanel;
public class ActivityDiagram2TMLTranslator {
public static final ActivityDiagram2TMLTranslator INSTANCE = new ActivityDiagram2TMLTranslator();
private ActivityDiagram2TMLTranslator() {
}
public void generateTaskActivityDiagrams( final TMLTask tmltask,
final List<CheckingError> checkingErrors,
final List<CheckingError> warnings,
final CorrespondanceTGElement corrTgElement,
final TMLModeling<TGComponent> tmlm,
final Map<String, SecurityPattern> securityPatterns,
final Map<String, String> table,
final List<String> removedChannels,
final List<String> removedEvents,
final List<String> removedRequests )
throws MalformedTMLDesignException {
TMLActivity activity = tmltask.getActivityDiagram();
TMLActivityDiagramPanel tadp = (TMLActivityDiagramPanel)(activity.getReferenceObject());
//TraceManager.addDev( "Generating activity diagram of: " + tmltask.getName());
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
// search for start state
List<TGComponent> list = tadp.getComponentList();
Iterator<TGComponent> iterator = list.listIterator();
TGComponent tgc;
TMLADStartState tss = null;
int cptStart = 0;
// boolean rndAdded = false;
while(iterator.hasNext()) {
tgc = iterator.next();
if (tgc instanceof TMLADStartState) {
tss = (TMLADStartState) tgc;
cptStart ++;
}
}
if (tss == null) {
TMLCheckingError ce = new TMLCheckingError(CheckingError.BEHAVIOR_ERROR, "No start state in the TML activity diagram of " + tmltask.getName());
ce.setTMLTask(tmltask);
checkingErrors.add(ce);
return;
}
if (cptStart > 1) {
TMLCheckingError ce = new TMLCheckingError(CheckingError.BEHAVIOR_ERROR, "More than one start state in the TML activity diagram of " + tmltask.getName());
ce.setTMLTask(tmltask);
checkingErrors.add(ce);
return;
}
// Adding start state
TMLStartState tmlss = new TMLStartState("start", tss);
corrTgElement.addCor(tmlss, tss);
activity.setFirst(tmlss);
// Creation of other elements
TMLChannel channel;
String [] channels;
TMLEvent event;
TMLRequest request;
TMLADRandom tmladrandom;
TMLRandom tmlrandom;
TMLActionState tmlaction;
TMLChoice tmlchoice;
TMLExecI tmlexeci;
TMLExecIInterval tmlexecii;
TMLExecC tmlexecc;
TMLExecCInterval tmlexecci;
TMLForLoop tmlforloop;
TMLReadChannel tmlreadchannel;
TMLSendEvent tmlsendevent;
TMLSendRequest tmlsendrequest;
TMLStopState tmlstopstate;
TMLWaitEvent tmlwaitevent;
TMLNotifiedEvent tmlnotifiedevent;
TMLWriteChannel tmlwritechannel;
TMLSequence tmlsequence;
TMLRandomSequence tmlrsequence;
TMLSelectEvt tmlselectevt;
TMLDelay tmldelay;
int staticLoopIndex = 0;
String sl = "", tmp;
TMLType tt;
TMLAttribute tmlt;
iterator = list.listIterator();
while(iterator.hasNext()) {
tgc = iterator.next();
// Issue #69: Manage component enablement
if ( tgc.isEnabled() ) {
if (tgc.getCheckLatency()){
String name = tmltask.getName() + ":" + tgc.getName();
name = name.replaceAll(" ","");
//TraceManager.addDev("To check " + name);
if (tgc.getValue().contains("(")) {
tmlm.addCheckedActivity(tgc, name + ":" + tgc.getValue().split("\\(")[0]);
} else {
if (tgc instanceof TMLADExecI) {
tmlm.addCheckedActivity(tgc, ((TMLADExecI) tgc).getDelayValue());
}
}
}
if (tgc instanceof TMLADActionState) {
tmlaction = new TMLActionState("action", tgc);
tmp = ((TMLADActionState)(tgc)).getAction();
tmp = modifyActionString(tmp);
tmlaction.setAction(tmp);
activity.addElement(tmlaction);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlaction, tgc);
} else if (tgc instanceof TMLADRandom) {
tmladrandom = (TMLADRandom)tgc;
tmlrandom = new TMLRandom("random" + tmladrandom.getValue(), tgc);
tmp = tmladrandom.getVariable();
tmp = modifyActionString(tmp);
tmlrandom.setVariable(tmp);
tmp = tmladrandom.getMinValue();
tmp = modifyActionString(tmp);
tmlrandom.setMinValue(tmp);
tmp = tmladrandom.getMaxValue();
tmp = modifyActionString(tmp);
tmlrandom.setMaxValue(tmp);
tmlrandom.setFunctionId(tmladrandom.getFunctionId());
activity.addElement(tmlrandom);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlrandom, tgc);
} else if (tgc instanceof TMLADChoice) {
tmlchoice = new TMLChoice("choice", tgc);
// Guards are added at the same time as next activities
activity.addElement(tmlchoice);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlchoice, tgc);
} else if (tgc instanceof TMLADSelectEvt) {
tmlselectevt = new TMLSelectEvt("select", tgc);
activity.addElement(tmlselectevt);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlselectevt, tgc);
} else if (tgc instanceof TMLADExecI) {
tmlexeci = new TMLExecI("execi", tgc);
tmlexeci.setAction(modifyString(((TMLADExecI)tgc).getDelayValue()));
tmlexeci.setValue(((TMLADExecI)tgc).getDelayValue());
activity.addElement(tmlexeci);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlexeci, tgc);
} else if (tgc instanceof TMLADExecIInterval) {
tmlexecii = new TMLExecIInterval("execi", tgc);
tmlexecii.setValue(tgc.getValue());
tmlexecii.setMinDelay(modifyString(((TMLADExecIInterval)tgc).getMinDelayValue()));
tmlexecii.setMaxDelay(modifyString(((TMLADExecIInterval)tgc).getMaxDelayValue()));
activity.addElement(tmlexecii);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlexecii, tgc);
} else if (tgc instanceof TMLADEncrypt) {
tmlexecc = new TMLExecC("encrypt_"+((TMLADEncrypt)tgc).securityContext, tgc);
activity.addElement(tmlexecc);
SecurityPattern sp = securityPatterns.get(((TMLADEncrypt)tgc).securityContext);
if (sp ==null){
//Throw error for missing security pattern
UICheckingError ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "Security Pattern " + ((TMLADEncrypt)tgc).securityContext + " not found");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
}
else {
tmlexecc.securityPattern = sp;
tmlexecc.setAction(Integer.toString(sp.encTime));
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
tmlm.securityTaskMap.get(sp).add(tmltask);
corrTgElement.addCor(tmlexecc, tgc);
}
} else if (tgc instanceof TMLADDecrypt) {
tmlexecc = new TMLExecC("decrypt_"+((TMLADDecrypt)tgc).securityContext, tgc);
activity.addElement(tmlexecc);
SecurityPattern sp = securityPatterns.get(((TMLADDecrypt)tgc).securityContext);
if (sp ==null){
//Throw error for missing security pattern
UICheckingError ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "Security Pattern " + ((TMLADDecrypt)tgc).securityContext + " not found");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
}
else {
tmlexecc.securityPattern = sp;
tmlexecc.setAction(Integer.toString(sp.decTime));
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlexecc, tgc);
tmlm.securityTaskMap.get(sp).add(tmltask);
}
} else if (tgc instanceof TMLADExecC) {
tmlexecc = new TMLExecC("execc", tgc);
tmlexecc.setValue(((TMLADExecC)tgc).getDelayValue());
tmlexecc.setAction(modifyString(((TMLADExecC)tgc).getDelayValue()));
activity.addElement(tmlexecc);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlexecc, tgc);
} else if (tgc instanceof TMLADExecCInterval) {
tmlexecci = new TMLExecCInterval("execci", tgc);
tmlexecci.setMinDelay(modifyString(((TMLADExecCInterval)tgc).getMinDelayValue()));
tmlexecci.setMaxDelay(modifyString(((TMLADExecCInterval)tgc).getMaxDelayValue()));
activity.addElement(tmlexecci);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlexecci, tgc);
} else if (tgc instanceof TMLADDelay) {
tmldelay = new TMLDelay("d-delay", tgc);
tmldelay.setMinDelay(modifyString(((TMLADDelay)tgc).getDelayValue()));
tmldelay.setMaxDelay(modifyString(((TMLADDelay)tgc).getDelayValue()));
tmldelay.setUnit(((TMLADDelay)tgc).getUnit());
tmldelay.setActiveDelay(((TMLADDelay)tgc).getActiveDelayEnable());
activity.addElement(tmldelay);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmldelay, tgc);
} else if (tgc instanceof TMLADDelayInterval) {
tmldelay = new TMLDelay("nd-delay", tgc);
tmldelay.setMinDelay(modifyString(((TMLADDelayInterval)tgc).getMinDelayValue()));
tmldelay.setMaxDelay(modifyString(((TMLADDelayInterval)tgc).getMaxDelayValue()));
tmldelay.setUnit(((TMLADDelayInterval)tgc).getUnit());
tmldelay.setActiveDelay(((TMLADDelayInterval)tgc).getActiveDelayEnableValue());
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
activity.addElement(tmldelay);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmldelay, tgc);
} else if (tgc instanceof TMLADForLoop) {
tmlforloop = new TMLForLoop("loop", tgc);
tmlforloop.setInit(modifyString(((TMLADForLoop)tgc).getInit()));
tmp = ((TMLADForLoop)tgc).getCondition();
/*if (tmp.trim().length() == 0) {
tmp = "true";
}*/
tmlforloop.setCondition(modifyString(tmp));
tmlforloop.setIncrement(modifyActionString(((TMLADForLoop)tgc).getIncrement()));
activity.addElement(tmlforloop);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlforloop, tgc);
} else if (tgc instanceof TMLADForStaticLoop) {
sl = "loop__" + staticLoopIndex;
tt = new TMLType(TMLType.NATURAL);
tmlt = new TMLAttribute(sl, tt);
tmlt.initialValue = "0";
tmltask.addAttribute(tmlt);
tmlforloop = new TMLForLoop(sl, tgc);
tmlforloop.setInit(sl + " = 0");
tmlforloop.setCondition(sl + "<" + modifyString(tgc.getValue()));
tmlforloop.setIncrement(sl + " = " + sl + " + 1");
activity.addElement(tmlforloop);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlforloop, tgc);
staticLoopIndex++;
} else if (tgc instanceof TMLADForEverLoop) {
/*sl = "loop__" + staticLoopIndex;
tt = new TMLType(TMLType.NATURAL);
tmlt = new TMLAttribute(sl, tt);
tmlt.initialValue = "0";
tmltask.addAttribute(tmlt);*/
tmlforloop = new TMLForLoop("infiniteloop", tgc);
tmlforloop.setInit("");
tmlforloop.setCondition("");
tmlforloop.setIncrement("");
tmlforloop.setInfinite(true);
activity.addElement(tmlforloop);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlforloop, tgc);
staticLoopIndex++;
tmlstopstate = new TMLStopState("Stop after infinite loop", null);
activity.addElement(tmlstopstate);
tmlforloop.addNext(tmlstopstate);
} else if (tgc instanceof TMLADSequence) {
tmlsequence = new TMLSequence("seq", tgc);
activity.addElement(tmlsequence);
corrTgElement.addCor(tmlsequence, tgc);
} else if (tgc instanceof TMLADUnorderedSequence) {
tmlrsequence = new TMLRandomSequence("rseq", tgc);
activity.addElement(tmlrsequence);
corrTgElement.addCor(tmlrsequence, tgc);
} else if (tgc instanceof TMLADReadChannel) {
// Get the channel
//TMLADReadChannel rd = (TMLADReadChannel) tgc;
channel = tmlm.getChannelByName( getFromTable( tmltask, ((TMLADReadChannel)tgc).getChannelName(), table ) );
/*if (rd.isAttacker()){
channel = tmlm.getChannelByName(getAttackerChannel(((TMLADReadChannel)tgc).getChannelName()));
}*/
if (channel == null) {
if (Conversion.containsStringInList(removedChannels, ((TMLADReadChannel)tgc).getChannelName())) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "A call to " + ((TMLADReadChannel)tgc).getChannelName() + " has been removed because the corresponding channel is not taken into account");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
warnings.add(ce);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
activity.addElement(new TMLJunction("void junction", tgc));
} else {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, ((TMLADReadChannel)tgc).getChannelName() + " is an unknown channel");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
checkingErrors.add(ce);
}
} else {
tmlreadchannel = new TMLReadChannel("read channel", tgc);
tmlreadchannel.setNbOfSamples(modifyString(((TMLADReadChannel)tgc).getSamplesValue()));
tmlreadchannel.setEncForm(((TMLADReadChannel) tgc).getEncForm());
tmlreadchannel.addChannel(channel);
//security pattern
if (securityPatterns.get(((TMLADReadChannel)tgc).getSecurityContext())!=null){
tmlreadchannel.securityPattern= securityPatterns.get(((TMLADReadChannel)tgc).getSecurityContext());
//NbOfSamples will increase due to extra overhead from MAC
try {
cur = Integer.valueOf(modifyString(((TMLADReadChannel)tgc).getSamplesValue()));
} catch(NumberFormatException e) {
} catch(NullPointerException e) {
}*/
String curS = modifyString(((TMLADReadChannel)tgc).getSamplesValue());
String addS = "" + tmlreadchannel.securityPattern.overhead;
//int add = Integer.valueOf(tmlreadchannel.securityPattern.overhead);
if (!tmlreadchannel.securityPattern.nonce.equals("")){
SecurityPattern nonce = securityPatterns.get(tmlreadchannel.securityPattern.nonce);
if (nonce!=null){
//add = Integer.valueOf(nonce.overhead);
addS = "" + nonce.overhead;
}
}
//cur = cur+ add;
//tmlreadchannel.setNbOfSamples(Integer.toString(cur));
tmlreadchannel.setNbOfSamples(curS + " + " + addS);
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
}
else if (!((TMLADReadChannel)tgc).getSecurityContext().isEmpty()){
//Throw error for missing security pattern
UICheckingError ce = new UICheckingError(CheckingError.STRUCTURE_ERROR, "Security Pattern " + ((TMLADReadChannel)tgc).getSecurityContext() + " not found");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
}
if (tmltask.isAttacker()){
tmlreadchannel.setAttacker(true);
}
activity.addElement(tmlreadchannel);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlreadchannel, tgc);
}
} else if (tgc instanceof TMLADSendEvent) {
event = tmlm.getEventByName(getFromTable(tmltask, ((TMLADSendEvent)tgc).getEventName(), table ));
if (event == null) {
if (Conversion.containsStringInList(removedEvents, ((TMLADSendEvent)tgc).getEventName())) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "A call to " + ((TMLADSendEvent)tgc).getEventName() + " has been removed because the corresponding event is not taken into account");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
warnings.add(ce);
activity.addElement(new TMLJunction("void junction", tgc));
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
} else {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, ((TMLADSendEvent)tgc).getEventName() + " is an unknown event");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
}
} else {
tmlsendevent = new TMLSendEvent("send event", tgc);
tmlsendevent.setEvent(event);
for(int i=0; i<((TMLADSendEvent)tgc).realNbOfParams(); i++) {
tmp = modifyString(((TMLADSendEvent)tgc).getRealParamValue(i));
Vector<String> allVariables = tmltask.getAllAttributesStartingWith(tmp + "__");
if (allVariables.size() > 0) {
for(int k=0; k<allVariables.size(); k++) {
//TraceManager.addDev("Adding record: " + allVariables.get(k));
tmlsendevent.addParam(allVariables.get(k));
}
} else {
//TraceManager.addDev("Adding param: " + tmp);
tmlsendevent.addParam(tmp);
}
}
if (event.getNbOfParams() != tmlsendevent.getNbOfParams()) {
TraceManager.addDev("ERROR : event#:" + event.getNbOfParams() + " sendevent#:" + tmlsendevent.getNbOfParams());
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, ((TMLADSendEvent)tgc).getEventName() + ": wrong number of parameters");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
} else {
activity.addElement(tmlsendevent);
corrTgElement.addCor(tmlsendevent, tgc);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
}
}
} else if (tgc instanceof TMLADSendRequest) {
request = tmlm.getRequestByName(getFromTable(tmltask, ((TMLADSendRequest)tgc).getRequestName(), table ) );
if (request == null) {
if (Conversion.containsStringInList(removedRequests, ((TMLADSendRequest)tgc).getRequestName())) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "A call to " + ((TMLADSendRequest)tgc).getRequestName() + " has been removed because the corresponding request is not taken into account");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
warnings.add(ce);
activity.addElement(new TMLJunction("void junction", tgc));
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
} else {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, ((TMLADSendRequest)tgc).getRequestName() + " is an unknown request");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
}
} else {
tmlsendrequest = new TMLSendRequest("send request", tgc);
tmlsendrequest.setRequest(request);
for(int i=0; i<((TMLADSendRequest)tgc).realNbOfParams(); i++) {
tmp = modifyString(((TMLADSendRequest)tgc).getRealParamValue(i));
Vector<String> allVariables = tmltask.getAllAttributesStartingWith(tmp + "__");
if (allVariables.size() > 0) {
for(int k=0; k<allVariables.size(); k++) {
//TraceManager.addDev("Adding record: " + allVariables.get(k));
tmlsendrequest.addParam(allVariables.get(k));
request.addParamName(allVariables.get(k));
}
} else {
//TraceManager.addDev("Adding param: " + tmp);
tmlsendrequest.addParam(tmp);
request.addParamName(tmp);
}
}
if (request.getNbOfParams() != tmlsendrequest.getNbOfParams()) {
TraceManager.addDev("ERROR : request#:" + request.getNbOfParams() + " sendrequest#:" + tmlsendrequest.getNbOfParams());
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, ((TMLADSendRequest)tgc).getRequestName() + ": wrong number of parameters");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
} else {
activity.addElement(tmlsendrequest);
corrTgElement.addCor(tmlsendrequest, tgc);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
}
}
} else if (tgc instanceof TMLADReadRequestArg) {
request = tmlm.getRequestToMe(tmltask);
if (request == null) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "This task is not requested: cannot use \"reading request arg\" operator");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
} else {
tmlaction = new TMLActionState("action reading args", tgc);
String act = "";
int cpt = 1;
for(int i=0; i<((TMLADReadRequestArg)tgc).realNbOfParams(); i++) {
tmp = modifyString(((TMLADReadRequestArg)tgc).getRealParamValue(i));
Vector<String> allVariables = tmltask.getAllAttributesStartingWith(tmp + "__");
if (allVariables.size() > 0) {
for(int k=0; k<allVariables.size(); k++) {
//TraceManager.addDev("Adding record: " + allVariables.get(k));
if (cpt != 1) {
act += "$";
}
act += allVariables.get(k) + " = arg" + cpt + "__req";
cpt ++;
}
} else {
//TraceManager.addDev("Adding param: " + tmp);
if (cpt != 1) {
act += "$";
}
act += tmp + " = arg" + cpt + "__req";
cpt ++;
}
}
if (request.getNbOfParams() != (cpt-1)) {
//TraceManager.addDev("ERROR : request#:" + request.getNbOfParams() + " read request arg#:" + (cpt-1));
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "Wrong number of parameters in \"reading request arg\" operator");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
} else {
//TraceManager.addDev("Adding action = " + act);
tmlaction.setAction(act);
activity.addElement(tmlaction);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlaction, tgc);
}
}
} else if (tgc instanceof TMLADStopState) {
tmlstopstate = new TMLStopState("stop state", tgc);
activity.addElement(tmlstopstate);
corrTgElement.addCor(tmlstopstate, tgc);
} else if (tgc instanceof TMLADNotifiedEvent) {
event = tmlm.getEventByName(getFromTable(tmltask, ((TMLADNotifiedEvent)tgc).getEventName(), table ) );
if (event == null) {
if( removedEvents.size() > 0 ) {
if (Conversion.containsStringInList(removedEvents, ((TMLADNotifiedEvent)tgc).getEventName())) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "A call to " + ((TMLADNotifiedEvent)tgc).getEventName() + " has been removed because the corresponding event is not taken into account");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
warnings.add(ce);
activity.addElement(new TMLJunction("void junction", tgc));
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
} else {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, ((TMLADNotifiedEvent)tgc).getEventName() + " is an unknown event");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
}
} else {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, ((TMLADNotifiedEvent)tgc).getEventName() + " is an unknown event");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
}
} else {
event.setNotified(true);
tmlnotifiedevent = new TMLNotifiedEvent("notified event", tgc);
tmlnotifiedevent.setEvent(event);
tmlnotifiedevent.setVariable(modifyString(((TMLADNotifiedEvent)tgc).getVariable()));
activity.addElement(tmlnotifiedevent);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlnotifiedevent, tgc);
}
} else if (tgc instanceof TMLADWaitEvent) {
event = tmlm.getEventByName(getFromTable(tmltask, ((TMLADWaitEvent)tgc).getEventName(), table ) );
if (event == null) {
if( removedEvents.size() > 0 ) {
if (Conversion.containsStringInList(removedEvents, ((TMLADWaitEvent)tgc).getEventName())) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "A call to " + ((TMLADWaitEvent)tgc).getEventName() + " has been removed because the corresponding event is not taken into account");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
warnings.add(ce);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
activity.addElement(new TMLJunction("void junction", tgc));
} else {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, ((TMLADWaitEvent)tgc).getEventName() + " is an unknown event");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
checkingErrors.add(ce);
}
} else {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, ((TMLADWaitEvent)tgc).getEventName() + " is an unknown event");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
checkingErrors.add(ce);
}
} else {
//TraceManager.addDev("Nb of param of event:" + event.getNbOfParams());
tmlwaitevent = new TMLWaitEvent("wait event", tgc);
tmlwaitevent.setEvent(event);
for(int i=0; i<((TMLADWaitEvent)tgc).realNbOfParams(); i++) {
tmp = modifyString(((TMLADWaitEvent)tgc).getRealParamValue(i));
Vector<String> allVariables = tmltask.getAllAttributesStartingWith(tmp + "__");
if (allVariables.size() > 0) {
for(int k=0; k<allVariables.size(); k++) {
//TraceManager.addDev("Adding record: " + allVariables.get(k));
tmlwaitevent.addParam(allVariables.get(k));
}
} else {
//TraceManager.addDev("Adding param: " + tmp);
tmlwaitevent.addParam(tmp);
}
}
if (event.getNbOfParams() != tmlwaitevent.getNbOfParams()) {
//TraceManager.addDev("ERROR : event#:" + event.getNbOfParams() + " waitevent#:" + tmlwaitevent.getNbOfParams());
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, ((TMLADWaitEvent)tgc).getEventName() + ": wrong number of parameters");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
} else {
activity.addElement(tmlwaitevent);
corrTgElement.addCor(tmlwaitevent, tgc);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
}
}
} else if (tgc instanceof TMLADWriteChannel) {
// Get channels
//TMLADWriteChannel wr = (TMLADWriteChannel) tgc;
channels = ((TMLADWriteChannel)tgc).getChannelsByName();
boolean error = false;
for(int i=0; i<channels.length; i++) {
//TraceManager.addDev("Getting from table " + tmltask.getName() + "/" +channels[i]);
channel = tmlm.getChannelByName(getFromTable(tmltask, channels[i], table ) );
if (channel == null) {
if (Conversion.containsStringInList(removedChannels, ((TMLADWriteChannel)tgc).getChannelName(i))) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "A call to " + ((TMLADWriteChannel)tgc).getChannelName(i) + " has been removed because the corresponding channel is not taken into account");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
warnings.add(ce);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
activity.addElement(new TMLJunction("void junction", tgc));
} else {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, ((TMLADWriteChannel)tgc).getChannelName(i) + " is an unknown channel");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.UNKNOWN);
checkingErrors.add(ce);
}
error = true;
}
}
if (!error) {
tmlwritechannel = new TMLWriteChannel("write channel", tgc);
tmlwritechannel.setNbOfSamples(modifyString(((TMLADWriteChannel)tgc).getSamplesValue()));
tmlwritechannel.setEncForm(((TMLADWriteChannel) tgc).getEncForm());
for(int i=0; i<channels.length; i++) {
channel = tmlm.getChannelByName(getFromTable(tmltask, channels[i], table ) );
tmlwritechannel.addChannel(channel);
}
//if (wr.isAttacker()){
//channel = tmlm.getChannelByName(getAttackerChannel(channels[0]));
//tmlwritechannel.addChannel(channel);
//}
//add sec pattern
if (securityPatterns.get(((TMLADWriteChannel)tgc).getSecurityContext()) != null) {
tmlwritechannel.securityPattern =
securityPatterns.get(((TMLADWriteChannel)tgc).getSecurityContext());
String curS = modifyString(((TMLADWriteChannel)tgc).getSamplesValue());
String addS = "" + tmlwritechannel.securityPattern.overhead;
//int cur = Integer.valueOf(modifyString(((TMLADWriteChannel)tgc).getSamplesValue()));
//int add = Integer.valueOf(tmlwritechannel.securityPattern.overhead);
if (!tmlwritechannel.securityPattern.nonce.equals("")){
SecurityPattern nonce = securityPatterns.get(tmlwritechannel.securityPattern.nonce);
if (nonce != null){
addS = "" + nonce.overhead;
//add = Integer.valueOf(nonce.overhead);
}
}
//cur = cur + add;
//tmlwritechannel.setNbOfSamples(Integer.toString(cur));
//tmlwritechannel.setNbOfSamples(att.getName());
tmlwritechannel.setNbOfSamples(curS + " + " + addS);
}
else if (!((TMLADWriteChannel)tgc).getSecurityContext().isEmpty()){
//Throw error for missing security pattern
UICheckingError ce = new UICheckingError(CheckingError.STRUCTURE_ERROR,
"Security Pattern " + ((TMLADWriteChannel)tgc).getSecurityContext()
+ " not found");
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
}
if (tmltask.isAttacker()){
tmlwritechannel.setAttacker(true);
}
activity.addElement(tmlwritechannel);
((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK);
corrTgElement.addCor(tmlwritechannel, tgc);
}
}
}
}
// Interconnection between elements
//TGConnectorTMLAD tgco;
//TGConnectingPoint p1, p2;
//TMLActivityElement ae1, ae2;
//TGComponent /*tgc1, tgc2,*/ tgc3;
//int j, index;
final List<TGConnector> connectors = tadp.getConnectors();
final Set<TGConnector> prunedConectors = new HashSet<TGConnector>();
for ( final TGConnector connector : connectors ) {
if ( !prunedConectors.contains( connector ) ) {
FindNextEnabledConnectingPointVisitor visitor = new FindNextEnabledConnectingPointVisitor( prunedConectors );
connector.getTGConnectingPointP1().acceptBackward( visitor );
final TGConnectingPoint conPoint1 = visitor.getEnabledComponentPoint();
if ( conPoint1 != null ) {
visitor = new FindNextEnabledConnectingPointVisitor( prunedConectors );
connector.getTGConnectingPointP2().acceptForward( visitor );
final TGConnectingPoint conPoint2 = visitor.getEnabledComponentPoint();
if ( conPoint2 != null ) {
final TGComponent compo1 = (TGComponent) conPoint1.getFather();
final TGComponent compo2 = (TGComponent) conPoint2.getFather();
final TMLActivityElement ae1 = activity.findReferenceElement( compo1 );
final TMLActivityElement ae2 = activity.findReferenceElement( compo2 );
//Special case if "for loop" or if "choice"
if ((ae1 !=null) && (ae2 != null)) {
if (ae1 instanceof TMLForLoop) {
final int index = compo1.indexOf(conPoint1) - 1;
if (index == 0) {
ae1.addNext(0, ae2);
} else {
ae1.addNext(ae2);
}
} else if (ae1 instanceof TMLChoice) {
//final int index = compo1.indexOf( conPoint1 ) - 1;
//TraceManager.addDev("Adding next:" + ae2);
ae1.addNext(ae2);
final TMLADChoice choice = (TMLADChoice) compo1;
final TGCOneLineText guard = choice.getGuardForConnectingPoint(conPoint1);
// Check validity of guard.
String tmpG = guard.getValue().trim();
if (tmpG.substring(0, 1).compareTo("[") != 0) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "Badly formatted guard: " + tmpG);
ce.setTDiagramPanel(tadp);
ce.setTGComponent(choice);
checkingErrors.add(ce);
}
if (tmpG.substring(tmpG.length()-1, tmpG.length()).compareTo("]") != 0) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "Badly formatted guard: " + tmpG);
ce.setTDiagramPanel(tadp);
ce.setTGComponent(choice);
checkingErrors.add(ce);
}
((TMLChoice) ae1).addGuard(modifyString(choice.getEffectiveCondition(guard)));
} else if (ae1 instanceof TMLSequence) {
final int index = compo1.indexOf(conPoint1) - 1;
((TMLSequence) ae1).addIndex(index);
ae1.addNext(ae2);
//TraceManager.addDev("Adding " + ae2 + " at index " + index);
} else if (ae1 instanceof TMLRandomSequence) {
final int index = compo1.indexOf(conPoint1) - 1;
((TMLRandomSequence) ae1).addIndex(index);
ae1.addNext(ae2);
} else {
ae1.addNext(ae2);
}
}
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
}
}
}
}
// Check that each "for" has two nexts
// Check that TMLChoice have compatible guards
// Check TML select evts
iterator = list.listIterator();
while(iterator.hasNext()) {
tgc = iterator.next();
// Issue #69: Disabling of AD components
if ( tgc.isEnabled() ) {
if ((tgc instanceof TMLADForLoop) || (tgc instanceof TMLADForStaticLoop)) {
final TMLActivityElement ae1 = activity.findReferenceElement(tgc);
if (ae1 != null) {
if (ae1.getNbNext() != 2) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "Badly formatted for loop: a loop must have an internal behavior, and an exit behavior ");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
}
}
}
else if (tgc instanceof TMLADChoice) {
tmlchoice = (TMLChoice)(activity.findReferenceElement(tgc));
tmlchoice.orderGuards();
int nbNonDeter = tmlchoice.nbOfNonDeterministicGuard();
int nbStocha = tmlchoice.nbOfStochasticGuard();
if ((nbNonDeter > 0) && (nbStocha > 0)) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "Badly formatted choice: it has both non-determinitic and stochastic guards");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
}
int nb = Math.max(nbNonDeter, nbStocha);
if (nb > 0) {
nb = nb + tmlchoice.nbOfElseAndAfterGuards();
if (nb != tmlchoice.getNbGuard()) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, UICheckingError.MESSAGE_CHOICE_BOTH_STOCHASTIC_DETERMINISTIC );//"Badly formatted choice: it has both non-determinitic/ stochastic and regular guards");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
}
}
//if (tmlchoice.nbOfNonDeterministicGuard() > 0) {
/*if (!rndAdded) {
TMLAttribute tmlt = new TMLAttribute("rnd__0", new TMLType(TMLType.NATURAL));
tmlt.initialValue = "";
tmltask.addAttribute(tmlt);
rndAdded = true;
}*/
//}
if (tmlchoice.hasMoreThanOneElse()) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "Choice should have only one [else] guard");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
} else if ( tmlchoice.getElseGuard() > -1 ) {
final int index = tmlchoice.getElseGuard();
if (index == 0) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "Choice should have a regular guard");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
}
}
if (tmlchoice.hasMoreThanOneAfter()) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "Choice should have only one [after] guard");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
}
}
else if (tgc instanceof TMLADSelectEvt) {
tmlselectevt = (TMLSelectEvt)(activity.findReferenceElement(tgc));
if (!tmlselectevt.isARealSelectEvt()) {
UICheckingError ce = new UICheckingError(CheckingError.BEHAVIOR_ERROR, "'Select events' should be followed by only event receiving operators");
ce.setTDiagramPanel(tadp);
ce.setTGComponent(tgc);
checkingErrors.add(ce);
}
}
}
}
// Sorting nexts elements of Sequence
for( int j=0; j<activity.nElements(); j++) {
final TMLActivityElement ae1 = activity.get(j);
if (ae1 instanceof TMLSequence) {
((TMLSequence)ae1).sortNexts();
}
else if (ae1 instanceof TMLRandomSequence) {
((TMLRandomSequence)ae1).sortNexts();
}
}
//TraceManager.addDev("Activity:" + tmltask.getActivityDiagram().toXML() );
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
}
private String modifyActionString(String _input) {
int index = _input.indexOf("++");
boolean b1, b2;
String tmp;
if(index > -1) {
tmp = _input.substring(0, index).trim();
b1 = (tmp.substring(0,1)).matches("[a-zA-Z]");
b2 = tmp.matches("\\w*");
if (b1 && b2) {
return tmp + " = " + tmp + " + 1";
}
}
index = _input.indexOf("--");
if(index > -1) {
tmp = _input.substring(0, index).trim();
b1 = (tmp.substring(0,1)).matches("[a-zA-Z]");
b2 = tmp.matches("\\w*");
if (b1 && b2) {
return tmp + " = " + tmp + " - 1";
}
}
return modifyString(_input);
}
private String modifyString(String _input) {
return Conversion.replaceAllChar(_input, '.', "__");
}
private String getFromTable( final TMLTask task,
final String s,
final Map<String, String> table ) {
//TraceManager.addDev("TABLE GET: Getting from task=" + task.getName() + " element=" + s);
if (table == null) {
return s;
}
String ret = table.get(task.getName() + "/" + s);
//TraceManager.addDev("Returning=" + ret);
if (ret == null) {
return s;
}
return ret;
}
}