Mercurial > dive4elements > gnv-client
view gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultFIS.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 | 9b9bf42b7928 |
children | feae2f9d6c6f |
line wrap: on
line source
package de.intevation.gnv.artifacts.services.requestobjects; import java.util.Collection; import java.util.Iterator; /** * The default implementation of <code>Fis</code>. * * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class DefaultFIS implements FIS { private String id = null; private Collection<Parameter> parameter = null; /** * Constructor * * @param id The id for this fis. */ public DefaultFIS(String id){ super(); this.id = id; } /** * Constructor * @param id The id for this fis. * @param parameter A collection of parameters. */ public DefaultFIS(String id, Collection<Parameter> parameter) { this(id); this.parameter = parameter; } /** * @return the id. */ public String getID() { return this.id; } /** * @return the parameter collection. */ public Collection<Parameter> getParameter() { return this.parameter; } /** * Two objects are equal if they have the same id. * * @param arg0 Object which is checked for equality. * @return True, if both objects are equal, otherwise false. */ @Override public boolean equals(Object arg0) { boolean returnValue = false; if (arg0 instanceof FIS){ returnValue = this.id.equals(((FIS)arg0).getID()); } return returnValue; } /** * Creates a hash code using the id and the given parameters. * * @return A hash code. */ @Override public int hashCode() { int hash = 7; hash = 47 * hash + (this.id != null ? this.id.hashCode() : 0); hash = 47 * hash + (this.parameter != null ? this.parameter.hashCode() : 0); return hash; } /** * @param parameter Collection of parameters. */ public void addParameter(Collection<Parameter> parameter) { if (this.parameter != null){ Iterator<Parameter> it = parameter.iterator(); while (it.hasNext()){ Parameter tmpParameter = it.next(); if (!this.parameter.contains(tmpParameter)){ this.parameter.add(tmpParameter); } } }else{ this.parameter = parameter; } } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :