cpee 1.3.159 → 1.3.160

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c839fcbe55d2d855568d6467466d136d756288c
4
- data.tar.gz: 74c5767ec1e718a38f440c01005922f54ba90920
3
+ metadata.gz: 1db33f357360202a3eebfe4f375eb149fc5e6d1f
4
+ data.tar.gz: 83c7b07ca81a93a19d2d4062582728ef1dbc4a29
5
5
  SHA512:
6
- metadata.gz: 532002e583957edbb012a7f9e62282680fc1dd59c5c495349762250de952822f96ccd94664ed05f9eab26306a4edd537aed9fc9001a0a1425117049a8b0cab21
7
- data.tar.gz: d4bcf178ce517f1df5cbd3f3278976d6c1da7610f74db0084d459cf321eb2a5a160c06896dcba9a8f04e8c88a3108f86f11a5c127ac13b3c09aea00163f2ecac
6
+ metadata.gz: 0e16f74611ae052df0e6e2b79cdbc8c4e82cb588839ac132b062610c71476bb816fedc0c789fbb23362803c81b1e489301d434294c8b577def9d7cda66037faf
7
+ data.tar.gz: 8d734498c1a896361ee8150d7cfb728001df38e032368ae7b03197cb1cd688e5d0c99a8fe840b4ec7f31a57cd46b37e08271c1eb82cf047784fce8cedead5f10
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee"
3
- s.version = "1.3.159"
3
+ s.version = "1.3.160"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3"
6
6
  s.summary = "Preliminary release of cloud process execution engine (cpee). If you just need workflow execution, without a rest/xmpp service exposing it, then use WEEL"
@@ -155,16 +155,16 @@ module CPEE
155
155
  end #}}}
156
156
  private :build_extraces
157
157
 
158
- def map_node(node) #{{{
158
+ def map_node(node,flat) #{{{
159
159
  case node.type
160
160
  when :parallelGateway
161
- Parallel.new(node.id,node.type)
161
+ flat ? nil : Parallel.new(node.id,node.type)
162
162
  when :exclusiveGateway
163
- Conditional.new(node.id,:exclusive,node.type)
163
+ flat ? nil : Conditional.new(node.id,:exclusive,node.type)
164
164
  when :eventBasedGateway
165
- Parallel.new(node.id,node.type,1)
165
+ flat ? nil : Parallel.new(node.id,node.type,1)
166
166
  when :inclusiveGateway
167
- Conditional.new(node.id,:inclusive,node.type)
167
+ flat ? nil : Conditional.new(node.id,:inclusive,node.type)
168
168
  when :endEvent, :startEvent, nil
169
169
  nil
170
170
  else
@@ -206,57 +206,39 @@ module CPEE
206
206
  end
207
207
  end
208
208
  end
209
- nic = traces.incoming(node)
210
209
  if node == enode
211
210
  traces.shift_all
212
- elsif nic == 1 || branch.is_a?(CPEE::ProcessTransformation::InfiniteLoop)
211
+ elsif traces.incoming(node) == 1
213
212
  traces.shift_all
214
- n = map_node(node)
215
- if !(n.nil? || (n.container? && (node.outgoing <=1 || traces.finished?)))
213
+ n = map_node(node,traces.same_first)
214
+ if !n.nil? && !(n.container? && traces.finished?)
216
215
  (branch << n).compact!
217
216
  end
218
217
  else
219
218
  loops = traces.loops
220
219
  if node.type == :exclusiveGateway || traces.all_loops?
