Mercurial > dive4elements > river
view flys-backend/src/main/java/de/intevation/flys/importer/IdValueKey.java @ 502:c6889097f81f
Importer: Fix silly bug and set Hibernate session flushing back to auto.
flys-backend/trunk@1856 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 09 May 2011 00:38:13 +0000 |
parents | 04d449f7f0c9 |
children |
line wrap: on
line source
package de.intevation.flys.importer; import de.intevation.flys.model.WstColumnValue; import de.intevation.flys.model.DischargeTableValue; import de.intevation.flys.model.Range; import java.math.BigDecimal; public class IdValueKey { protected int id; protected BigDecimal a; protected BigDecimal b; public IdValueKey(WstColumnValue value) { this.id = value.getWstColumn().getId(); this.a = value.getPosition(); this.b = value.getW(); } public IdValueKey(DischargeTableValue value) { this.id = value.getDischargeTable().getId(); this.a = value.getQ(); this.b = value.getW(); } public IdValueKey(Range value) { this.id = value.getRiver().getId(); this.a = value.getA(); this.b = value.getB(); } public IdValueKey(int id, BigDecimal a, BigDecimal b) { this.id = id; this.a = a; this.b = b; } private static final int hashCode(BigDecimal d) { return d != null ? d.hashCode() : 0; } @Override public int hashCode() { return id | (hashCode(a) << 10) | (hashCode(b) << 20); } @Override public boolean equals(Object obj) { if (!(obj instanceof IdValueKey)) { return false; } IdValueKey other = (IdValueKey) obj; return !((id != other.id) || (a == null && other.a != null) || (a != null && other.a == null) || (a != null && !a.equals(other.a)) || (b == null && other.b != null) || (b != null && other.b == null) || (b != null && !b.equals(other.b))); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :