Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/exports/StringArrayKey.java @ 1145:dfe1ac687c7f tip
added tags
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:16:15 +0200 |
parents | f953c9a559d8 |
children |
rev | line source |
---|---|
1115
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1034
diff
changeset
|
1 /* |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1034
diff
changeset
|
2 * Copyright (c) 2010 by Intevation GmbH |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1034
diff
changeset
|
3 * |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1034
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1034
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1034
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1034
diff
changeset
|
7 */ |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1034
diff
changeset
|
8 |
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
|
9 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
|
10 /** |
803
feae2f9d6c6f
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
800
diff
changeset
|
11 * 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
|
12 * 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
|
13 * |
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
|
14 * @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
|
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 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
|
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 /** |
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 * 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
|
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 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
|
23 |
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 * 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
|
26 */ |
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 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
|
28 |
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 /** |
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 * 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
|
31 * @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
|
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 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
|
34 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
|
35 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
|
36 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
|
37 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
|
38 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
|
39 } |
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 } |
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 } |
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 /** |
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 * @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
|
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 @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
|
47 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
|
48 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
|
49 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
|
50 } |
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 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
|
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 * @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
|
56 */ |
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 @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
|
58 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
|
59 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
|
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 |
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
|
62 /** |
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
|
63 * 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
|
64 * @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
|
65 */ |
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
|
66 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
|
67 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
|
68 } |
1034
50a5ce7a47b7
Implemented an odv exporter for product type 'Horizontales Schnittprofil' (issue260).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
803
diff
changeset
|
69 |
50a5ce7a47b7
Implemented an odv exporter for product type 'Horizontales Schnittprofil' (issue260).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
803
diff
changeset
|
70 public String getKey() { |
50a5ce7a47b7
Implemented an odv exporter for product type 'Horizontales Schnittprofil' (issue260).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
803
diff
changeset
|
71 return key; |
50a5ce7a47b7
Implemented an odv exporter for product type 'Horizontales Schnittprofil' (issue260).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
803
diff
changeset
|
72 } |
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
|
73 } |