Support for unhandled factorization cases added by fixing bug
authorlbessard
Wed, 17 Sep 2008 17:59:53 +0200
changeset 273 5b18d98aa4f9
parent 272 3a9db28bc6b5
child 274 047e36c63736
Support for unhandled factorization cases added by fixing bug
PLCGenerator.py
--- a/PLCGenerator.py	Wed Sep 17 14:26:01 2008 +0200
+++ b/PLCGenerator.py	Wed Sep 17 17:59:53 2008 +0200
@@ -744,16 +744,20 @@
         factorized_paths = []
         for num, path in enumerate(paths):
             if type(path) == ListType:
-                for i in xrange(1, len(path)):
-                    str_path = str(path[i:])
+                if len(path) > 1:
+                    str_path = str(path[-1:])
                     same_paths.setdefault(str_path, [])
-                    same_paths[str_path].append((path[:i], num))
+                    same_paths[str_path].append((path[:-1], num))
             else:
                 factorized_paths.append(path)
                 uncomputed_index.remove(num)
         for same_path, elements in same_paths.items():
             if len(elements) > 1:
-                factorized_paths.append([tuple([path for path, num in elements])] + eval(same_path))        
+                elements_paths = self.FactorizePaths([path for path, num in elements])
+                if len(elements_paths) > 1:
+                    factorized_paths.append([tuple(elements_paths)] + eval(same_path))        
+                else:
+                    factorized_paths.append(elements_paths + eval(same_path))
                 for path, num in elements:
                     uncomputed_index.remove(num)
         for num in uncomputed_index: