comparison flys-backend/src/main/java/de/intevation/flys/importer/WstColumnValueKey.java @ 478:db430bd9e0e0

Implemented a WstColumnValue cache to speed up inserting WST files into database. flys-backend/trunk@1734 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 20 Apr 2011 07:21:03 +0000
parents
children
comparison
equal deleted inserted replaced
477:0addc2663a4d 478:db430bd9e0e0
1 package de.intevation.flys.importer;
2
3 import de.intevation.flys.model.WstColumnValue;
4
5
6 public class WstColumnValueKey {
7
8 protected int wstColumnId;
9 protected double position;
10 protected double w;
11
12
13 public WstColumnValueKey(WstColumnValue value) {
14 this.wstColumnId = value.getWstColumn().getId();
15 this.position = value.getPosition().doubleValue();
16 this.w = value.getW().doubleValue();
17 }
18
19
20 public WstColumnValueKey(int wstColumnId, double position, double w) {
21 this.wstColumnId = wstColumnId;
22 this.position = position;
23 this.w = w;
24 }
25
26
27 public int hashCode() {
28 int a = new Integer(wstColumnId).hashCode();
29 int b = new Double(position).hashCode();
30 int c = new Double(w).hashCode();
31
32 return (a ^ (b << 3) ^ (c << 6));
33 }
34
35
36 public boolean equals(Object obj) {
37 if (!(obj instanceof WstColumnValueKey)) {
38 return false;
39 }
40
41 WstColumnValueKey other = (WstColumnValueKey) obj;
42
43 if (this.wstColumnId != other.wstColumnId) {
44 return false;
45 }
46 else if (this.position != other.position) {
47 return false;
48 }
49 else if (this.w != other.w) {
50 return false;
51 }
52
53 return true;
54 }
55 }
56 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org