From: Marko Luukkainen Date: Thu, 29 Aug 2019 07:46:08 +0000 (+0300) Subject: Use ArrayList (instead of HashSet) to store changes X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=f13ae5d0bf1d136232cbce22b1a31be429ca2b54;p=simantics%2Finterop.git Use ArrayList (instead of HashSet) to store changes gitlab #11 Change-Id: I7d5a2c1f462c6de3c401288420350e25f650147f --- diff --git a/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateList.java b/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateList.java index 21cde66..2267ebe 100644 --- a/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateList.java +++ b/org.simantics.interop.update/src/org/simantics/interop/update/model/UpdateList.java @@ -14,20 +14,20 @@ import org.simantics.interop.test.GraphChanges.Modification; import org.simantics.utils.datastructures.Pair; public class UpdateList { - private HashSet changes; + private List changes; public UpdateList() { - changes = new HashSet<>(); + changes = new ArrayList<>(); } public UpdateList(Collection changes) { - this.changes = new HashSet<>(changes); + this.changes = new ArrayList<>(changes); } public UpdateList(GraphChanges graphChanges, Collection coll) { - this.changes = new HashSet<>(); + this.changes = new ArrayList<>(); for (Modification p : coll) { - changes.add(create(graphChanges, p.getLeftSub(),p.getRightSub(),new Pair(p.getLeftStm(), p.getRightStm()))); + addChange(create(graphChanges, p.getLeftSub(),p.getRightSub(),new Pair(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) {