cpee-transformation 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS +2 -0
  3. data/LICENSE +165 -0
  4. data/README.md +1 -0
  5. data/Rakefile +21 -0
  6. data/cpee-transformation.gemspec +29 -0
  7. data/lib/cpee/transformation/beautiful.rb +182 -0
  8. data/lib/cpee/transformation/bpmn2.rb +144 -0
  9. data/lib/cpee/transformation/cpee.rb +309 -0
  10. data/lib/cpee/transformation/dataflow.rb +127 -0
  11. data/lib/cpee/transformation/graphviz.rb +100 -0
  12. data/lib/cpee/transformation/implementation.rb +144 -0
  13. data/lib/cpee/transformation/implementation.xml +47 -0
  14. data/lib/cpee/transformation/mermaid.rb +242 -0
  15. data/lib/cpee/transformation/ptml.rb +316 -0
  16. data/lib/cpee/transformation/structures.rb +570 -0
  17. data/lib/cpee/transformation/target.rb +58 -0
  18. data/lib/cpee/transformation/text-bf.rb +201 -0
  19. data/lib/cpee/transformation/text-df-PO-extended.rb +221 -0
  20. data/lib/cpee/transformation/text-df-PO-reduced.rb +211 -0
  21. data/lib/cpee/transformation/transformation_text_cpee.xml +49 -0
  22. data/lib/cpee/transformation/transformation_xml_cpee.xml +49 -0
  23. data/lib/cpee/transformation/transformation_xml_text.xml +49 -0
  24. data/lib/cpee/transformation/transformer.rb +300 -0
  25. data/server/trans +38 -0
  26. data/tools/bpmn2_to_cpee.rb +84 -0
  27. data/tools/bpmn2_to_mermaid.rb +85 -0
  28. data/tools/bpmn2_to_ptml.rb +87 -0
  29. data/tools/cpee-trans +74 -0
  30. data/tools/cpee_to_cpee.rb +83 -0
  31. data/tools/cpee_to_dataflow.rb +83 -0
  32. data/tools/cpee_to_mermaid.rb +85 -0
  33. data/tools/cpee_to_ptml.rb +87 -0
  34. data/tools/cpee_to_text_bf.rb +85 -0
  35. data/tools/cpee_to_text_df-poe.rb +85 -0
  36. data/tools/cpee_to_text_df-por.rb +85 -0
  37. data/tools/mermaid_to_cpee.rb +85 -0
  38. data/tools/ptml_to_cpee.rb +87 -0
  39. metadata +160 -0
