lib/cpee/processtransformation/bpmn2.rb in cpee-1.3.158 vs lib/cpee/processtransformation/bpmn2.rb in cpee-1.3.159

- old
+ new

@@ -204,22 +204,24 @@ branch.attributes.merge!(li.attributes) li.attributes.delete_if{true} end end end + nic = traces.incoming(node) if node == enode traces.shift_all - elsif node.incoming <= 1 + elsif nic == 1 || branch.is_a?(CPEE::ProcessTransformation::InfiniteLoop) traces.shift_all n = map_node(node) if !(n.nil? || (n.container? && (node.outgoing <=1 || traces.finished?))) (branch << n).compact! end else loops = traces.loops if node.type == :exclusiveGateway || traces.all_loops? ### as the first is a decision node, just remove and continue + ### change to nic if node.incoming == 2 node.incoming = 1 branch << Loop.new(node.id) if traces.all_loops? ### if all loops, tail loop thus remove the loopback @@ -272,10 +274,15 @@ build_ttree nb, trcs, endnode, debug, down + 1 puts '--> branch up from ' + (down + 1).to_s if debug end endnode.incoming -= 1 unless endnode.nil? end - traces.empty! if endnode.nil? + # remove all traces that don't start with endnode to account for loops + if endnode.nil? + traces.empty! + else + traces.remove_by_endnode(endnode) + end ### all before is reduced to one incoming arrow ### if now there is still more than one incoming we have a loop situation ### where the end of a branching statement is also the starting/endpoint ### of a loop endnode.incoming += 1 unless endnode.nil?