[Dive4elements-commits] [PATCH 1 of 3] Added new state for outlier test method. Methods are 'grubbs' or 'std-dev'

Wald Commits scm-commit at wald.intevation.org
Mon Mar 25 12:41:13 CET 2013


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1364211308 -3600
# Node ID 5a55c5372fe16c4cef8e0516ccb2e0f0e98fb1a7
# Parent  9207142726b3bab9981a74301a45b5b5562c0b18
Added new state for outlier test method. Methods are 'grubbs' or 'std-dev'.

diff -r 9207142726b3 -r 5a55c5372fe1 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/sq/OutlierMethod.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/sq/OutlierMethod.java	Mon Mar 25 12:35:08 2013 +0100
@@ -0,0 +1,76 @@
+package de.intevation.flys.artifacts.states.sq;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+
+import de.intevation.artifactdatabase.ProtocolUtils;
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.flys.artifacts.resources.Resources;
+import de.intevation.flys.artifacts.states.DefaultState;
+
+
+public class OutlierMethod
+extends DefaultState
+{
+    /** The logger that is used in this class.*/
+    private static Logger logger = Logger.getLogger(OutlierMethod.class);
+
+    public static final String STD_DEV   = "outlier.method.std-dev";
+    public static final String GRUBBS = "outlier.method.grubbs";
+
+    public static final String[] METHODS = {
+        STD_DEV,
+        GRUBBS,
+  };
+
+
+    @Override
+    protected String getUIProvider() {
+        return "";
+    }
+
+    @Override
+    protected Element[] createItems(
+        XMLUtils.ElementCreator cr,
+        Artifact    artifact,
+        String      name,
+        CallContext context)
+    {
+        CallMeta meta = context.getMeta();
+
+        Element[] methods = new Element[METHODS.length];
+
+        int i = 0;
+
+        for (String method: METHODS) {
+            methods[i++] = createItem(
+                cr, new String[] {
+                    Resources.getMsg(meta, method, method),
+                    method
+                });
+        }
+
+        return methods;
+    }
+
+
+    @Override
+    protected Element createItem(XMLUtils.ElementCreator cr, Object obj) {
+        Element item  = ProtocolUtils.createArtNode(cr, "item", null, null);
+        Element label = ProtocolUtils.createArtNode(cr, "label", null, null);
+        Element value = ProtocolUtils.createArtNode(cr, "value", null, null);
+
+        String[] arr = (String[]) obj;
+
+        label.setTextContent(arr[0]);
+        value.setTextContent(arr[1]);
+
+        item.appendChild(label);
+        item.appendChild(value);
+
+        return item;
+    }
+}


More information about the Dive4elements-commits mailing list