@@ -0,0 +1,201 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # This file is part of CPEE-TRANSFORMATION.
4
+ #
5
+ # CPEE-TRANSFORMATION is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Lesser General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or (at your
8
+ # option) any later version.
9
+ #
10
+ # CPEE-TRANSFORMATION is distributed in the hope that it will be useful, but
11
+ # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13
+ # for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public License
16
+ # along with CPEE-TRANSFORMATION (file COPYING in the main directory). If not,
17
+ # see <http://www.gnu.org/licenses/>.
18
+
19
+ require File.expand_path(File.dirname(__FILE__) + '/target')
20
+
21
+ module CPEE
22
+
23
+ module Transformation
24
+
25
+ module Target
26
+
27
+ class Text_bf < Default
28
+
29
+ def generate
30
+ res = "The process contains the following main elements:\n"
31
+ generate_after_list(@tree,res)
32
+ res << "After this the process ends."
33
+ res
34
+ end
35
+
36
+ private
37
+ def restore_where(orig)
38
+ @where, @first, @num = orig
39
+ end
40
+ def reset_where(where=nil,num=0)
41
+ orig = [@where,@first,@num]
42
+ @where = where
43
+ @first = 0
44
+ @num = num
45
+ orig
46
+ end
47
+
48
+ def get_next(what) #{{{
49
+ @first ||= 0
50
+ @first += 1
51
+ " * #{what}\n"
52
+ end #}}}
53
+
54
+ def get_meth(m) #{{{
55
+ case m
56
+ when "POST"; "posts to"
57
+ when "DELETE"; "deletes"
58
+ when "GET"; "gets"
59
+ when "PUT"; "updates"
60
+ when "PATCH"; "updates"
61
+ else
62
+ "calls"
63
+ end
64
+ end #}}}
65
+
66
+ def get_num(n) #{{{
67
+ case n
68
+ when 0; "first"
69
+ when 1; "second"
70
+ when 2; "third"
71
+ when 3; "fourth"
72
+ when 4; "fifth"
73
+ when 5; "sixth"
74
+ when 6; "seventh"
75
+ when 7; "eight"
76
+ when 8; "ninth"
77
+ when 9; "tenth"
78
+ end
79
+ end #}}}
80
+
81
+ def print_Break(node,res)
82
+ res << get_next("at this point the innermost loop is exited. ")
83
+ [nil]
84
+ end
85
+
86
+ def print_Loop(node,res)
87
+ post = []
88
+
89
+ @loop ||= 0
90
+ @loop += 1
91
+ loop = @loop
92
+ logic = Proc.new do
93
+ if node.mode == :pre_test
94
+ if node.sub[0].condition.empty?
95
+ res << get_next("an infinite loop (no condidition), furthermore referred to as L#{loop}.")
96
+ else
97
+ res << get_next("a loop, which starts if the condition \"#{node.sub[0].condition.join(' and ')}\" is met, furthermore referred to as L#{loop}.")
98
+ end
99
+ post << ["The loop L#{loop} contains the following elements:\n", node.sub[0] ]
100
+ else
101
+ if node.sub[0].condition.empty?
102
+ res << get_next("the start of a loop, furthermore referred to as L#{loop}.\n If the loop ends,\n L#{loop} is visited again.")
103
+ else
104
+ res << get_next("the start of a loop, furthermore referred to as L#{loop}.\n If the loop ends, and the condition \"#{node.sub[0].condition.join(' and ')}\" is met,\n L#{loop} is visited again.")
105
+ end
106
+ post << ["The loop L#{loop} contains the following elements:\n", node.sub[0] ]
107
+ end
108
+ end
109
+ if node.sub.length == 2 && node.sub[1].condition.empty? && ((node.sub[1].length == 1 && node.sub[1][0].class.name.gsub(/\w+:+/,'') == 'Break') || node.sub[1].length == 0)
110
+ logic.call
111
+ else
112
+ if node.sub.length == 1
113
+ logic.call
114
+ else
115
+ print_Conditional(node,res)
116
+ end
117
+ end
118
+ post
119
+ end
120
+
121
+ def print_Node(node,res)
122
+ if node.endpoints.empty? && !node.script.nil? && node.script.strip != ''
123
+ res << get_next("a script task with the id a#{node.niceid}")
124
+ else
125
+ lab = node.label.gsub(/"/,"\\\"").strip rescue ''
126
+ if lab.length > 0 && node.endpoints.any?
127
+ res << get_next("a task with the id a#{node.niceid} and the label \"#{lab}\" which #{get_meth(node.methods.join(','))} the endpoint #{node.endpoints.join(',')}")
128
+ elsif lab.length == 0 && node.endpoints.any?
129
+ res << get_next("a task with the id a#{node.niceid} which #{get_meth(node.methods.join(','))} the endpoint #{node.endpoints.join(',')}")
130
+ elsif lab.length > 0 && node.endpoints.empty?
131
+ res << get_next("a task with the id a#{node.niceid} and the label \"#{lab}\"")
132
+ else
133
+ res << get_next("a task with the id a#{node.niceid}")
134
+ end
135
+ if node.arguments.length > 0
136
+ res << "It is called with the following arguments: "
137
+ node.arguments.each do |k,v|
138
+ res << "#{k} is \"#{v}\""
139
+ end
140
+ end
141
+ end
142
+ [nil]
143
+ end
144
+
145
+ def print_Parallel(node,res)
146
+ post = []
147
+
148
+ @parallel ||= 0
149
+ @parallel += 1
150
+ parallel = @parallel
151
+ ltext = ""
152
+ if node.wait == "-1" && node.cancel == "last"
153
+ ltext << "a parallel gateway with #{node.sub.length} branches, furthermore dubbed PG#{parallel}. "
154
+ elsif node.wait == "1" && node.cancel == "first"
155
+ ltext << "an event-based gateway with #{node.sub.length} branches. "
156
+ elsif node.cancel == "first"
157
+ if node.wait == -1 || node.wait == 0
158
+ ltext << "a parallel gateway with #{node.sub.length} branches. "
159
+ else
160
+ ltext << "a parallel event-based gateway which waits for #{node.wait} out of #{node.sub.length} branches. "
161
+ end
162
+ else
163
+ ltext << "a complex gateway with #{node.sub.length} branches. "
164
+ end
165
+ node.sub.each_with_index do |branch,index|
166
+ post << ["The #{get_num(index)} branch of PG#{parallel} contains the following elements:\n", branch ]
167
+ end
168
+ res << get_next(ltext)
169
+ post
170
+ end
171
+
172
+ def print_Conditional(node,res)
173
+ post = []
174
+
175
+ @decision ||= 0
176
+ @decision += 1
177
+ decision = @decision
178
+ ntext = "an #{node.mode} decision with #{node.sub.length} branches. This decision will be furthermore refered to as D#{decision}. "
179
+ node.sub.each_with_index do |branch, index|
180
+ if branch.condition? && branch.condition.length > 0
181
+ ntext << "\n The #{get_num(index)} branch of D#{decision} is executed if the condition is \"#{branch.condition.join(' or ')}\". "
182
+ else
183
+ ntext << '' # empty condition.
184
+ end
185
+ post << [ "The #{get_num(index)} branch of D#{decision} contains the following elements:\n", branch ]
186
+ end
187
+ res << get_next(ntext)
188
+ # if ### default branch handling
189
+ # res << "If none of the conditions match, a default branch is executed. The default branch contains "
190
+ # post << x
191
+ # end
192
+ post
193
+ end
194
+
195
+ end
196
+
197
+ end
198
+
199
+ end
200
+
201
+ end
@@ -0,0 +1,221 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # This file is part of CPEE-TRANSFORMATION.
4
+ #
5
+ # CPEE-TRANSFORMATION is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Lesser General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or (at your
8
+ # option) any later version.
9
+ #
10
+ # CPEE-TRANSFORMATION is distributed in the hope that it will be useful, but
11
+ # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13
+ # for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public License
16
+ # along with CPEE-TRANSFORMATION (file COPYING in the main directory). If not,
17
+ # see <http://www.gnu.org/licenses/>.
18
+
19
+ require File.expand_path(File.dirname(__FILE__) + '/target')
20
+
21
+ module CPEE
22
+
23
+ module Transformation
24
+
25
+ module Target
26
+
27
+ class Text_df_PO_extended < Default
28
+
29
+ def generate
30
+ res = ""
31
+ generate_in_list(@tree,res)
32
+ res.sub!(/.\s*$/,', and the process ends.')
33
+ res
34
+ end
35
+
36
+ private
37
+ def restore_where(orig)
38
+ @where, @first, @num = orig
39
+ end
40
+ def reset_where(where=nil,num=0)
41
+ orig = [@where,@first,@num]
42
+ @where = where
43
+ @first = 0
44
+ @num = num
45
+ orig
46
+ end
47
+
48
+ def get_next(what) #{{{
49
+ if @phrases.nil?
50
+ phrases = ["Then #{what} occurs. ", "Afterwards, this is followed by #{what}. ", "Subsequently, this is followed by #{what}. ", "Subsequently #{what} occurs. "]
51
+ end
52
+ @first ||= 0
53
+ @first += 1
54
+ if @num == 1
55
+ "The only entry #{@where.nil? ? '' : @where + ' ' }is #{what}. "
56
+ else
57
+ if @first == 1 && !@where.nil?
58
+ "The first entry in #{@where.nil? ? '' : @where + ' '}is #{what}. "
59
+ elsif @first == 1 && @where.nil?
60
+ "First, #{what} occurs. "
61
+ else
62
+ phrase = phrases.shift
63
+ phrases.append phrase
64
+ phrase
65
+ end
66
+ end
67
+ end #}}}
68
+
69
+ def get_meth(m) #{{{
70
+ case m
71
+ when "POST"; "posts to"
72
+ when "DELETE"; "deletes"
73
+ when "GET"; "gets"
74
+ when "PUT"; "updates"
75
+ when "PATCH"; "updates"
76
+ else
77
+ "calls"
78
+ end
79
+ end #}}}
80
+
81
+ def get_num(n) #{{{
82
+ case n
83
+ when 0; "first"
84
+ when 1; "second"
85
+ when 2; "third"
86
+ when 3; "fourth"
87
+ when 4; "fifth"
88
+ when 5; "sixth"
89
+ when 6; "seventh"
90
+ when 7; "eight"
91
+ when 8; "ninth"
92
+ when 9; "tenth"
93
+ end
94
+ end #}}}
95
+
96
+ def print_Break(node,res)
97
+ res << "At this point the innermost loop is exited. "
98
+ res
99
+ end
100
+
101
+ def print_Loop(node,res)
102
+ @loop ||= 0
103
+ @loop += 1
104
+ loop = @loop
105
+ logic = Proc.new do
106
+ if node.mode == :pre_test
107
+ if node.sub[0].condition.empty?
108
+ res << get_next("an infinite loop (no condidition)")
109
+ else
110
+ res << get_next("a loop, which starts if the condition \"#{node.sub[0].condition.join(' and ')}\" is met,")
111
+ end
112
+ generate_in_list(node.sub[0],res)
113
+ else
114
+ res << get_next("the start of a loop")
115
+ generate_in_list(node.sub[0],res)
116
+ if node.sub[0].condition.empty?
117
+ res << "If we reach this point we loop back. "
118
+ else
119
+ res << "After this we loop back, if the condition \"#{node.sub[0].condition.join(' and ')}\" evaluates to true. "
120
+ end
121
+ end
122
+ end
123
+ if node.sub.length == 2 && node.sub[1].condition.empty? && ((node.sub[1].length == 1 && node.sub[1][0].class.name.gsub(/\w+:+/,'') == 'Break') || node.sub[1].length == 0)
124
+ logic.call
125
+ else
126
+ if node.sub.length == 1
127
+ logic.call
128
+ else
129
+ print_Conditional(node,res)
130
+ end
131
+ end
132
+ res
133
+ end
134
+
135
+ def print_Node(node,res)
136
+ ep = node.endpoints.dup
137
+ if ep.length == 1 && ep[0].empty?
138
+ ep = []
139
+ end
140
+ if ep.empty? && !node.script.nil? && node.script.strip != ''
141
+ res << get_next("a script task with the id a#{node.niceid}")
142
+ else
143
+ lab = node.label.gsub(/"/,"\\\"").strip rescue ''
144
+ if lab.length > 0 && ep.any?
145
+ res << get_next("a task with the id a#{node.niceid} and the label \"#{lab}\" which #{get_meth(node.methods.join(','))} the endpoint #{ep.join(',')}")
146
+ elsif lab.length == 0 && ep.any?
147
+ res << get_next("a task with the id a#{node.niceid} which #{get_meth(node.methods.join(','))} the endpoint #{ep.join(',')}")
148
+ elsif lab.length > 0 && ep.empty?
149
+ res << get_next("a task with the id a#{node.niceid} and the label \"#{lab}\"")
150
+ else
151
+ res << get_next("a task with the id a#{node.niceid}")
152
+ end
153
+ if node.arguments.length > 0
154
+ res << "It is called with the following arguments: "
155
+ params = []
156
+ node.arguments.each do |k,v|
157
+ params << "#{k} is \"#{v}\""
158
+ end
159
+ res << params.join(', ') + '. '
160
+ end
161
+ end
162
+ res
163
+ end
164
+
165
+ def print_Parallel(node,res)
166
+ @parallel ||= 0
167
+ @parallel += 1
168
+ parallel = @parallel
169
+ if node.wait == "-1" && node.cancel == "last"
170
+ res << get_next("a parallel gateway with #{node.sub.length} branches, furthermore dubbed PG#{parallel},")
171
+ elsif node.wait == "1" && node.cancel == "first"
172
+ res << get_next("an event-based gateway with #{node.sub.length} branches")
173
+ elsif node.cancel == "first"
174
+ if node.wait == -1 || node.wait == 0
175
+ res << get_next("a parallel gateway with #{node.sub.length} branches")
176
+ else
177
+ res << get_next("a parallel event-based gateway which waits for #{node.wait} out of #{node.sub.length} branches")
178
+ end
179
+ else
180
+ res << get_next("a complex gateway with #{node.sub.length} branches")
181
+ end
182
+ node.sub.each_with_index do |branch,index|
183
+ orig = reset_where "in the #{get_num(index)} parallel branch of PG#{parallel}", node.sub.length
184
+ generate_in_list(branch,res)
185
+ restore_where orig
186
+ end
187
+ res << "Finally the branches of PG#{parallel} are joined. "
188
+ res
189
+ end
190
+
191
+ def print_Conditional(node,res)
192
+ @decision ||= 0
193
+ @decision += 1
194
+ decision = @decision
195
+ res << get_next("an #{node.mode} decision with #{node.sub.length} branches")
196
+ res << "This decision will be furthermore refered to as D#{decision}. "
197
+ node.sub.each_with_index do |branch, index|
198
+ if branch.condition? && branch.condition.length > 0
199
+ res << "The #{get_num(index)} branch of D#{decision} is executed if the condition is \"#{branch.condition.join(' or ')}\". "
200
+ else
201
+ res << '' # empty condition.
202
+ end
203
+ orig = reset_where "in the #{get_num(index)} branch of D#{decision}", branch.length
204
+ generate_in_list(branch,res)
205
+ restore_where orig
206
+ end
207
+ # if ### default branch handling
208
+ # res << "If none of the conditions match, a default branch is executed. The default branch contains "
209
+ # generate_in_list(x,res)
210
+ # end
211
+ res << "Following this, all branches of D#{decision} are finished. "
212
+ res
213
+ end
214
+
215
+ end
216
+
217
+ end
218
+
219
+ end
220
+
221
+ end
@@ -0,0 +1,211 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # This file is part of CPEE-TRANSFORMATION.
4
+ #
5
+ # CPEE-TRANSFORMATION is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Lesser General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or (at your
8
+ # option) any later version.
9
+ #
10
+ # CPEE-TRANSFORMATION is distributed in the hope that it will be useful, but
11
+ # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13
+ # for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public License
16
+ # along with CPEE-TRANSFORMATION (file COPYING in the main directory). If not,
17
+ # see <http://www.gnu.org/licenses/>.
18
+
19
+ require File.expand_path(File.dirname(__FILE__) + '/target')
20
+
21
+ module CPEE
22
+
23
+ module Transformation
24
+
25
+ module Target
26
+
27
+ class Text_df_PO_reduced < Default
28
+
29
+ def generate
30
+ res = ""
31
+ generate_in_list(@tree,res)
32
+ res.sub!(/.\s*$/,', and the process ends.')
33
+ res
34
+ end
35
+
36
+ private
37
+ def restore_where(orig)
38
+ @where, @first, @num = orig
39
+ end
40
+ def reset_where(where=nil,num=0)
41
+ orig = [@where,@first,@num]
42
+ @where = where
43
+ @first = 0
44
+ @num = num
45
+ orig
46
+ end
47
+
48
+ def get_next(what) #{{{
49
+ if @phrases.nil?
50
+ phrases = ["Then #{what} occurs. ", "Afterwards, this is followed by #{what}. ", "Subsequently, this is followed by #{what}. ", "Subsequently #{what} occurs. "]
51
+ end
52
+ @first ||= 0
53
+ @first += 1
54
+ if @num == 1
55
+ "The only entry #{@where.nil? ? '' : @where + ' ' }is #{what}. "
56
+ else
57
+ if @first == 1 && !@where.nil?
58
+ "The first entry in #{@where.nil? ? '' : @where + ' '}is #{what}. "
59
+ elsif @first == 1 && @where.nil?
60
+ "First, #{what} occurs. "
61
+ else
62
+ phrase = phrases.shift
63
+ phrases.append phrase
64
+ phrase
65
+ end
66
+ end
67
+ end #}}}
68
+
69
+ def get_meth(m) #{{{
70
+ case m
71
+ when "POST"; "posts to"
72
+ when "DELETE"; "deletes"
73
+ when "GET"; "gets"
74
+ when "PUT"; "updates"
75
+ when "PATCH"; "updates"
76
+ else
77
+ "calls"
78
+ end
79
+ end #}}}
80
+
81
+ def get_num(n) #{{{
82
+ case n
83
+ when 0; "first"
84
+ when 1; "second"
85
+ when 2; "third"
86
+ when 3; "fourth"
87
+ when 4; "fifth"
88
+ when 5; "sixth"
89
+ when 6; "seventh"
90
+ when 7; "eight"
91
+ when 8; "ninth"
92
+ when 9; "tenth"
93
+ end
94
+ end #}}}
95
+
96
+ def print_Break(node,res)
97
+ res << "At this point the innermost loop is exited. "
98
+ res
99
+ end
100
+
101
+ def print_Loop(node,res)
102
+ logic = Proc.new do
103
+ if node.mode == :pre_test
104
+ if node.sub[0].condition.empty?
105
+ res << get_next("an infinite loop (no condidition)")
106
+ else
107
+ res << get_next("a loop, which starts if the condition \"#{node.sub[0].condition.join(' and ')}\" is met,")
108
+ end
109
+ generate_in_list(node.sub[0],res)
110
+ else
111
+ res << get_next("the start of a loop")
112
+ generate_in_list(node.sub[0],res)
113
+ if node.sub[0].condition.empty?
114
+ res << "If we reach this point we loop back. "
115
+ else
116
+ res << "After this we loop back, if the condition \"#{node.sub[0].condition.join(' and ')}\" evaluates to true. "
117
+ end
118
+ end
119
+ end
120
+ if node.sub.length == 2 && node.sub[1].condition.empty? && ((node.sub[1].length == 1 && node.sub[1][0].class.name.gsub(/\w+:+/,'') == 'Break') || node.sub[1].length == 0)
121
+ logic.call
122
+ else
123
+ if node.sub.length == 1
124
+ logic.call
125
+ else
126
+ print_Conditional(node,res)
127
+ end
128
+ end
129
+ res
130
+ end
131
+
132
+ def print_Node(node,res)
133
+ ep = node.endpoints.dup
134
+ if ep.length == 1 && ep[0].empty?
135
+ ep = []
136
+ end
137
+ if ep.empty? && !node.script.nil? && node.script.strip != ''
138
+ res << get_next("a script task with the id a#{node.niceid}")
139
+ else
140
+ lab = node.label.gsub(/"/,"\\\"").strip rescue ''
141
+ if lab.length > 0 && ep.any?
142
+ res << get_next("a task with the id a#{node.niceid} and the label \"#{lab}\" which #{get_meth(node.methods.join(','))} the endpoint #{ep.join(',')}")
143
+ elsif lab.length == 0 && ep.any?
144
+ res << get_next("a task with the id a#{node.niceid} which #{get_meth(node.methods.join(','))} the endpoint #{ep.join(',')}")
145
+ elsif lab.length > 0 && ep.empty?
146
+ res << get_next("a task with the id a#{node.niceid} and the label \"#{lab}\"")
147
+ else
148
+ res << get_next("a task with the id a#{node.niceid}")
149
+ end
150
+ if node.arguments.length > 0
151
+ res << "It is called with the following arguments: "
152
+ params = []
153
+ node.arguments.each do |k,v|
154
+ params << "#{k} is \"#{v}\""
155
+ end
156
+ res << params.join(', ') + '. '
157
+ end
158
+ end
159
+ res
160
+ end
161
+
162
+ def print_Parallel(node,res)
163
+ if node.wait == "-1" && node.cancel == "last"
164
+ res << get_next("a parallel gateway with #{node.sub.length} branches")
165
+ elsif node.wait == "1" && node.cancel == "first"
166
+ res << get_next("an event-based gateway with #{node.sub.length} branches")
167
+ elsif node.cancel == "first"
168
+ if node.wait == -1 || node.wait == 0
169
+ res << get_next("a parallel gateway with #{node.sub.length} branches")
170
+ else
171
+ res << get_next("a parallel event-based gateway which waits for #{node.wait} out of #{node.sub.length} branches")
172
+ end
173
+ else
174
+ res << get_next("a complex gateway with #{node.sub.length} branches")
175
+ end
176
+ node.sub.each_with_index do |branch,index|
177
+ orig = reset_where "in the #{get_num(index)} parallel branch", node.sub.length
178
+ generate_in_list(branch,res)
179
+ restore_where orig
180
+ end
181
+ res << "Finally the parallel branches are joined. "
182
+ res
183
+ end
184
+
185
+ def print_Conditional(node,res)
186
+ res << get_next("an #{node.mode} decision with #{node.sub.length} branches")
187
+ node.sub.each_with_index do |branch, index|
188
+ if branch.condition? && branch.condition.length > 0
189
+ res << "The #{get_num(index)} decision branch is executed if the condition is \"#{branch.condition.join(' or ')}\". "
190
+ else
191
+ res << '' # empty condition.
192
+ end
193
+ orig = reset_where "in the #{get_num(index)} decision branch", branch.length
194
+ generate_in_list(branch,res)
195
+ restore_where orig
196
+ end
197
+ # if ### default branch handling
198
+ # res << "If none of the conditions match, a default branch is executed. The default branch contains "
199
+ # generate_in_list(x,res)
200
+ # end
201
+ res << "Following this, all decision branches are finished. "
202
+ res
203
+ end
204
+
205
+ end
206
+
207
+ end
208
+
209
+ end
210
+
211
+ end
@@ -0,0 +1,49 @@
1
+ <!--
2
+ This file is part of CPEE-TRANSFORMATION.
3
+
4
+ CPEE-TRANSFORMATION is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Lesser General Public License as published by
6
+ the Free Software Foundation, either version 3 of the License, or (at your
7
+ option) any later version.
8
+
9
+ CPEE-TRANSFORMATION is distributed in the hope that it will be useful, but
10
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
12
+ for more details.
13
+
14
+ You should have received a copy of the GNU Lesser General Public License
15
+ along with CPEE-TRANSFORMATION (file LICENSE in the main directory). If not,
16
+ see <http://www.gnu.org/licenses/>.
17
+ -->
18
+
19
+ <description datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://riddl.org/ns/description/1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
20
+
21
+ <message name="xmldescription">
22
+ <parameter name="description" mimetype="text/xml"/>
23
+ </message>
24
+ <message name="list">
25
+ <zeroOrMore>
26
+ <parameter name="name" type="string"/>
27
+ <parameter name="value" type="string"/>
28
+ </zeroOrMore>
29
+ </message>
30
+
31
+ <message name="plaindedesc">
32
+ <parameter name="description" mimetype="text/plain"/>
33
+ <parameter name="type" fixed="description"/>
34
+ </message>
35
+ <message name="plaindadesc">
36
+ <parameter name="description" mimetype="text/plain"/>
37
+ <parameter name="type" fixed="dataelements"/>
38
+ </message>
39
+ <message name="plainendesc">
40
+ <parameter name="description" mimetype="text/plain"/>
41
+ <parameter name="type" fixed="endpoints"/>
42
+ </message>
43
+
44
+ <resource>
45
+ <post in="plaindedesc" out="xmldescription"/>
46
+ <post in="plaindadesc" out="list"/>
47
+ <post in="plainendesc" out="list"/>
48
+ </resource>
49
+ </description>