Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/StaticSedimentLoadCacheKey.java @ 5785:d38004f0c52f
Datacage: Always clone XML template for builders. If the first is not cloned they get interlinked somehow. Feels like a bug in Java's DOM implementation.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Mon, 22 Apr 2013 17:01:17 +0200 |
parents | 3937c6a85db4 |
children |
rev | line source |
---|---|
4296
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
2 |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
3 import org.apache.commons.lang.builder.HashCodeBuilder; |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
4 |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
5 |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
6 public class StaticSedimentLoadCacheKey |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
7 { |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 public static final String CACHE_NAME = "sedimentload-value-table-static"; |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 private String river; |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 private double startKm; |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 private double endKm; |
4370
6a65e7ef43c0
Updated data object and factory for sediment load.
Raimund Renkert <rrenkert@intevation.de>
parents:
4296
diff
changeset
|
13 private int sYear; |
6a65e7ef43c0
Updated data object and factory for sediment load.
Raimund Renkert <rrenkert@intevation.de>
parents:
4296
diff
changeset
|
14 private int eYear; |
4296
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 public StaticSedimentLoadCacheKey( |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 String river, |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 double startKm, |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 double endKm, |
4370
6a65e7ef43c0
Updated data object and factory for sediment load.
Raimund Renkert <rrenkert@intevation.de>
parents:
4296
diff
changeset
|
20 int sYear, |
6a65e7ef43c0
Updated data object and factory for sediment load.
Raimund Renkert <rrenkert@intevation.de>
parents:
4296
diff
changeset
|
21 int eYear |
4296
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 ) { |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 this.river = river; |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 this.startKm = startKm; |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 this.endKm = endKm; |
4370
6a65e7ef43c0
Updated data object and factory for sediment load.
Raimund Renkert <rrenkert@intevation.de>
parents:
4296
diff
changeset
|
26 this.sYear = sYear; |
6a65e7ef43c0
Updated data object and factory for sediment load.
Raimund Renkert <rrenkert@intevation.de>
parents:
4296
diff
changeset
|
27 this.eYear = eYear; |
4296
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 } |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 |
4382
3937c6a85db4
Removed superfluous imports.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4370
diff
changeset
|
30 @Override |
4296
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 public int hashCode() { |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 HashCodeBuilder builder = new HashCodeBuilder(); |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 builder.append(river); |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 builder.append(startKm); |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 builder.append(endKm); |
4370
6a65e7ef43c0
Updated data object and factory for sediment load.
Raimund Renkert <rrenkert@intevation.de>
parents:
4296
diff
changeset
|
36 builder.append(sYear); |
6a65e7ef43c0
Updated data object and factory for sediment load.
Raimund Renkert <rrenkert@intevation.de>
parents:
4296
diff
changeset
|
37 builder.append(eYear); |
4296
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 return builder.toHashCode(); |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 } |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 |
4382
3937c6a85db4
Removed superfluous imports.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4370
diff
changeset
|
41 @Override |
4296
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 public boolean equals(Object other) { |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 if (!(other instanceof StaticBedHeightCacheKey)) { |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 return false; |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 } |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 StaticSedimentLoadCacheKey o = (StaticSedimentLoadCacheKey) other; |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 return this.river == o.river && |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 this.startKm == o.startKm && |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 this.endKm == o.endKm && |
4370
6a65e7ef43c0
Updated data object and factory for sediment load.
Raimund Renkert <rrenkert@intevation.de>
parents:
4296
diff
changeset
|
50 this.sYear == o.sYear && |
6a65e7ef43c0
Updated data object and factory for sediment load.
Raimund Renkert <rrenkert@intevation.de>
parents:
4296
diff
changeset
|
51 this.eYear == o.eYear; |
4296
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
52 } |
3051bc28ac43
Added data object and factory for sediment load calculation.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 } |