comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultInputData.java @ 634:58c32df1a44d

Improved the describe document so that we are able to render a measurement-parameter-matrix with these data. gnv-artifacts/trunk@713 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 26 Feb 2010 13:53:05 +0000
parents 01054ddccb0f
children c4156275c1e1
comparison
equal deleted inserted replaced
633:7a136b99ad71 634:58c32df1a44d
1 /**
2 *
3 */
4 package de.intevation.gnv.state; 1 package de.intevation.gnv.state;
5 2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 import org.apache.log4j.Logger;
7
6 /** 8 /**
7 * @author Tim Englich <tim.englich@intevation.de> 9 * @author Tim Englich (tim.englich@intevation.de)
8 * 10 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de)
9 */ 11 */
10 public class DefaultInputData implements InputData { 12 public class DefaultInputData implements InputData {
11 13
12 /** 14 /**
13 * 15 *
14 */ 16 */
15 private static final long serialVersionUID = 4308041648698108066L; 17 private static final long serialVersionUID = 4308041648698108066L;
16 18
19 private static final Logger logger = Logger.getLogger(DefaultInputData.class);
20
17 private final static String VALUE_SEPARATOR = " , "; 21 private final static String VALUE_SEPARATOR = " , ";
18 22
19 protected String name; 23 protected String name;
20 protected String value; 24 protected String value;
21 protected String[] description; 25 protected Map description;
22 protected Object object; 26 protected Object object;
23 27
24 28
25 /** 29 /**
26 * Constructor 30 * Constructor
27 */ 31 */
28 public DefaultInputData(String name, String value) { 32 public DefaultInputData(String name, String value) {
55 59
56 public Object getObject() { 60 public Object getObject() {
57 return object; 61 return object;
58 } 62 }
59 63
64 public String getDescription(String key) {
65 if (description == null)
66 return null;
67
68 return (String) description.get(key);
69 }
70
60 public String[] getDescription() { 71 public String[] getDescription() {
72 String[] values = splitValue();
73 int length = values.length;
74
75 String[] description = new String[length];
76 for (int i = 0; i < length; i++) {
77 description[i] = (String) this.description.get(values[i]);
78 }
79
61 return description; 80 return description;
62 } 81 }
63 82
64 public void setDescription(String[] description) { 83 public void setDescription(String[] description) {
65 this.description = description; 84 if (this.description == null)
85 this.description = new HashMap();
86
87 String[] values = splitValue();
88
89 int length = values.length;
90 int descLength = description.length;
91
92 for (int i = 0; i < length; i++) {
93 if (i < descLength) {
94 this.description.put(values[i], description[i]);
95 }
96 else {
97 break;
98 }
99 }
66 } 100 }
67 101
68 /** 102 /**
69 * @see java.lang.Object#toString() 103 * @see java.lang.Object#toString()
70 */ 104 */

http://dive4elements.wald.intevation.org