Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/StaticWQKmsCacheKey.java @ 8876:23264d1a528f
Allow access to staticwqkms data; also allow to acces by km range
author | gernotbelger |
---|---|
date | Thu, 08 Feb 2018 18:47:36 +0100 |
parents | 26c7aa469bfc |
children |
comparison
equal
deleted
inserted
replaced
8875:8d1df8639563 | 8876:23264d1a528f |
---|---|
8 | 8 |
9 package org.dive4elements.river.artifacts.model; | 9 package org.dive4elements.river.artifacts.model; |
10 | 10 |
11 import java.io.Serializable; | 11 import java.io.Serializable; |
12 | 12 |
13 import org.apache.commons.lang.builder.EqualsBuilder; | |
14 import org.apache.commons.lang.builder.HashCodeBuilder; | |
15 | |
13 /** | 16 /** |
14 * Caching-Key object for 'static' wst- data. | 17 * Caching-Key object for 'static' wst- data. |
15 */ | 18 */ |
16 public final class StaticWQKmsCacheKey | 19 public final class StaticWQKmsCacheKey |
17 implements Serializable | 20 implements Serializable |
18 { | 21 { |
19 public static final String CACHE_NAME = "wst-wq-value-table-static"; | 22 public static final String CACHE_NAME = "wst-wq-value-table-static"; |
20 | 23 |
21 private int column; | 24 private final int column; |
22 private int wst_id; | 25 |
26 private final int wst_id; | |
23 | 27 |
24 public StaticWQKmsCacheKey(int column, int wst_id) { | 28 private double from; |
29 | |
30 private double to; | |
31 | |
32 private int hash; | |
33 | |
34 public StaticWQKmsCacheKey(final int column, final int wst_id, final double from, final double to) { | |
25 this.wst_id = wst_id; | 35 this.wst_id = wst_id; |
26 this.column = column; | 36 this.column = column; |
37 this.from = from; | |
38 this.to = to; | |
39 this.hash = new HashCodeBuilder().append(column).append(wst_id).append(false).append(to).toHashCode(); | |
27 } | 40 } |
28 | 41 |
42 @Override | |
29 public int hashCode() { | 43 public int hashCode() { |
30 return (wst_id << 8) | column; | 44 return this.hash; |
31 } | 45 } |
32 | 46 |
33 public boolean equals(Object other) { | 47 @Override |
34 if (!(other instanceof StaticWQKmsCacheKey)) { | 48 public boolean equals(final Object other) { |
49 | |
50 if (other == null) | |
35 return false; | 51 return false; |
52 if( other == this) | |
53 return true; | |
54 if (other.getClass() != getClass()) { | |
55 return false; | |
36 } | 56 } |
37 StaticWQKmsCacheKey o = (StaticWQKmsCacheKey) other; | 57 |
38 return this.wst_id == o.wst_id && this.column == o.column; | 58 final StaticWQKmsCacheKey rhs = (StaticWQKmsCacheKey) other; |
59 | |
60 return new EqualsBuilder(). // | |
61 append(column, rhs.column). // | |
62 append(wst_id, rhs.wst_id). // | |
63 append(from, rhs.from). // | |
64 append(to, rhs.to). // | |
65 isEquals(); | |
39 } | 66 } |
40 } | 67 } |
41 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 68 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |