changeset 8151:a709e6334c4a

IDs can be assumed to be unique.
author Tom Gottfried <tom@intevation.de>
date Thu, 28 Aug 2014 18:42:20 +0200
parents fe67edde6189
children 03ea636429ea
files artifacts/src/main/java/org/dive4elements/river/artifacts/BedHeightsArtifact.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/StaticBedHeightCacheKey.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/StaticSedimentLoadCacheKey.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFactory.java
diffstat 6 files changed, 9 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/BedHeightsArtifact.java	Thu Aug 28 15:34:57 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/BedHeightsArtifact.java	Thu Aug 28 18:42:20 2014 +0200
@@ -120,7 +120,6 @@
                     bedHName = Resources.getMsg(
                         callMeta,
                         "facet.bedheight.sounding_width",
-                        "facet.bedheight.sounding_widt",
                         new Object[] { bedHName });
                     facet = new BedHeightSoundingWidthFacet(facetType, bedHName);
                 }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/StaticBedHeightCacheKey.java	Thu Aug 28 15:34:57 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * This file is Free Software under the GNU AGPL (>=v3)
- * and comes with ABSOLUTELY NO WARRANTY! Check out the
- * documentation coming with Dive4Elements River for details.
- */
-
-package org.dive4elements.river.artifacts.model;
-
-import java.io.Serializable;
-
-public class StaticBedHeightCacheKey implements Serializable {
-    public static final String CACHE_NAME = "bedheight-value-table-static";
-
-    private int time;
-    private int height_id;
-
-    public StaticBedHeightCacheKey(int column, int wst_id) {
-        this.height_id  = wst_id;
-        this.time  = column;
-    }
-
-    public int hashCode() {
-        return (height_id << 8) | time;
-    }
-
-    public boolean equals(Object other) {
-        if (!(other instanceof StaticBedHeightCacheKey)) {
-            return false;
-        }
-        StaticBedHeightCacheKey o = (StaticBedHeightCacheKey) other;
-        return this.height_id == o.height_id && this.time == o.time;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/StaticSedimentLoadCacheKey.java	Thu Aug 28 15:34:57 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/StaticSedimentLoadCacheKey.java	Thu Aug 28 18:42:20 2014 +0200
@@ -48,7 +48,7 @@
 
     @Override
     public boolean equals(Object other) {
-        if (!(other instanceof StaticBedHeightCacheKey)) {
+        if (!(other instanceof StaticSedimentLoadCacheKey)) {
             return false;
         }
         StaticSedimentLoadCacheKey o = (StaticSedimentLoadCacheKey) other;
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java	Thu Aug 28 15:34:57 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java	Thu Aug 28 18:42:20 2014 +0200
@@ -65,8 +65,8 @@
     /** Get two BedHeights from factory. */
     private static BedHeightData [] getHeightPair(int [] ids, String type) {
         return new BedHeightData [] {
-            BedHeightFactory.getHeight(type, ids[0], 0),
-            BedHeightFactory.getHeight(type, ids[1], 0)
+            BedHeightFactory.getHeight(type, ids[0]),
+            BedHeightFactory.getHeight(type, ids[1])
         };
     }
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFacet.java	Thu Aug 28 15:34:57 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFacet.java	Thu Aug 28 18:42:20 2014 +0200
@@ -77,8 +77,7 @@
              * @return {@link BedHeight} */
             BedHeightData data = BedHeightFactory.getHeight(
                 access.getType(),
-                access.getHeightId(),
-                access.getTime());
+                access.getHeightId());
             //data.removeNaNs();
             TDoubleArrayList stations= data.getStations();
             double[][] values = new double[2][stations.size()];
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFactory.java	Thu Aug 28 15:34:57 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFactory.java	Thu Aug 28 18:42:20 2014 +0200
@@ -51,14 +51,13 @@
     /**
      * Get BedHeightData for given type and height_id, caring about the cache.
      */
-    public static BedHeightData getHeight(String type, int height_id, int time) {
+    public static BedHeightData getHeight(String type, int height_id) {
         log.debug("BedHeightFactory.getHeight");
-        Cache cache = CacheFactory.getCache(StaticBedHeightCacheKey.CACHE_NAME);
+        Cache cache = CacheFactory.getCache("bedheight-value-table-static");
 
-        StaticBedHeightCacheKey cacheKey;
+        String cacheKey = Integer.toString(height_id);
 
         if (cache != null) {
-            cacheKey = new StaticBedHeightCacheKey(height_id, time);
             Element element = cache.get(cacheKey);
             if (element != null) {
                 log.debug("Got static bedheight values from cache");
@@ -69,7 +68,7 @@
             cacheKey = null;
         }
 
-        BedHeightData values = getBedHeightUncached(type, height_id, time);
+        BedHeightData values = getBedHeightUncached(type, height_id);
 
         if (values != null && cacheKey != null) {
             log.debug("Store static bed height values in cache.");
@@ -111,8 +110,7 @@
      */
     public static BedHeightData getBedHeightUncached(
         String type,
-        int height_id,
-        int time)
+        int height_id)
     {
         if (log.isDebugEnabled()) {
             log.debug("BedHeightFactory.getBedHeightUncached");

http://dive4elements.wald.intevation.org