bug fix
authoryeom <yeom>
Mon, 5 Oct 2009 17:04:46 +0000 (17:04 +0000)
committeryeom <yeom>
Mon, 5 Oct 2009 17:04:46 +0000 (17:04 +0000)
Robust/src/Analysis/MLP/VarSrcTokTable.java

index f5ba5dd75f32096c20337e81df45bdd4da9902e3..aca674770245ea3e9ef032c9b7d778b5846de8cf 100644 (file)
@@ -390,18 +390,33 @@ public class VarSrcTokTable {
     if( childItr.hasNext() ) {
       FlatSESEEnterNode child = childItr.next();
       
+      // set of VSTs for removal
+      HashSet<VariableSourceToken> removalSet=new HashSet<VariableSourceToken>();
+      // set of VSTs for additon
+      HashSet<VariableSourceToken> additionSet=new HashSet<VariableSourceToken>();
+      
       Iterator<VariableSourceToken> vstItr = get( child ).iterator();
       while( vstItr.hasNext() ) {
         VariableSourceToken vst = vstItr.next();
-
+        removalSet.add(vst);
+        additionSet.add(new VariableSourceToken( vst.getRefVars(),
+                             curr,
+                             new Integer( 0 ),
+                             vst.getAddrVar()
+                                  ));
+      }
+      
+      // remove( eah item in forremoval )
+      vstItr = removalSet.iterator();
+      while( vstItr.hasNext() ) {
+        VariableSourceToken vst = vstItr.next();
         remove( vst );
-       
-        add( new VariableSourceToken( vst.getRefVars(),
-                                     curr,
-                                     new Integer( 0 ),
-                                     vst.getAddrVar()
-                                      )
-             );
+      }
+      // add( each  ite inm for additon _
+      vstItr = additionSet.iterator();
+      while( vstItr.hasNext() ) {
+        VariableSourceToken vst = vstItr.next();
+        add( vst );
       }
     }