comparison flys-backend/src/main/java/de/intevation/flys/importer/IdValueKey.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 d50cd3a632e0
children
comparison
equal deleted inserted replaced
500:d50cd3a632e0 501:04d449f7f0c9
40 40
41 private static final int hashCode(BigDecimal d) { 41 private static final int hashCode(BigDecimal d) {
42 return d != null ? d.hashCode() : 0; 42 return d != null ? d.hashCode() : 0;
43 } 43 }
44 44
45 @Override
45 public int hashCode() { 46 public int hashCode() {
46 return id | (hashCode(a) << 10) | (hashCode(b) << 20); 47 return id | (hashCode(a) << 10) | (hashCode(b) << 20);
47 } 48 }
48 49
49 50 @Override
50 public boolean equals(Object obj) { 51 public boolean equals(Object obj) {
51 if (!(obj instanceof IdValueKey)) { 52 if (!(obj instanceof IdValueKey)) {
52 return false; 53 return false;
53 } 54 }
54 55
55 IdValueKey other = (IdValueKey) obj; 56 IdValueKey other = (IdValueKey) obj;
56 57
57 return !((id != other.id) 58 return !((id != other.id)
58 || (a == null && other.a != null) 59 || (a == null && other.a != null)
59 || (a != null && other.a == null) 60 || (a != null && other.a == null)
60 || (a != null && !a.equals(other)) 61 || (a != null && !a.equals(other.a))
61 || (b == null && other.b != null) 62 || (b == null && other.b != null)
62 || (b != null && other.b == null) 63 || (b != null && other.b == null)
63 || (b != null && !b.equals(other))); 64 || (b != null && !b.equals(other.b)));
64 } 65 }
65 } 66 }
66 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 67 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org