Mercurial > dive4elements > river
changeset 1661:a890bf077de5
Use StringUtil.wWrap , fix wrong loop, minor refac and cosmetics.
flys-artifacts/trunk@2860 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 28 Sep 2011 15:47:57 +0000 |
parents | 804c58c56422 |
children | a800994aed1e |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WDifferencesState.java |
diffstat | 2 files changed, 12 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Wed Sep 28 15:37:59 2011 +0000 +++ b/flys-artifacts/ChangeLog Wed Sep 28 15:47:57 2011 +0000 @@ -1,3 +1,8 @@ +2011-09-28 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/states/WDifferencesState.java: + Use StringUtil.wWrap , fix wrong loop, minor refac and cosmetics. + 2011-09-28 Felix Wolfsteller <felix.wolfsteller@intevation.de> * src/main/java/de/intevation/flys/artifacts/states/WaterlevelSelectState.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WDifferencesState.java Wed Sep 28 15:37:59 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WDifferencesState.java Wed Sep 28 15:47:57 2011 +0000 @@ -82,7 +82,8 @@ // Load the Artifacts/facets that we want to subtract and display. // Expected format is: // [42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;0]#[1231f2-....] - String datas[] = winfo.getDataAsString("diffids").split("#"); + String diffids = winfo.getDataAsString("diffids"); + String datas[] = diffids.split("#"); // Validate the Data-Strings. for (String s: datas) { @@ -98,7 +99,7 @@ List<WKms> wkmss = new ArrayList<WKms>(); - for(int i = 0; i < datas.length /2; i++) { + for(int i = 0; i < datas.length; i+=2) { // e.g.: // 42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;1 String[] def1 = StringUtil.unbracket(datas[i+0]).split(";"); @@ -125,18 +126,15 @@ String facetName = "diff ()"; if (flys1 != null && flys2 != null) { - // TODO Also check size. - // TODO Also need index of wqkms. WQKms[] minuend = (WQKms[]) flys1.getWaterlevelData(). getData(); WQKms[] subtrahend = (WQKms[]) flys2.getWaterlevelData(). getData(); - if (datas.length > 2) { - logger.error("Cannot keep more than one calculation."); - } - facetName = "W (" + minuend[idx1].getName() + ") - W (" + subtrahend[idx2].getName() + ")"; - WKms wkms = WKmsOperation.SUBTRACTION.operate(minuend[idx1], subtrahend[idx2]); + facetName = StringUtil.wWrap(minuend[idx1].getName()) + + " - " + StringUtil.wWrap(subtrahend[idx2].getName()); + WKms wkms = WKmsOperation.SUBTRACTION.operate(minuend[idx1], + subtrahend[idx2]); wkms.setName(facetName); wkmss.add(wkms); logger.debug("WKMSSubtraction happened");