Mercurial > dive4elements > gnv-client
view gnv-artifacts/src/main/java/de/intevation/gnv/exports/StringArrayKey.java @ 1139:3a28fef65500
dummy merge for repo head
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:15:16 +0200 |
parents | f953c9a559d8 |
children |
line wrap: on
line source
/* * Copyright (c) 2010 by Intevation GmbH * * This program is free software under the LGPL (>=v2.1) * Read the file LGPL.txt coming with the software for details * or visit http://www.gnu.org/licenses/ if it does not exist. */ 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; } public String getKey() { return key; } }