tim@800: package de.intevation.gnv.exports; tim@800: /** sascha@803: * A simple Key Class for generating an syntetic key using the tim@800: * values of the given Stringarray and not the Hash of the Stringarray sascha@803: * tim@800: * @author Tim Englich tim@800: * tim@800: */ tim@800: public class StringArrayKey { tim@800: tim@800: /** tim@800: * The Stringarray which contains the Values. tim@800: */ tim@800: private String[] value = null; tim@800: tim@800: /** tim@800: * The Key which should be used to compare the Stringarrays. tim@800: */ tim@800: private String key = null; tim@800: tim@800: /** tim@800: * Constructor tim@800: * @param value the Value which should be used to generate the key tim@800: */ tim@800: public StringArrayKey(String[] value) { tim@800: this.value = value; tim@800: if (value != null){ tim@800: key = ""; tim@800: for (int i = 0; i < value.length; i++){ tim@800: key += value[i]; tim@800: } tim@800: } tim@800: } tim@800: tim@800: /** tim@800: * @see java.lang.Object#equals(java.lang.Object) tim@800: */ tim@800: @Override tim@800: public boolean equals(Object obj) { tim@800: if (obj instanceof StringArrayKey){ tim@800: return (((StringArrayKey)obj).key).equals(this.key); tim@800: } tim@800: return false; tim@800: } tim@800: tim@800: /** tim@800: * @see java.lang.Object#hashCode() tim@800: */ tim@800: @Override tim@800: public int hashCode() { tim@800: return this.key.hashCode(); tim@800: } tim@800: tim@800: /** tim@800: * Returns the stored origin Values of the Key tim@800: * @return the stored origin Values of the Key tim@800: */ tim@800: public String[] getValue() { tim@800: return value; tim@800: } ingo@1034: ingo@1034: public String getKey() { ingo@1034: return key; ingo@1034: } tim@800: }