221
- ### as the first is a decision node, just remove and continue
222
- ### change to nic
223
- if node.incoming == 2
224
- node.incoming = 1
225
- branch << Loop.new(node.id)
226
- if traces.all_loops?
227
- ### if all loops, tail loop thus remove the loopback
228
- loops.pop_all
229
- else
230
- ### remove the gateway itself, as for a single loop it is no longer used.
231
- traces.shift_all
232
- end
233
- puts '--> down loop1 to ' + (down + 1).to_s if debug
234
- loops.remove_empty
235
- build_ttree branch.last, loops.dup, nil, debug, down + 1
236
- puts '--> up loop1 from ' + (down + 1).to_s if debug
237
- else
238
- ### dont remove it, treat it as a normal conditional
239
- ### an infinite loop that can only be left by break is created
240
- node.incoming = 1
241
- branch << InfiniteLoop.new(node.id)
242
- ### add the blank conditional to get a break
243
- len = loops.length
244
- loops.add_breaks(self.object_id)
245
- puts '--> down loop2 to ' + (down + 1).to_s if debug
246
- build_ttree branch.last, loops.dup, nil, debug, down + 1
247
- puts '--> up loop2 from ' + (down + 1).to_s if debug
248
- ### set outgoing to number of loops (without the break) so that it can be ignored (should be 1 all the time)
249
- node.outgoing -= len
250
- end
220
+ ### an infinite loop that can only be left by break is created
221
+ ### at the output time it is decided wether this can be optimized
222
+ branch << Loop.new(node.id)
223
+ ### duplicate because we need it later to remove all the shit from traces
224
+ lops = loops.dup
225
+ ### remove the exclusive gateway because we no longer need it
226
+ lops.add_breaks(self.object_id)
227
+ lops.shift_all
228
+ ### add the blank conditional to get a break
229
+ puts '--> down head_loop to ' + (down + 1).to_s if debug
230
+ build_ttree branch, lops, nil, debug, down + 1
231
+ puts '--> up head_loop from ' + (down + 1).to_s if debug
232
+ traces.remove(loops)
233
+ traces.shift_all
251
234
  else
252
- node.incoming -= loops.length
253
235
  ### throw away the loop traces, remove loop traces from front of all other traces
254
236
  traces.segment_by_loops loops
255
- puts '--> down loop3 to ' + (down + 1).to_s if debug
237
+ puts '--> down tail_loop to ' + (down + 1).to_s if debug
256
238
  build_ttree branch, loops.dup, nil, debug, down + 1
257
- puts '--> up loop3 from ' + (down + 1).to_s if debug
239
+ puts '--> up tail_loop from ' + (down + 1).to_s if debug
240
+ traces.remove(loops)
258
241
  end
259
- traces.remove(loops)
260
242
  traces.remove_empty
261
243
  end
262
244
  else
@@ -267,14 +249,13 @@ module CPEE
267
249
  nb = branch.last.new_branch
268
250
  if trcs.finished?
269
251
  puts '--> branch down to ' + (down + 1).to_s if debug
270
- build_ttree nb, Traces.new([[Break.new(self.object_id,1)]]), endnode, debug, down + 1
252
+ build_ttree nb, Traces.new([[Break.new(self.object_id)]]), endnode, debug, down + 1
271
253
  puts '--> branch up from ' + (down + 1).to_s if debug
272
254
  else
273
255
  puts '--> branch down to ' + (down + 1).to_s if debug
274
256
  build_ttree nb, trcs, endnode, debug, down + 1
275
257
  puts '--> branch up from ' + (down + 1).to_s if debug
276
258
  end
277
- endnode.incoming -= 1 unless endnode.nil?
278
259
  end
279
260
  # remove all traces that don't start with endnode to account for loops
280
261
  if endnode.nil?
@@ -282,11 +263,6 @@ module CPEE
282
263
  else
283
264
  traces.remove_by_endnode(endnode)
284
265
  end
285
- ### all before is reduced to one incoming arrow
286
- ### if now there is still more than one incoming we have a loop situation
287
- ### where the end of a branching statement is also the starting/endpoint
288
- ### of a loop
289
- endnode.incoming += 1 unless endnode.nil?
290
266
  end
291
267
  end
292
268
  end
@@ -55,12 +55,17 @@ module CPEE
55
55
  generate_for_list(node,s1)
56
56
  end
57
57
  def print_Loop_default(node,res)
58
- s1 = res.add('loop', 'pre_test' => node.condition.empty? ? 'true' : node.condition.join(' && '))
59
- s1.attributes['language'] = node.condition_type unless node.condition_type.nil?
60
- node.attributes.each do |k,v|
61
- s1.attributes[k] = v
58
+ if node.sub.length == 2
59
+ s1 = res.add('loop', 'pre_test' => node.sub[0].condition.empty? ? 'true' : node.sub[0].condition.join(' && '))
60
+ s1.attributes['language'] = node.sub[0].condition_type unless node.sub[0].condition_type.nil?
61
+ node.sub[0].attributes.each do |k,v|
62
+ s1.attributes[k] = v
63
+ end
64
+ generate_for_list(node.sub[0],s1)
65
+ else
66
+ s1 = res.add('loop', 'pre_test' => 'true')
67
+ print_Conditional(node,s1)
62
68
  end
