changeset 1305:014fc183c640

Fix 'incorrect minuend/subtrahend order' bug in wdiff calculation. flys-client/trunk@2939 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 11 Oct 2011 12:20:32 +0000
parents 18b0414bde44
children 2e57776f77b5
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageTwinPanel.java
diffstat 2 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Tue Oct 11 11:59:57 2011 +0000
+++ b/flys-client/ChangeLog	Tue Oct 11 12:20:32 2011 +0000
@@ -1,3 +1,11 @@
+2011-10-11  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	Squashed "swapped minuend and subtrahend"-bug in wdiff calculation.
+
+	* src/main/java/de/intevation/flys/client/client/ui/DatacageTwinPanel.java:
+	  Use LinkedHashSet instead of HashSet to keep the given order.
+	  Removed some debug statements.
+
 2011-10-11  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	Enable reparameterization of WINFO-Artifacts in WDiff-branch. Do not
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageTwinPanel.java	Tue Oct 11 11:59:57 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageTwinPanel.java	Tue Oct 11 12:20:32 2011 +0000
@@ -1,7 +1,7 @@
 package de.intevation.flys.client.client.ui;
 
 import java.util.ArrayList;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -230,19 +230,18 @@
         Config config = Config.getInstance();
         ListGridRecord[] records = differencesList.getRecords();
 
-        Set<Recommendation> ar  = new HashSet<Recommendation>();
-        Set<Recommendation> all = new HashSet<Recommendation>();
+        // Use LinkedHashSet to keep the order.
+        Set<Recommendation> ar  = new LinkedHashSet<Recommendation>();
+        Set<Recommendation> all = new LinkedHashSet<Recommendation>();
         for (ListGridRecord record : records) {
             RecommendationPairRecord r =
                 (RecommendationPairRecord) record;
             // Do not add "old" recommendations.
             if (!r.isAlreadyLoaded()) {
-                GWT.log("One not yet loaded.");
                 ar.add(r.getFirst());
                 ar.add(r.getSecond());
             }
             else {
-                GWT.log("One already loaded.");
                 all.add(r.getFirst());
                 all.add(r.getSecond());
             }
@@ -261,7 +260,8 @@
                     GWT.log("Failure of cloning with waterlevelfactory!");
                 }
                 public void onSuccess(Artifact[] artifacts) {
-                    GWT.log("Success in cloning ("+toClone.length+") with watelevelfactory!");
+                    GWT.log("Successfully cloned " + toClone.length +
+                        " with watelevelfactory.");
 
                     fireStepForwardEvent(new StepForwardEvent(
                         getData(toClone, artifacts, toUse)));

http://dive4elements.wald.intevation.org