Mercurial > dive4elements > river
changeset 8065:fdb26fe898dc
Sediment load: Cached sediment values dont depend on year. The cached object is an index over year so there is not need to ask the factory for this.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Wed, 30 Jul 2014 19:06:35 +0200 |
parents | 50102c41151e |
children | fe5ef780f8b1 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensity.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensityFactory.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadCalculation.java |
diffstat | 3 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensity.java Wed Jul 30 18:54:14 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensity.java Wed Jul 30 19:06:35 2014 +0200 @@ -12,7 +12,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -83,7 +82,9 @@ public void addDensity(double km, double density, int year) { - logger.debug("adding " + year); + if (logger.isDebugEnabled()) { + logger.debug("adding " + year); + } Integer key = Integer.valueOf(year); @@ -142,6 +143,7 @@ return getDensityAtKm(current.getValue(), km); } } + return SEDIMNET_DENSITY_FACTOR; }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensityFactory.java Wed Jul 30 18:54:14 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensityFactory.java Wed Jul 30 19:06:35 2014 +0200 @@ -67,15 +67,14 @@ public static SedimentDensity getSedimentDensity( String river, double startKm, - double endKm, - int year + double endKm ) { log.debug("getSedimentDensity"); Cache cache = CacheFactory.getCache(DENSITY_CACHE_NAME); if (cache == null) { log.debug("Cache not configured."); - return getSedimentDensityUncached(river, startKm, endKm, year); + return getSedimentDensityUncached(river, startKm, endKm); } String key = river + startKm + endKm; @@ -85,7 +84,7 @@ return (SedimentDensity)element.getValue(); } SedimentDensity value = - getSedimentDensityUncached(river, startKm, endKm, year); + getSedimentDensityUncached(river, startKm, endKm); if (value != null && key != null) { log.debug("Store sediment density values in cache."); @@ -98,8 +97,7 @@ private static SedimentDensity getSedimentDensityUncached( String river, double startKm, - double endKm, - int year + double endKm ) { log.debug("getSedimentDensityUncached"); Session session = SessionHolder.HOLDER.get();
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadCalculation.java Wed Jul 30 18:54:14 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadCalculation.java Wed Jul 30 19:06:35 2014 +0200 @@ -523,7 +523,7 @@ */ private SedimentLoadLSData calculateUnit(SedimentLoadLSData load, int year) { SedimentDensity density = - SedimentDensityFactory.getSedimentDensity(river, kmLow, kmUp, year); + SedimentDensityFactory.getSedimentDensity(river, kmLow, kmUp); for (double km: load.getKms()) { double dens = 1d/density.getDensity(km, year);