[Mmil-commits] r23 - trunk/src/fr/loria/led/mmil

alexandredenis at users.gforge.inria.fr alexandredenis at users.gforge.inria.fr
Mar 3 Oct 13:19:42 CEST 2006


Author: alexandredenis
Date: 2006-10-03 11:19:41 +0000 (Tue, 03 Oct 2006)
New Revision: 23

Modified:
   trunk/src/fr/loria/led/mmil/MMILComponent.java
Log:


Modified: trunk/src/fr/loria/led/mmil/MMILComponent.java
===================================================================
--- trunk/src/fr/loria/led/mmil/MMILComponent.java	2006-10-03 11:03:45 UTC (rev 22)
+++ trunk/src/fr/loria/led/mmil/MMILComponent.java	2006-10-03 11:19:41 UTC (rev 23)
@@ -514,31 +514,34 @@
     */
     public void aggregateSerial()
     {
+        if (entities.size()<=1)
+            return;
+
         List<MMILEntity> newEntities = new ArrayList<MMILEntity>();
         sortEntities();
-        for(int i=0; i<entities.size()-1; i++)
+        
+        MMILEntity curEntity = entities.get(0);
+        
+        for(int i=1; i<entities.size(); i++)
         {
-            MMILEntity ent1 = entities.get(i);
-            MMILEntity ent2 = entities.get(i+1);
-            MMILEntity unif = ent1.unify(ent2);
-            System.out.println("Entity 1 is\n"+ent1);
-            System.out.println("Entity 2 is\n"+ent2);
-            if (unif!=null)
+            MMILEntity unif = curEntity.unify(entities.get(i));
+            System.out.println("Current \n"+curEntity);
+            System.out.println("Entity \n"+entities.get(i));
+            if (unif==null)
             {
-                System.out.println("Unify !");
-                moveRelations(ent1, unif);
-                moveRelations(ent2, unif);
-                entities.set(i+1, unif);
-                newEntities.add(unif);
+                newEntities.add(curEntity);
+                curEntity = entities.get(i);
+                System.out.println("Does not unify\n");
             }
             else 
             {
-                System.out.println("Do not unify !");
-                newEntities.add(ent1);
-                if (i==entities.size()-1)
-                    newEntities.add(ent2);
+                moveRelations(curEntity, unif);
+                curEntity = unif;
+                System.out.println("Unify\n");
             }
         }
+
+        newEntities.add(curEntity);
         setEntities(newEntities);
     }       
 






Plus d'informations sur la liste de diffusion Mmil-commits