diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/StringArrayKey.java	Tue Apr 06 13:07:11 2010 +0000
@@ -0,0 +1,61 @@
+package de.intevation.gnv.exports;
+/**
+ * A simple Key Class for generating an syntetic key using the 
+ * values of the given Stringarray and not the Hash of the Stringarray
+ * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class StringArrayKey {
+
+    /**
+     * The Stringarray which contains the Values.
+     */
+    private String[] value = null;
+
+    /**
+     * The Key which should be used to compare the Stringarrays.
+     */
+    private String key = null;
+
+    /**
+     * Constructor
+     * @param value the Value which should be used to generate the key
+     */
+    public StringArrayKey(String[] value) {
+        this.value = value;
+        if (value != null){
+            key = "";
+            for (int i = 0; i < value.length; i++){
+                key += value[i];
+            }
+        }
+    }
+
+    /**
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof StringArrayKey){
+            return (((StringArrayKey)obj).key).equals(this.key);
+        }
+        return false;
+    }
+
+    /**
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        return this.key.hashCode();
+    }
+
+    /**
+     * Returns the stored origin Values of the Key
+     * @return the stored origin Values of the Key
+     */
+    public String[] getValue() {
+        return value;
+    }
+}

http://dive4elements.wald.intevation.org