comparison gnv-artifacts/src/main/java/de/intevation/gnv/exports/StringArrayKey.java @ 800:db5b04ecb426

ISSUE215: Improved ODV-Export. now all Columns which have identical values but different Parameters will be merged to one row. gnv-artifacts/trunk@882 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 06 Apr 2010 13:07:11 +0000
parents
children feae2f9d6c6f
comparison
equal deleted inserted replaced
799:feeaf5aec552 800:db5b04ecb426
1 package de.intevation.gnv.exports;
2 /**
3 * A simple Key Class for generating an syntetic key using the
4 * values of the given Stringarray and not the Hash of the Stringarray
5 *
6 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
7 *
8 */
9 public class StringArrayKey {
10
11 /**
12 * The Stringarray which contains the Values.
13 */
14 private String[] value = null;
15
16 /**
17 * The Key which should be used to compare the Stringarrays.
18 */
19 private String key = null;
20
21 /**
22 * Constructor
23 * @param value the Value which should be used to generate the key
24 */
25 public StringArrayKey(String[] value) {
26 this.value = value;
27 if (value != null){
28 key = "";
29 for (int i = 0; i < value.length; i++){
30 key += value[i];
31 }
32 }
33 }
34
35 /**
36 * @see java.lang.Object#equals(java.lang.Object)
37 */
38 @Override
39 public boolean equals(Object obj) {
40 if (obj instanceof StringArrayKey){
41 return (((StringArrayKey)obj).key).equals(this.key);
42 }
43 return false;
44 }
45
46 /**
47 * @see java.lang.Object#hashCode()
48 */
49 @Override
50 public int hashCode() {
51 return this.key.hashCode();
52 }
53
54 /**
55 * Returns the stored origin Values of the Key
56 * @return the stored origin Values of the Key
57 */
58 public String[] getValue() {
59 return value;
60 }
61 }

http://dive4elements.wald.intevation.org