diff artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixRealizingCompute.java @ 9082:42c15e2f95fb

2.3.4.1.4 Wasserstand falsche Einheit FixAnalysis PDF start
author gernotbelger
date Fri, 25 May 2018 10:44:24 +0200
parents e4f9e2316e92
children 0c621beceb2f
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixRealizingCompute.java	Fri May 25 09:10:19 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixRealizingCompute.java	Fri May 25 10:44:24 2018 +0200
@@ -14,7 +14,6 @@
 import java.util.List;
 
 import org.apache.log4j.Logger;
-
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.artifacts.CallMeta;
@@ -58,26 +57,18 @@
     public FixRealizingCompute() {
     }
 
-
     @Override
-    public Object computeAdvance(
-        D4EArtifact artifact,
-        String       hash,
-        CallContext  context,
-        List<Facet>  facets,
-        Object       old
-    ) {
+    public Object computeAdvance(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) {
         log.debug("FixRealizingCompute.computeAdvance");
 
         CalculationResult res;
 
-        FixRealizingAccess access = new FixRealizingAccess(artifact);
+        final FixRealizingAccess access = new FixRealizingAccess(artifact);
 
         if (old instanceof CalculationResult) {
             res = (CalculationResult) old;
-        }
-        else {
-            FixRealizingCalculation calc = new FixRealizingCalculation(access);
+        } else {
+            final FixRealizingCalculation calc = new FixRealizingCalculation(access);
             res = calc.calculate();
         }
 
@@ -89,11 +80,11 @@
             facets.add(new ReportFacet());
         }
 
-        String   id   = getID();
-        CallMeta meta = context.getMeta();
+        final String id = getID();
+        final CallMeta meta = context.getMeta();
 
-        FixRealizingResult fixRes = (FixRealizingResult) res.getData();
-        WQKms [] wqkms = fixRes != null ? fixRes.getWQKms() : new WQKms[0];
+        final FixRealizingResult fixRes = (FixRealizingResult) res.getData();
+        final WQKms[] wqkms = fixRes != null ? fixRes.getWQKms() : new WQKms[0];
 
         for (int i = 0; i < wqkms.length; i++) {
             String nameW = null;
@@ -102,21 +93,17 @@
             if (access.isQ()) {
                 nameQ = wqkms[i].getName();
                 nameW = "W(" + nameQ + ")";
-            }
-            else {
+            } else {
                 nameW = wqkms[i].getName();
                 nameQ = "Q(" + nameW + ")";
             }
 
-            Facet wq = new FixWaterlevelFacet(
-                i, FIX_WQ_LS, nameW, ComputeType.ADVANCE, hash, id);
+            final Facet wq = new FixWaterlevelFacet(i, FIX_WQ_LS, nameW, ComputeType.ADVANCE, hash, id);
 
-            Facet w = new FixWaterlevelFacet(
-                i, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, hash, id);
+            final Facet w = new FixWaterlevelFacet(i, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, hash, id);
 
-            Facet q = new FixWaterlevelFacet(
-                i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, hash, id);
-            Facet csFacet = new CrossSectionWaterLineFacet(i, nameW);
+            final Facet q = new FixWaterlevelFacet(i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, hash, id);
+            final Facet csFacet = new CrossSectionWaterLineFacet(i, nameW);
 
             facets.add(wq);
             facets.add(w);
@@ -125,61 +112,42 @@
 
             // XXX: THIS CAN NOT HAPPEN! REMOVE IT!
             if (wqkms[i] instanceof WQCKms) {
-                String nameC = nameW.replace(
-                    "benutzerdefiniert",
-                    "benutzerdefiniert [korrigiert]");
+                final String nameC = nameW.replace("benutzerdefiniert", "benutzerdefiniert [korrigiert]");
 
-                Facet c = new FixWaterlevelFacet(
-                    i, DISCHARGE_LONGITUDINAL_C, nameC);
+                final Facet c = new FixWaterlevelFacet(i, DISCHARGE_LONGITUDINAL_C, nameC);
 
                 facets.add(c);
             }
         }
 
         if (wqkms.length > 0) {
-            DateFormat df = Formatter.getDateFormatter(context.getMeta(),
-                "dd.MM.yyyy");
-            DateFormat lf = Formatter.getDateFormatter(context.getMeta(),
-                "dd.MM.yyyy'T'HH:mm");
+            final DateFormat df = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy");
+            final DateFormat lf = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy'T'HH:mm");
 
-            Collection<Date> reds = fixRes.getReferenceEventsDates();
-            UniqueDateFormatter cf = new UniqueDateFormatter(df, lf, reds);
+            final Collection<Date> reds = fixRes.getReferenceEventsDates();
+            final UniqueDateFormatter cf = new UniqueDateFormatter(df, lf, reds);
 
             int i = 0;
-            for (Date d: reds) {
-                facets.add(new FixReferenceEventsFacet(
-                        (1 << 9) | i,
-                    FIX_EVENTS,
-                    cf.format(d)));
+            for (final Date d : reds) {
+                facets.add(new FixReferenceEventsFacet((1 << 9) | i, FIX_EVENTS, cf.format(d)));
                 i++;
             }
 
-            facets.add(
-                new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id));
+            facets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id));
 
-            facets.add(
-                new DataFacet(WST, "WST data", ComputeType.ADVANCE, hash, id));
+            facets.add(new DataFacet(WST, "WST data", ComputeType.ADVANCE, hash, id));
 
-            facets.add(
-                new DataFacet(PDF, "PDF data", ComputeType.ADVANCE, hash, id));
+            facets.add(new DataFacet(PDF, "PDF data", ComputeType.ADVANCE, hash, id));
         }
 
-        facets.add(
-            new DataFacet(AT, "AT data", ComputeType.ADVANCE, hash, id));
+        facets.add(new DataFacet(AT, "AT data", ComputeType.ADVANCE, hash, id));
 
-        facets.add(new FixWQCurveFacet(
-            0,
-            Resources.getMsg(meta, I18N_WQ_CURVE, I18N_WQ_CURVE) + " ("
-                + access.getFunction() + ")"));
+        facets.add(new FixWQCurveFacet(0, Resources.getMsg(meta, I18N_WQ_CURVE, I18N_WQ_CURVE) + " (" + access.getFunction() + ")"));
 
         if (access.getPreprocessing()) {
-            facets.add(new FixOutlierFacet(
-                0,
-                FIX_OUTLIER,
-                Resources.getMsg(meta, I18N_WQ_OUTLIER, I18N_WQ_OUTLIER)));
+            facets.add(new FixOutlierFacet(0, FIX_OUTLIER, Resources.getMsg(meta, I18N_WQ_OUTLIER, I18N_WQ_OUTLIER)));
         }
 
         return res;
     }
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org