]> gerrit.simantics Code Review - simantics/interop.git/blobdiff - org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateList.java
Use ArrayList (instead of HashSet) to store changes
[simantics/interop.git] / org.simantics.interop.update / src / org / simantics / interop / update / model / UpdateList.java
index 21cde66e1c461e3b4ebb70444b3cccbf3fc282f2..2267ebec6f47e8ec101a39d1945e19d99aa1325a 100644 (file)
@@ -14,20 +14,20 @@ import org.simantics.interop.test.GraphChanges.Modification;
 import org.simantics.utils.datastructures.Pair;
 
 public class UpdateList {
-       private HashSet<PropertyChange> changes;
+       private List<PropertyChange> changes;
        
        public UpdateList() {
-               changes = new HashSet<>();
+               changes = new ArrayList<>();
        }
        
        public UpdateList(Collection<PropertyChange> changes) {
-               this.changes = new HashSet<>(changes);
+               this.changes = new ArrayList<>(changes);
        }
        
        public UpdateList(GraphChanges graphChanges, Collection<Modification> coll) {
-               this.changes = new HashSet<>();
+               this.changes = new ArrayList<>();
                for (Modification p : coll) {
-                       changes.add(create(graphChanges, p.getLeftSub(),p.getRightSub(),new Pair<Statement, Statement>(p.getLeftStm(), p.getRightStm())));
+                       addChange(create(graphChanges, p.getLeftSub(),p.getRightSub(),new Pair<Statement, Statement>(p.getLeftStm(), p.getRightStm())));
                }
        }
        
@@ -40,7 +40,8 @@ public class UpdateList {
        }
 
        public void addChange(PropertyChange change) {
-               changes.add(change);
+           if (!changes.contains(change))
+               changes.add(change);
        }
        
        public void removeChange(PropertyChange change) {