changeset 5395:5a55c5372fe1

Added new state for outlier test method. Methods are 'grubbs' or 'std-dev'.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 25 Mar 2013 12:35:08 +0100
parents 9207142726b3
children aaf810d4ec82
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/sq/OutlierMethod.java
diffstat 1 files changed, 76 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /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;
+    }
+}

http://dive4elements.wald.intevation.org