Mercurial > dive4elements > river
changeset 3597:deeda39ef01b
Shortend overlong line. Simplified code.
flys-artifacts/trunk@5219 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 16 Aug 2012 11:40:56 +0000 |
parents | 6aea625190da |
children | a1cdf8be9fd0 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java |
diffstat | 2 files changed, 17 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Thu Aug 16 09:49:21 2012 +0000 +++ b/flys-artifacts/ChangeLog Thu Aug 16 11:40:56 2012 +0000 @@ -1,3 +1,8 @@ +2012-08-16 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java: + Shorten overlong lines. Simplified code. + 2012-08-16 Felix Wolfsteller <felix.wolfsteller@intevation.de> * src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java Thu Aug 16 09:49:21 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java Thu Aug 16 11:40:56 2012 +0000 @@ -68,17 +68,17 @@ } WQKms [] wqkms = getWQKms(res); - if (context.getContextValue("currentKm") != null) { + Object KM = context.getContextValue("currentKm"); + if (KM != null) { logger.debug("interpolate at given km"); // TODO handle exact match. WQKms wqkmsI = wqkms[index]; - double km = ((Double)context.getContextValue("currentKm")).doubleValue(); + double km = (Double)KM; // TODO employ DataUtils interface to TDoubleArraList int size = wqkmsI.size(); - boolean kmIncreasing = (wqkmsI.getKm(0) < wqkmsI.getKm(wqkmsI.size()-1)) - ? true : false; + boolean kmIncreasing = wqkmsI.getKm(0) < wqkmsI.getKm(size-1); int mod = kmIncreasing ? +1 : -1; int idx = 0; if (!kmIncreasing) { @@ -94,8 +94,14 @@ } WQKms resultWQKms = new WQKms(); if (idx != -1 && idx < size) { - double inW = Linear.linear(km, wqkmsI.getKm(idx), wqkmsI.getKm(idx-mod), wqkmsI.getW(idx), wqkmsI.getW(idx-mod)); - double inQ = Linear.linear(km, wqkmsI.getKm(idx),wqkmsI.getKm(idx-mod), wqkmsI.getQ(idx), wqkmsI.getQ(idx-mod)); + double inW = Linear.linear( + km, + wqkmsI.getKm(idx), wqkmsI.getKm(idx-mod), + wqkmsI.getW(idx), wqkmsI.getW(idx-mod)); + double inQ = Linear.linear( + km, + wqkmsI.getKm(idx), wqkmsI.getKm(idx-mod), + wqkmsI.getQ(idx), wqkmsI.getQ(idx-mod)); resultWQKms.add(inW, inQ, km); } return resultWQKms;