Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 4533aceb8fc2dbc6f57368358db95d687cd1ea9d (plain) (blame)
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
94
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
294
295
296
297
298
299
300
301
302
303
304
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
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
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
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
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
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
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
940
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
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
package org.eclipse.etrice.generator.doc.gen;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.io.File;
import java.util.List;
import org.eclipse.emf.common.util.EList;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.ChoicePoint;
import org.eclipse.etrice.core.room.DataClass;
import org.eclipse.etrice.core.room.DataType;
import org.eclipse.etrice.core.room.Documentation;
import org.eclipse.etrice.core.room.Message;
import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.RefableType;
import org.eclipse.etrice.core.room.RoomModel;
import org.eclipse.etrice.core.room.StandardOperation;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.core.room.SubSystemClass;
import org.eclipse.etrice.core.room.VarDecl;
import org.eclipse.etrice.generator.base.ILogger;
import org.eclipse.etrice.generator.base.IRoomGenerator;
import org.eclipse.etrice.generator.etricegen.Root;
import org.eclipse.etrice.generator.extensions.RoomExtensions;
import org.eclipse.xtext.generator.JavaIoFileSystemAccess;
import org.eclipse.xtext.xbase.lib.BooleanExtensions;
import org.eclipse.xtext.xbase.lib.ComparableExtensions;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.StringExtensions;
import org.eclipse.xtext.xtend2.lib.StringConcatenation;

@SuppressWarnings("all")
@Singleton
public class DocGen implements IRoomGenerator {
  @Inject
  private JavaIoFileSystemAccess fileAccess;
  
  @Inject
  private RoomExtensions roomExt;
  
  @Inject
  private ILogger logger;
  
