changeset 3190:49fe2ed03c12

SQ: Refactored fitting to better fit the data types of SQResult. flys-artifacts/trunk@4805 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 26 Jun 2012 17:20:31 +0000
parents 89dc2db3a202
children ef0db530c341
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Fitting.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Outlier.java
diffstat 3 files changed, 24 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Jun 26 17:06:26 2012 +0000
+++ b/flys-artifacts/ChangeLog	Tue Jun 26 17:20:31 2012 +0000
@@ -1,3 +1,9 @@
+2012-06-26	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/sq/Outlier.java,
+	  src/main/java/de/intevation/flys/artifacts/model/sq/Fitting.java:
+	  Refactored to better fit the data types of SQResult.
+
 2012-06-26	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/LegendProcessor.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Fitting.java	Tue Jun 26 17:06:26 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Fitting.java	Tue Jun 26 17:20:31 2012 +0000
@@ -28,9 +28,9 @@
 
     protected double chiSqr;
 
-    protected List<SQ> remaining;
+    protected SQ [] remaining;
 
-    protected List<List<SQ>> outliers;
+    protected List<SQ []> outliers;
 
     public Fitting() {
     }
@@ -80,19 +80,19 @@
         this.chiSqr = chiSqr;
     }
 
-    public List<SQ> getRemaining() {
+    public SQ [] getRemaining() {
         return remaining;
     }
 
-    public void setRemaining(List<SQ> remaining) {
+    public void setRemaining(SQ [] remaining) {
         this.remaining = remaining;
     }
 
-    public List<List<SQ>> getOutliers() {
+    public List<SQ []> getOutliers() {
         return outliers;
     }
 
-    public void setOutliers(List<List<SQ>> outliers) {
+    public void setOutliers(List<SQ []> outliers) {
         this.outliers = outliers;
     }
 
@@ -203,7 +203,14 @@
 
                     @Override
                     public void finished() {
-                        setOutliers(outliers);
+                        List<SQ []> result =
+                            new ArrayList<SQ []>(outliers.size());
+
+                        for (List<SQ> ols: outliers) {
+                            result.add(ols.toArray(new SQ[ols.size()]));
+                        }
+
+                        setOutliers(result);
                     }
                 },
                 sqs,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Outlier.java	Tue Jun 26 17:06:26 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Outlier.java	Tue Jun 26 17:20:31 2012 +0000
@@ -37,7 +37,7 @@
         }
     } // class EvalSQ
 
-    public static List<SQ> detectOutliers(
+    public static SQ [] detectOutliers(
         Callback callback,
         List<SQ> sqs,
         double   stdDevFactor
@@ -91,10 +91,10 @@
 
         callback.finished();
 
-        List<SQ> result = new ArrayList<SQ>(good.size());
+        SQ [] result = new SQ[good.size()];
 
-        for (EvalSQ esq: good) {
-            result.add(esq.sq);
+        for (int i = 0; i < result.length; ++i) {
+            result[i] = good.get(i).sq;
         }
 
         return result;

http://dive4elements.wald.intevation.org