63
- generate_for_list(node,s1)
64
69
  s1
65
70
  end
66
71
  private :print_Loop_default
@@ -74,8 +74,8 @@ module CPEE
74
74
  end #}}}
75
75
 
76
76
  class Break < Node
77
- def initialize(context,incoming)
78
- super context, '-1', :break, 'BREAK', incoming, []
77
+ def initialize(context)
78
+ super context, '-1', :break, 'BREAK', 1, []
79
79
  end
80
80
  end
81
81
 
@@ -101,31 +101,27 @@ module CPEE
101
101
  @id = id
102
102
  end
103
103
  end #}}}
104
- class InfiniteLoop < Array #{{{
104
+ class Loop #{{{
105
105
  include Container
106
- def condition?; false; end
107
- attr_reader :attributes
108
- attr_accessor :id, :type
109
- def initialize(id)
110
- @container = true
111
- @id = id
112
- @type = :loop
113
- @attributes = {}
114
- end
115
- end #}}}
116
- class Loop < Array #{{{
117
- include Container
118
- attr_accessor :id, :type, :condition, :condition_type
106
+ include Struct
107
+ include Enumerable
108
+ attr_reader :id, :sub, :mode
109
+ attr_accessor :type, :condition, :condition_type
119
110
  attr_reader :attributes
120
111
  def condition?; true; end
121
112
  def initialize(id)
122
113
  @container = true
123
114
  @id = id
124
115
  @type = :loop
116
+ @mode = :exclusive
125
117
  @condition = []
118
+ @sub = []
126
119
  @condition_type = nil
127
120
  @attributes = {}
128
121
  end
122
+ def new_branch
123
+ (@sub << Alternative.new(@id)).last
124
+ end
129
125
  end #}}}
130
126
 
131
127
  class Parallel #{{{
@@ -330,10 +326,9 @@ module CPEE
330
326
  self.each{|n| num += 1 if n.include?(e)}
331
327
  num == self.length
332
328
  end
333
- def same_position_in_all?(e,i)
334
- num = 0
335
- self.each{|n| num += 1 if n[i] == e}
336
- num == self.length
329
+
330
+ def aaa
331
+ puts 'rrr'
337
332
  end
338
333
 
339
334
  def all_loops?
@@ -342,12 +337,11 @@ module CPEE
342
337
  num == self.length
343
338
  end
344
339
 
345
-
346
340
  def add_breaks(context)
347
341
  trueloops = self.find_all{ |t| t.last == t.first }.length
348
- tb = Break.new(context,1)
342
+ tb = Break.new(context)
349
343
  if trueloops == self.length
350
- self << [self.first_node] ### the blank conditional so that we get a break
344
+ self << [nil,tb]
351
345
  else
352
346
  self.each do |t|
353
347
  t << tb unless t.last == t.first ### an explicit break
@@ -400,22 +394,13 @@ module CPEE
400
394
 
401
395
  def extend
402
396
  # find largest common
403
- max = nil
397
+ max = []
404
398
  sh = self.shortest
405
399
  sh = sh[0..-2] if sh.first == sh.last
406
400
  sh.each_with_index do |e,i|
407
- if self.same_position_in_all?(e,i)
408
- max = e
409
- else
410
- break
411
- end
401
+ max << e if self.include_in_all?(e)
412
402
  end
413
-
414
- # all before the largest common are just copied, so incoming should be 1
415
- sh.each do |e|
416
- break if e == max
417
- e.incoming = 1
418
- end
403
+ max = max.last
419
404
 
420
405
  # if last is the largest common do nothing
421
406
  # else append from last to largest common
@@ -430,7 +415,6 @@ module CPEE
430
415
  end
431
416
  end
432
417
 
433
- max.incoming = self.length + 1
434
418
  max
435
419
  end
436
420
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.159
4
+ version: 1.3.160
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler