diff flys-backend/src/main/java/de/intevation/flys/importer/ValueKey.java @ 501:04d449f7f0c9

Importer: Change caching strategy not to cause OOM any more. flys-backend/trunk@1855 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 09 May 2011 00:15:45 +0000
parents
children bcc18293a547
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ValueKey.java	Mon May 09 00:15:45 2011 +0000
@@ -0,0 +1,39 @@
+package de.intevation.flys.importer;
+
+import java.math.BigDecimal;
+
+public class ValueKey
+{
+    protected BigDecimal a;
+    protected BigDecimal b;
+
+    public ValueKey() {
+    }
+
+    public ValueKey(BigDecimal a, BigDecimal b) {
+        this.a = a;
+        this.b = b;
+    }
+
+    @Override
+    public int hashCode() {
+        return ((a != null ? a.hashCode() : 0) << 16)
+              | (b != null ? b.hashCode() : 0);
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (!(other instanceof ValueKey)) {
+            return false;
+        }
+        ValueKey o = (ValueKey)other;
+        return !(
+               (a == null && o.a != null) 
+            || (a != null && o.a == null) 
+            || (a != null && !a.equals(o.a)) 
+            || (b == null && o.b != null) 
+            || (b != null && o.b == null)
+            || (b != null && !b.equals(o.b)));
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org