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