  public void doGenerate(final Root root) {
    EList<RoomModel> _models = root.getModels();
    for (final RoomModel model : _models) {
      {
        String _docGenerationTargetPath = this.roomExt.getDocGenerationTargetPath(model);
        String path = _docGenerationTargetPath;
        String _name = model.getName();
        String _operator_plus = StringExtensions.operator_plus(_name, ".tex");
        String file = _operator_plus;
        String _operator_plus_1 = StringExtensions.operator_plus("generating LaTeX documentation: \'", file);
        String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, "\' in \'");
        String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, path);
        String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, "\'");
        this.logger.logInfo(_operator_plus_4);
        this.fileAccess.setOutputPath(path);
        StringConcatenation _generateModelDoc = this.generateModelDoc(root, model);
        this.fileAccess.generateFile(file, _generateModelDoc);
      }
    }
  }
  
  public StringConcatenation generateModelDoc(final Root root, final RoomModel model) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("\\documentclass[titlepage]{article}");
    _builder.newLine();
    _builder.append("\\usepackage{graphicx}");
    _builder.newLine();
    _builder.append("\\usepackage[a4paper,text={160mm,255mm},centering,headsep=5mm,footskip=10mm]{geometry}");
    _builder.newLine();
    _builder.append("\\usepackage{nonfloat}");
    _builder.newLine();
    _builder.append("\\parindent 0pt");
    _builder.newLine();
    _builder.append("\\makeatletter");
    _builder.newLine();
    _builder.append("\\newcommand\\level[1]{%");
    _builder.newLine();
    _builder.append("   ");
    _builder.append("\\ifcase#1\\relax\\expandafter\\chapter\\or");
    _builder.newLine();
    _builder.append("     ");
    _builder.append("\\expandafter\\section\\or");
    _builder.newLine();
    _builder.append("     ");
    _builder.append("\\expandafter\\subsection\\or");
    _builder.newLine();
    _builder.append("     ");
    _builder.append("\\expandafter\\subsubsection\\else");
    _builder.newLine();
    _builder.append("     ");
    _builder.append("\\def\\next{\\@level{#1}}\\expandafter\\next");
    _builder.newLine();
    _builder.append("   ");
    _builder.append("\\fi}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\\newcommand{\\@level}[1]{%");
    _builder.newLine();
    _builder.append("\\@startsection{level#1}");
    _builder.newLine();
    _builder.append("     ");
    _builder.append("{#1}");
    _builder.newLine();
    _builder.append("     ");
    _builder.append("{\\z@}%");
    _builder.newLine();
    _builder.append("     ");
    _builder.append("{-3.25ex\\@plus -1ex \\@minus -.2ex}%");
    _builder.newLine();
    _builder.append("     ");
    _builder.append("{1.5ex \\@plus .2ex}%");
    _builder.newLine();
    _builder.append("     ");
    _builder.append("{\\normalfont\\normalsize\\bfseries}}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\\newdimen\\@leveldim");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("\\newdimen\\@dotsdim");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("{\\normalfont\\normalsize");
    _builder.newLine();
    _builder.append("  ");
    _builder.append("\\sbox\\z@{0}\\global\\@leveldim=\\wd\\z@");
    _builder.newLine();
    _builder.append("  ");
    _builder.append("\\sbox\\z@{.}\\global\\@dotsdim=\\wd\\z@");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("}  ");
    _builder.newLine();
    _builder.append("\\newcounter{level4}[subsubsection]");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("\\@namedef{thelevel4}{\\thesubsubsection.\\arabic{level4}}");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("\\@namedef{level4mark}#1{}");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("\\def\\l@section{\\@dottedtocline{1}{0pt}{\\dimexpr\\@leveldim*4+\\@dotsdim*1+6pt\\relax}}");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("\\def\\l@subsection{\\@dottedtocline{2}{0pt}{\\dimexpr\\@leveldim*5+\\@dotsdim*2+6pt\\relax}}");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("\\def\\l@subsubsection{\\@dottedtocline{3}{0pt}{\\dimexpr\\@leveldim*6+\\@dotsdim*3+6pt\\relax}}");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("\\@namedef{l@level4}{\\@dottedtocline{4}{0pt}{\\dimexpr\\@leveldim*7+\\@dotsdim*4+6pt\\relax}}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\\count@=4");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("\\def\\@ncp#1{\\number\\numexpr\\count@+#1\\relax}");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("\\loop\\ifnum\\count@<100");
    _builder.newLine();
    _builder.append("   ");
    _builder.append("\\begingroup\\edef\\x{\\endgroup");
    _builder.newLine();
    _builder.append("     ");
    _builder.append("\\noexpand\\newcounter{level\\@ncp{1}}[level\\number\\count@]");
    _builder.newLine();
    _builder.append("     ");
    _builder.append("\\noexpand\\@namedef{thelevel\\@ncp{1}}{%");
    _builder.newLine();
    _builder.append("       ");
    _builder.append("\\noexpand\\@nameuse{thelevel\\@ncp{0}}.\\noexpand\\arabic{level\\@ncp{0}}}");
    _builder.newLine();
    _builder.append("     ");
    _builder.append("\\noexpand\\@namedef{level\\@ncp{1}mark}####1{}%");
    _builder.newLine();
    _builder.append("     ");
    _builder.append("\\noexpand\\@namedef{l@level\\@ncp{1}}%");
    _builder.newLine();
    _builder.append("       ");
    _builder.append("{\\noexpand\\@dottedtocline{\\@ncp{1}}{0pt}{\\the\\dimexpr\\@leveldim*\\@ncp{5}+\\@dotsdim*\\@ncp{0}\\relax}}}%");
    _builder.newLine();
    _builder.append("   ");
    _builder.append("\\x");
    _builder.newLine();
    _builder.append("   ");
    _builder.append("\\advance\\count@\\@ne");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("\\repeat");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("\\makeatother");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("\\setcounter{secnumdepth}{100}");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("\\setcounter{tocdepth}{100}");
    _builder.newLine();
    _builder.newLine();
    _builder.newLine();
    _builder.append("\\title{");
    String _name = model.getName();
    _builder.append(_name, "");
    _builder.append(" Modeldocumentation}");
    _builder.newLineIfNotEmpty();
    _builder.append("\\date{\\today}");
    _builder.newLine();
    _builder.append("\\author{generated by eTrice}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\\begin{document}");
    _builder.newLine();
    _builder.append("\\pagestyle{plain}");
    _builder.newLine();
    _builder.append("\\maketitle");
    _builder.newLine();
    _builder.append("\\tableofcontents");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\\newpage");
    _builder.newLine();
    _builder.append("\\listoffigures");
    _builder.newLine();
    _builder.append("\\newpage");
    _builder.newLine();
    _builder.append("\\section{Model Description}");
    _builder.newLine();
    Documentation _docu = model.getDocu();
    StringConcatenation _generateDocText = this.generateDocText(_docu);
    _builder.append(_generateDocText, "");
    _builder.newLineIfNotEmpty();
    _builder.append("\\section{Subsystem Description}");
    _builder.newLine();
    StringConcatenation _generateAllSubSysClassDocs = this.generateAllSubSysClassDocs(root, model);
    _builder.append(_generateAllSubSysClassDocs, "");
    _builder.newLineIfNotEmpty();
    _builder.append("\\section{Protocol Class Description}");
    _builder.newLine();
    StringConcatenation _generateAllProtocolClassDocs = this.generateAllProtocolClassDocs(root, model);
    _builder.append(_generateAllProtocolClassDocs, "");
    _builder.newLineIfNotEmpty();
    _builder.append("\\section{Data Class Description}");
    _builder.newLine();
    StringConcatenation _generateAllDataClassDocs = this.generateAllDataClassDocs(root, model);
    _builder.append(_generateAllDataClassDocs, "");
    _builder.newLineIfNotEmpty();
    _builder.append("\\section{Actor Class Description}");
    _builder.newLine();
    StringConcatenation _generateAllActorClassDocs = this.generateAllActorClassDocs(root, model);
    _builder.append(_generateAllActorClassDocs, "");
    _builder.newLineIfNotEmpty();
    _builder.append("\\end{document}");
    _builder.newLine();
    return _builder;
  }
  
  public StringConcatenation generateAllSubSysClassDocs(final Root root, final RoomModel model) {
    StringConcatenation _builder = new StringConcatenation();
    {
      EList<SubSystemClass> _subSystemClasses = model.getSubSystemClasses();
      for(final SubSystemClass ssc : _subSystemClasses) {
        StringConcatenation _generateSubSysClassDoc = this.generateSubSysClassDoc(root, model, ssc);
        _builder.append(_generateSubSysClassDoc, "");
        _builder.newLineIfNotEmpty();
      }
    }
    return _builder;
  }
  
  public StringConcatenation generateSubSysClassDoc(final Root root, final RoomModel model, final SubSystemClass ssc) {
    StringConcatenation _xblockexpression = null;
    {
      String _docGenerationTargetPath = this.roomExt.getDocGenerationTargetPath(model);
      String _operator_plus = StringExtensions.operator_plus(_docGenerationTargetPath, "images\\");
      String _name = ssc.getName();
      String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, _name);
      String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, "_structure.jpg");
      String filename = _operator_plus_2;
      String _replaceAll = filename.replaceAll("\\\\", "/");
      filename = _replaceAll;
      String _replaceAll_1 = filename.replaceAll("/", "//");
      String latexFilename = _replaceAll_1;
      String _docGenerationTargetPath_1 = this.roomExt.getDocGenerationTargetPath(model);
      String _operator_plus_3 = StringExtensions.operator_plus(_docGenerationTargetPath_1, "images\\");
      String _name_1 = ssc.getName();
      String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, _name_1);
      String _operator_plus_5 = StringExtensions.operator_plus(_operator_plus_4, "_instanceTree.jpg");
      String filenamei = _operator_plus_5;
      String _replaceAll_2 = filenamei.replaceAll("\\\\", "/");
      filenamei = _replaceAll_2;
      String _replaceAll_3 = filenamei.replaceAll("/", "//");
      String latexFilenamei = _replaceAll_3;
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("\\level{2}{");
      String _name_2 = ssc.getName();
      _builder.append(_name_2, "");
      _builder.append("}");
      _builder.newLineIfNotEmpty();
      Documentation _docu = ssc.getDocu();
      StringConcatenation _generateDocText = this.generateDocText(_docu);
      _builder.append(_generateDocText, "");
      _builder.newLineIfNotEmpty();
      _builder.append("\\level{3}{Structure}");
      _builder.newLine();
      {
        String _fileExists = this.fileExists(filename);
        boolean _equals = _fileExists.equals("true");
        if (_equals) {
          String _name_3 = ssc.getName();
          String _operator_plus_6 = StringExtensions.operator_plus(_name_3, " Structure");
          StringConcatenation _includeGraphics = this.includeGraphics(latexFilename, "0.4", _operator_plus_6);
          _builder.append(_includeGraphics, "");
          _builder.newLineIfNotEmpty();
        }
      }
      _builder.append("\\level{3}{Instance Tree}");
      _builder.newLine();
      {
        String _fileExists_1 = this.fileExists(filename);
        boolean _equals_1 = _fileExists_1.equals("true");
        if (_equals_1) {
          String _name_4 = ssc.getName();
          String _operator_plus_7 = StringExtensions.operator_plus(_name_4, " Instance Tree");
          StringConcatenation _includeGraphics_1 = this.includeGraphics(latexFilenamei, "0.5", _operator_plus_7);
          _builder.append(_includeGraphics_1, "");
          _builder.newLineIfNotEmpty();
        }
      }
      _xblockexpression = (_builder);
    }
    return _xblockexpression;
  }
  
  public StringConcatenation generateAllDataClassDocs(final Root root, final RoomModel model) {
    StringConcatenation _builder = new StringConcatenation();
    {
      EList<DataClass> _dataClasses = model.getDataClasses();
      for(final DataClass dc : _dataClasses) {
        StringConcatenation _generateDataClassDoc = this.generateDataClassDoc(root, dc);
        _builder.append(_generateDataClassDoc, "");
        _builder.newLineIfNotEmpty();
      }
    }
    return _builder;
  }
  
  public StringConcatenation generateDataClassDoc(final Root root, final DataClass dc) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("\\level{2} {");
    String _name = dc.getName();
    _builder.append(_name, "");
    _builder.append("}");
    _builder.newLineIfNotEmpty();
    Documentation _docu = dc.getDocu();
    StringConcatenation _generateDocText = this.generateDocText(_docu);
    _builder.append(_generateDocText, "");
    _builder.newLineIfNotEmpty();
    _builder.append("\\level{3}{Attributes}");
    _builder.newLine();
    EList<Attribute> _attributes = dc.getAttributes();
    StringConcatenation _generateAttributesDoc = this.generateAttributesDoc(_attributes);
    _builder.append(_generateAttributesDoc, "");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("\\level{3}{Operations}");
    _builder.newLine();
    EList<StandardOperation> _operations = dc.getOperations();
    StringConcatenation _generateOperationsDoc = this.generateOperationsDoc(_operations);
    _builder.append(_generateOperationsDoc, "");
    _builder.newLineIfNotEmpty();
    return _builder;
  }
  
  public StringConcatenation generateAllProtocolClassDocs(final Root root, final RoomModel model) {
    StringConcatenation _builder = new StringConcatenation();
    {
      EList<ProtocolClass> _protocolClasses = model.getProtocolClasses();
      for(final ProtocolClass pc : _protocolClasses) {
        StringConcatenation _generateProtocolClassDoc = this.generateProtocolClassDoc(root, pc);
        _builder.append(_generateProtocolClassDoc, "");
        _builder.newLineIfNotEmpty();
      }
    }
    return _builder;
  }
  
  public StringConcatenation generateProtocolClassDoc(final Root root, final ProtocolClass pc) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("\t");
    _builder.append("\\level{2} {");
    String _name = pc.getName();
    _builder.append(_name, "	");
    _builder.append("}");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    Documentation _docu = pc.getDocu();
    StringConcatenation _generateDocText = this.generateDocText(_docu);
    _builder.append(_generateDocText, "	");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("\\level{3}{Incoming Messages}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("\\begin{tabular}[ht]{|l|l|l|}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("\\hline");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("Message & Data & Description\\\\");
    _builder.newLine();
    {
      List<Message> _allIncomingMessages = this.roomExt.getAllIncomingMessages(pc);
      for(final Message ims : _allIncomingMessages) {
        _builder.append("\t");
        _builder.append("\\hline");
        _builder.newLine();
        _builder.append("\t");
        String _name_1 = ims.getName();
        _builder.append(_name_1, "	");
        _builder.append(" & ");
        {
          VarDecl _data = ims.getData();
          boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_data, null);
          if (_operator_notEquals) {
            _builder.append(" ");
            VarDecl _data_1 = ims.getData();
            String _name_2 = _data_1.getName();
            _builder.append(_name_2, "	");
            _builder.append(" ");
          }
        }
        _builder.append(" & ");
        Documentation _docu_1 = ims.getDocu();
        StringConcatenation _generateDocText_1 = this.generateDocText(_docu_1);
        _builder.append(_generateDocText_1, "	");
        _builder.append("\\\\");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.append("\t");
    _builder.append("\\hline");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("\\end{tabular}");
    _builder.newLine();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("\\level{3}{Outgoing Messages}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("\\begin{tabular}[ht]{|l|l|l|}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("\\hline");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("Message & Data & Description\\\\");
    _builder.newLine();
    {
      List<Message> _allOutgoingMessages = this.roomExt.getAllOutgoingMessages(pc);
      for(final Message oms : _allOutgoingMessages) {
        _builder.append("\t");
        _builder.append("\\hline");
        _builder.newLine();
        _builder.append("\t");
        String _name_3 = oms.getName();
        _builder.append(_name_3, "	");
        _builder.append(" & ");
        {
          VarDecl _data_2 = oms.getData();
          boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(_data_2, null);
          if (_operator_notEquals_1) {
            _builder.append(" ");
            VarDecl _data_3 = oms.getData();
            String _name_4 = _data_3.getName();
            _builder.append(_name_4, "	");
            _builder.append(" ");
          }
        }
        _builder.append(" & ");
        Documentation _docu_2 = oms.getDocu();
        StringConcatenation _generateDocText_2 = this.generateDocText(_docu_2);
        _builder.append(_generateDocText_2, "	");
        _builder.append("\\\\");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.append("\t");
    _builder.append("\\hline");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("\\end{tabular}\t\t\t");
    _builder.newLine();
    return _builder;
  }
  
  public StringConcatenation generateAllActorClassDocs(final Root root, final RoomModel model) {
    StringConcatenation _builder = new StringConcatenation();
    {
      EList<ActorClass> _actorClasses = model.getActorClasses();
      for(final ActorClass ac : _actorClasses) {
        StringConcatenation _generateActorClassDoc = this.generateActorClassDoc(root, model, ac);
        _builder.append(_generateActorClassDoc, "");
        _builder.newLineIfNotEmpty();
      }
    }
    return _builder;
  }
  
  public StringConcatenation generateActorClassDoc(final Root root, final RoomModel model, final ActorClass ac) {
    StringConcatenation _xblockexpression = null;
    {
      String _docGenerationTargetPath = this.roomExt.getDocGenerationTargetPath(model);
      String _operator_plus = StringExtensions.operator_plus(_docGenerationTargetPath, "images\\");
      String _name = ac.getName();
      String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, _name);
      String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, "_structure.jpg");
      String filename = _operator_plus_2;
      String _replaceAll = filename.replaceAll("\\\\", "/");
      filename = _replaceAll;
      String _replaceAll_1 = filename.replaceAll("/", "//");
      String latexFilename = _replaceAll_1;
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("\\level{2}{");
      String _name_1 = ac.getName();
      _builder.append(_name_1, "");
      _builder.append("}");
      _builder.newLineIfNotEmpty();
      Documentation _docu = ac.getDocu();
      StringConcatenation _generateDocText = this.generateDocText(_docu);
      _builder.append(_generateDocText, "");
      _builder.newLineIfNotEmpty();
      _builder.append("\\level{3}{Structure}");
      _builder.newLine();
      _builder.newLine();
      {
        String _fileExists = this.fileExists(filename);
        boolean _equals = _fileExists.equals("true");
        if (_equals) {
          String _name_2 = ac.getName();
          String _operator_plus_3 = StringExtensions.operator_plus(_name_2, " Structure");
          StringConcatenation _includeGraphics = this.includeGraphics(latexFilename, "0.4", _operator_plus_3);
          _builder.append(_includeGraphics, "");
          _builder.newLineIfNotEmpty();
        }
      }
      _builder.newLine();
      _builder.append("\\level{3}{Attributes}");
      _builder.newLine();
      EList<Attribute> _attributes = ac.getAttributes();
      StringConcatenation _generateAttributesDoc = this.generateAttributesDoc(_attributes);
      _builder.append(_generateAttributesDoc, "");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("\\level{3}{Operations}");
      _builder.newLine();
      EList<StandardOperation> _operations = ac.getOperations();
      StringConcatenation _generateOperationsDoc = this.generateOperationsDoc(_operations);
      _builder.append(_generateOperationsDoc, "");
      _builder.newLineIfNotEmpty();
      {
        boolean _hasNonEmptyStateMachine = this.roomExt.hasNonEmptyStateMachine(ac);
        if (_hasNonEmptyStateMachine) {
          _builder.append("\\level{3}{Statemachine}");
          _builder.newLine();
          StringConcatenation _generateFsmDoc = this.generateFsmDoc(model, ac);
          _builder.append(_generateFsmDoc, "");
          _builder.newLineIfNotEmpty();
        }
      }
      _xblockexpression = (_builder);
    }
    return _xblockexpression;
  }
  
  public StringConcatenation generateFsmDoc(final RoomModel model, final ActorClass ac) {
    StringConcatenation _xblockexpression = null;
    {
      String _docGenerationTargetPath = this.roomExt.getDocGenerationTargetPath(model);
      String _operator_plus = StringExtensions.operator_plus(_docGenerationTargetPath, "images\\");
      String _name = ac.getName();
      String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, _name);
      String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, "_behavior.jpg");
      String filename = _operator_plus_2;
      String _replaceAll = filename.replaceAll("\\\\", "/");
      filename = _replaceAll;
      String _replaceAll_1 = filename.replaceAll("/", "//");
      String latexFilename = _replaceAll_1;
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("\\level{4}{Top Level}");
      _builder.newLine();
      {
        String _fileExists = this.fileExists(filename);
        boolean _equals = _fileExists.equals("true");
        if (_equals) {
          String _name_1 = ac.getName();
          String _operator_plus_3 = StringExtensions.operator_plus(_name_1, " Top State");
          StringConcatenation _includeGraphics = this.includeGraphics(latexFilename, "0.4", _operator_plus_3);
          _builder.append(_includeGraphics, "");
          _builder.newLineIfNotEmpty();
        }
      }
      _builder.newLine();
      _builder.append("\\begin{par}");
      _builder.newLine();
      {
        StateGraph _stateMachine = ac.getStateMachine();
        EList<State> _states = _stateMachine.getStates();
        for(final State s : _states) {
          {
            Documentation _docu = s.getDocu();
            boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_docu, null);
            if (_operator_notEquals) {
              _builder.append("\\textbf{State description} \\textit{");
              String _statePathName = this.roomExt.getStatePathName(s);
              String _replaceAll_2 = _statePathName.replaceAll("_", "\\\\_");
              _builder.append(_replaceAll_2, "");
              _builder.append("}:");
              _builder.newLineIfNotEmpty();
              _builder.append("\\newline");
              _builder.newLine();
              Documentation _docu_1 = s.getDocu();
              StringConcatenation _generateDocText = this.generateDocText(_docu_1);
              _builder.append(_generateDocText, "");
              _builder.newLineIfNotEmpty();
              _builder.append("\\newline\\newline");
              _builder.newLine();
            }
          }
        }
      }
      _builder.newLine();
      {
        StateGraph _stateMachine_1 = ac.getStateMachine();
        EList<ChoicePoint> _chPoints = _stateMachine_1.getChPoints();
        for(final ChoicePoint c : _chPoints) {
          {
            Documentation _docu_2 = c.getDocu();
            boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(_docu_2, null);
            if (_operator_notEquals_1) {
              _builder.append("\\textbf{Choicepoint description} \\textit{");
              String _name_2 = c.getName();
              _builder.append(_name_2, "");
              _builder.append("}:");
              _builder.newLineIfNotEmpty();
              _builder.append("\\newline");
              _builder.newLine();
              Documentation _docu_3 = c.getDocu();
              StringConcatenation _generateDocText_1 = this.generateDocText(_docu_3);
              _builder.append(_generateDocText_1, "");
              _builder.newLineIfNotEmpty();
              _builder.append("\\newline\\newline");
              _builder.newLine();
            }
          }
        }
      }
      _builder.append("\\end{par}");
      _builder.newLine();
      _builder.newLine();
      {
        StateGraph _stateMachine_2 = ac.getStateMachine();
        EList<State> _states_1 = _stateMachine_2.getStates();
        for(final State s_1 : _states_1) {
          {
            boolean _isLeaf = this.roomExt.isLeaf(s_1);
            boolean _operator_not = BooleanExtensions.operator_not(_isLeaf);
            if (_operator_not) {
              StringConcatenation _generateStateDoc = this.generateStateDoc(model, ac, s_1);
              _builder.append(_generateStateDoc, "");
              _builder.newLineIfNotEmpty();
            }
          }
        }
      }
      _xblockexpression = (_builder);
    }
    return _xblockexpression;
  }
  
  public StringConcatenation generateStateDoc(final RoomModel model, final ActorClass ac, final State state) {
    StringConcatenation _xblockexpression = null;
    {
      String _docGenerationTargetPath = this.roomExt.getDocGenerationTargetPath(model);
      String _operator_plus = StringExtensions.operator_plus(_docGenerationTargetPath, "images\\");
      String _name = ac.getName();
      String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, _name);
      String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, "_");
      String _statePathName = this.roomExt.getStatePathName(state);
      String _operator_plus_3 = StringExtensions.operator_plus(_operator_plus_2, _statePathName);
      String _operator_plus_4 = StringExtensions.operator_plus(_operator_plus_3, "_behavior.jpg");
      String filename = _operator_plus_4;
      String _replaceAll = filename.replaceAll("\\\\", "/");
      filename = _replaceAll;
      String _replaceAll_1 = filename.replaceAll("/", "//");
      String latexFilename = _replaceAll_1;
      String _operator_plus_5 = StringExtensions.operator_plus("Gen Filename: ", filename);
      this.logger.logInfo(_operator_plus_5);
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("\\level{4}{Subgraph ");
      String _statePathName_1 = this.roomExt.getStatePathName(state);
      String _replaceAll_2 = _statePathName_1.replaceAll("_", "\\\\_");
      _builder.append(_replaceAll_2, "");
      _builder.append("}");
      _builder.newLineIfNotEmpty();
      {
        String _fileExists = this.fileExists(filename);
        boolean _equals = _fileExists.equals("true");
        if (_equals) {
          String _name_1 = ac.getName();
          String _operator_plus_6 = StringExtensions.operator_plus(_name_1, "_");
          String _statePathName_2 = this.roomExt.getStatePathName(state);
          String _operator_plus_7 = StringExtensions.operator_plus(_operator_plus_6, _statePathName_2);
          StringConcatenation _includeGraphics = this.includeGraphics(latexFilename, "0.4", _operator_plus_7);
          _builder.append(_includeGraphics, "");
          _builder.newLineIfNotEmpty();
        }
      }
      _builder.newLine();
      _builder.append("\\begin{par}");
      _builder.newLine();
      {
        StateGraph _subgraph = state.getSubgraph();
        EList<State> _states = _subgraph.getStates();
        for(final State s : _states) {
          {
            Documentation _docu = s.getDocu();
            boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_docu, null);
            if (_operator_notEquals) {
              _builder.append("\\textbf{State description} \\textit{");
              String _statePathName_3 = this.roomExt.getStatePathName(s);
              String _replaceAll_3 = _statePathName_3.replaceAll("_", "\\\\_");
              _builder.append(_replaceAll_3, "");
              _builder.append("}:");
              _builder.newLineIfNotEmpty();
              _builder.append("\\newline");
              _builder.newLine();
              Documentation _docu_1 = s.getDocu();
              StringConcatenation _generateDocText = this.generateDocText(_docu_1);
              _builder.append(_generateDocText, "");
              _builder.newLineIfNotEmpty();
              _builder.append("\\newline\\newline");
              _builder.newLine();
            }
          }
        }
      }
      _builder.newLine();
      {
        StateGraph _subgraph_1 = state.getSubgraph();
        EList<ChoicePoint> _chPoints = _subgraph_1.getChPoints();
        for(final ChoicePoint c : _chPoints) {
          {
            Documentation _docu_2 = c.getDocu();
            boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(_docu_2, null);
            if (_operator_notEquals_1) {
              _builder.append("\\textbf{Choicepoint description} \\textit{");
              String _name_2 = c.getName();
              _builder.append(_name_2, "");
              _builder.append("}:");
              _builder.newLineIfNotEmpty();
              _builder.append("\\newline");
              _builder.newLine();
              Documentation _docu_3 = c.getDocu();
              StringConcatenation _generateDocText_1 = this.generateDocText(_docu_3);
              _builder.append(_generateDocText_1, "");
              _builder.newLineIfNotEmpty();
              _builder.append("\\newline\\newline");
              _builder.newLine();
            }
          }
        }
      }
      _builder.append("\\end{par}");
      _builder.newLine();
      _builder.append("\t");
      _builder.newLine();
      {
        StateGraph _subgraph_2 = state.getSubgraph();
        EList<State> _states_1 = _subgraph_2.getStates();
        for(final State s_1 : _states_1) {
          {
            boolean _isLeaf = this.roomExt.isLeaf(s_1);
            boolean _operator_not = BooleanExtensions.operator_not(_isLeaf);
            if (_operator_not) {
              StringConcatenation _generateStateDoc = this.generateStateDoc(model, ac, s_1);
              _builder.append(_generateStateDoc, "");
              _builder.newLineIfNotEmpty();
            }
          }
        }
      }
      _xblockexpression = (_builder);
    }
    return _xblockexpression;
  }
  
  public StringConcatenation generateAttributesDoc(final List<Attribute> attributes) {
    StringConcatenation _builder = new StringConcatenation();
    {
      boolean _isEmpty = attributes.isEmpty();
      boolean _operator_not = BooleanExtensions.operator_not(_isEmpty);
      if (_operator_not) {
        _builder.append("\\begin{tabular}[ht]{|l|l|l|}");
        _builder.newLine();
        _builder.append("\\hline");
        _builder.newLine();
        _builder.append("Name & Type & Description\\\\");
        _builder.newLine();
        {
          for(final Attribute at : attributes) {
            _builder.append("\\hline");
            _builder.newLine();
            String _name = at.getName();
            _builder.append(_name, "");
            _builder.append(" & ");
            RefableType _refType = at.getRefType();
            DataType _type = _refType.getType();
            String _name_1 = _type.getName();
            _builder.append(_name_1, "");
            _builder.append(" & ");
            Documentation _docu = at.getDocu();
            StringConcatenation _generateDocText = this.generateDocText(_docu);
            _builder.append(_generateDocText, "");
            _builder.append("\\\\");
            _builder.newLineIfNotEmpty();
          }
        }
        _builder.append("\\hline");
        _builder.newLine();
        _builder.append("\\end{tabular}");
        _builder.newLine();
      }
    }
    return _builder;
  }
  
  public StringConcatenation generateOperationsDoc(final List<StandardOperation> operations) {
    StringConcatenation _builder = new StringConcatenation();
    {
      for(final StandardOperation op : operations) {
        _builder.append("\\begin{tabular}[ht]{|l|l|}");
        _builder.newLine();
        _builder.append("\\hline\t\t");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("Name: & ");
        String _name = op.getName();
        _builder.append(_name, "	");
        _builder.append("\\\\");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("\\hline");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("ReturnType: &  ");
        {
          RefableType _returntype = op.getReturntype();
          boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_returntype, null);
          if (_operator_notEquals) {
            RefableType _returntype_1 = op.getReturntype();
            DataType _type = _returntype_1.getType();
            String _name_1 = _type.getName();
            _builder.append(_name_1, "	");
          } else {
            _builder.append("void");
          }
        }
        _builder.append("\\\\");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("\\hline");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("Arguments: & ");
        {
          EList<VarDecl> _arguments = op.getArguments();
          boolean hasAnyElements = false;
          for(final VarDecl pa : _arguments) {
            if (!hasAnyElements) {
              hasAnyElements = true;
            } else {
              _builder.appendImmediate(", ", "	");
            }
            String _name_2 = pa.getName();
            _builder.append(_name_2, "	");
            _builder.append(":");
            RefableType _refType = pa.getRefType();
            DataType _type_1 = _refType.getType();
            String _name_3 = _type_1.getName();
            _builder.append(_name_3, "	");
          }
        }
        _builder.append("\\\\");
        _builder.newLineIfNotEmpty();
        {
          Documentation _docu = op.getDocu();
          boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(_docu, null);
          if (_operator_notEquals_1) {
            _builder.append("\t");
            _builder.append("\\hline");
            _builder.newLine();
            {
              Documentation _docu_1 = op.getDocu();
              String _string = _docu_1.toString();
              int _length = _string.length();
              boolean _operator_greaterThan = ComparableExtensions.<Integer>operator_greaterThan(((Integer)_length), ((Integer)85));
              if (_operator_greaterThan) {
                _builder.append("\t");
                _builder.append("\\multicolumn{2} {|p{13cm}|} {");
                Documentation _docu_2 = op.getDocu();
                StringConcatenation _generateDocText = this.generateDocText(_docu_2);
                _builder.append(_generateDocText, "	");
                _builder.append("}\\\\");
                _builder.newLineIfNotEmpty();
              } else {
                _builder.append("\t");
                _builder.append("\\multicolumn{2} {|l|} {");
                Documentation _docu_3 = op.getDocu();
                StringConcatenation _generateDocText_1 = this.generateDocText(_docu_3);
                _builder.append(_generateDocText_1, "	");
                _builder.append("}\\\\");
                _builder.newLineIfNotEmpty();
              }
            }
          }
        }
        _builder.append("\t");
        _builder.append("\\hline");
        _builder.newLine();
        _builder.append("\\end{tabular}");
        _builder.newLine();
        _builder.append("\\newline\\newline\\newline");
        _builder.newLine();
      }
    }
    return _builder;
  }
  
  public StringConcatenation generateDocText(final Documentation doc) {
    StringConcatenation _builder = new StringConcatenation();
    {
      boolean _operator_notEquals = ObjectExtensions.operator_notEquals(doc, null);
      if (_operator_notEquals) {
        EList<String> _text = doc.getText();
        String _join = IterableExtensions.join(_text);
        _builder.append(_join, "");
        _builder.newLineIfNotEmpty();
      }
    }
    return _builder;
  }
  
  public String fileExists(final String f) {
      File _file = new File(f);
      final File file = _file;
      boolean _exists = file.exists();
      final boolean exist = _exists;
      boolean _operator_equals = ObjectExtensions.operator_equals(((Boolean)exist), ((Boolean)true));
      if (_operator_equals) {
        {
          String _operator_plus = StringExtensions.operator_plus("File found ! ", f);
          this.logger.logInfo(_operator_plus);
          return "true";
        }
      } else {
        {
          String _operator_plus_1 = StringExtensions.operator_plus("File not found ! ", f);
          this.logger.logInfo(_operator_plus_1);
          return "false";
        }
      }
  }
  
  public StringConcatenation includeGraphics(final String filename, final String scale, final String caption) {
    StringConcatenation _xblockexpression = null;
    {
      String _replaceAll = caption.replaceAll("_", "\\\\_");
      String latexCaption = _replaceAll;
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("\\begin{center}");
      _builder.newLine();
      _builder.append("\\includegraphics[scale=");
      _builder.append(scale, "");
      _builder.append("]{");
      _builder.append(filename, "");
      _builder.append("}");
      _builder.newLineIfNotEmpty();
      _builder.append("\\figcaption{");
      _builder.append(latexCaption, "");
      _builder.append("}");
      _builder.newLineIfNotEmpty();
      _builder.append("\\end{center}");
      _builder.newLine();
      _xblockexpression = (_builder);
    }
    return _xblockexpression;
  }
  
  public String irgendwas(final Root root, final ActorClass ac) {
    String _name = ac.getName();
    String _operator_plus = StringExtensions.operator_plus(_name, ".bla");
    return _operator_plus;
  }
}

Back to the top