lib/cpee/processtransformation/structures.rb in cpee-1.3.137 vs lib/cpee/processtransformation/structures.rb in cpee-1.3.138

- old
+ new

@@ -284,10 +284,13 @@ end def shift_all self.each{ |tr| tr.shift } end + def pop_all + self.each{ |tr| tr.pop } + end def finished? self.reduce(0){|sum,t| sum += t.length} == 0 end @@ -298,16 +301,23 @@ def include_in_all?(e) num = 0 self.each{|n| num += 1 if n.include?(e)} num == self.length end + def same_position_in_all?(e,i) + num = 0 + self.each{|n| num += 1 if n[i] == e} + num == self.length + end - def infinite_loop_fix - self << self.first.dup - self.last.pop + def all_loops? + num = 0 + self.each{|n| num += 1 if n.first == n.last } + num == self.length end + def add_breaks trueloops = self.find_all{ |t| t.last == t.first }.length if trueloops == self.length self << [self.first_node] ### the blank conditional so that we get a break else @@ -362,11 +372,11 @@ def extend # find largest common max = nil sh = self.shortest sh = sh[0..-2] if sh.first == sh.last - sh.each do |e,i| - if self.include_in_all?(e) + sh.each_with_index do |e,i| + if self.same_position_in_all?(e,i) max = e else break end end