comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/sq/OutlierMethod.java @ 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
children
comparison
equal deleted inserted replaced
5394:9207142726b3 5395:5a55c5372fe1
1 package de.intevation.flys.artifacts.states.sq;
2
3 import org.apache.log4j.Logger;
4 import org.w3c.dom.Element;
5
6 import de.intevation.artifactdatabase.ProtocolUtils;
7 import de.intevation.artifacts.Artifact;
8 import de.intevation.artifacts.CallContext;
9 import de.intevation.artifacts.CallMeta;
10 import de.intevation.artifacts.common.utils.XMLUtils;
11 import de.intevation.flys.artifacts.resources.Resources;
12 import de.intevation.flys.artifacts.states.DefaultState;
13
14
15 public class OutlierMethod
16 extends DefaultState
17 {
18 /** The logger that is used in this class.*/
19 private static Logger logger = Logger.getLogger(OutlierMethod.class);
20
21 public static final String STD_DEV = "outlier.method.std-dev";
22 public static final String GRUBBS = "outlier.method.grubbs";
23
24 public static final String[] METHODS = {
25 STD_DEV,
26 GRUBBS,
27 };
28
29
30 @Override
31 protected String getUIProvider() {
32 return "";
33 }
34
35 @Override
36 protected Element[] createItems(
37 XMLUtils.ElementCreator cr,
38 Artifact artifact,
39 String name,
40 CallContext context)
41 {
42 CallMeta meta = context.getMeta();
43
44 Element[] methods = new Element[METHODS.length];
45
46 int i = 0;
47
48 for (String method: METHODS) {
49 methods[i++] = createItem(
50 cr, new String[] {
51 Resources.getMsg(meta, method, method),
52 method
53 });
54 }
55
56 return methods;
57 }
58
59
60 @Override
61 protected Element createItem(XMLUtils.ElementCreator cr, Object obj) {
62 Element item = ProtocolUtils.createArtNode(cr, "item", null, null);
63 Element label = ProtocolUtils.createArtNode(cr, "label", null, null);
64 Element value = ProtocolUtils.createArtNode(cr, "value", null, null);
65
66 String[] arr = (String[]) obj;
67
68 label.setTextContent(arr[0]);
69 value.setTextContent(arr[1]);
70
71 item.appendChild(label);
72 item.appendChild(value);
73
74 return item;
75 }
76 }

http://dive4elements.wald.intevation.org