annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTableCacheKey.java @ 4255:670e98f5a441

Fixed leak while merging facets. The ThemeList that is used by OutputHelper to sort the Facets for an Output now uses a list to store the ManagedFacets. The correct order is made up by sorting the List using Collections.sort() function of the Java JDK. Therfore, the ManagedFacet class implements the Comparable interface. The return value of its compareTo(other) method depends on the value of the 'position' field.
author Ingo Weinzierl <weinzierl.ingo@googlemail.com>
date Thu, 25 Oct 2012 14:01:46 +0200
parents 305a338c43c2
children
rev   line source
626
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import java.io.Serializable;
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4
1928
305a338c43c2 Minor cosmetic (doc).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 632
diff changeset
5 /**
305a338c43c2 Minor cosmetic (doc).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 632
diff changeset
6 * Cache Key (identifier) for WstValueTables.
305a338c43c2 Minor cosmetic (doc).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 632
diff changeset
7 */
626
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 public final class WstValueTableCacheKey
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 implements Serializable
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 {
632
07640ab913fd First part of storing qs in ranges
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 626
diff changeset
11 public static final String CACHE_NAME = "wst-value-table";
07640ab913fd First part of storing qs in ranges
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 626
diff changeset
12
626
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 private int riverId;
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 private int kind;
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 public WstValueTableCacheKey(int riverId, int kind) {
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 this.riverId = riverId;
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 this.kind = kind;
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 }
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 public int hashCode() {
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22 return (riverId << 8) | kind;
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 }
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 public boolean equals(Object other) {
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 if (!(other instanceof WstValueTableCacheKey)) {
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 return false;
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 }
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 WstValueTableCacheKey o = (WstValueTableCacheKey)other;
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 return riverId == o.riverId && kind == o.kind;
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 }
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 }
e3ee131d5dd3 Moved WST value table cache key to a separate class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org