diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculation.java @ 9318:7b2b086e45f0

collision pdf details, ResultType refactoring, bezugswst result
author gernotbelger
date Fri, 27 Jul 2018 10:11:23 +0200
parents 4f411c6ee3ae
children 504f63512379
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculation.java	Thu Jul 26 17:37:23 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculation.java	Fri Jul 27 10:11:23 2018 +0200
@@ -69,8 +69,7 @@
         if (access.getYears() != null) {
             for (final int year : access.getYears())
                 calculateOverview(overViewRows, river, access.getLowerKm(), access.getUpperKm(), year, year, false);
-        }
-        else {
+        } else {
             for (final DateRange dr : access.getEpochs())
                 calculateOverview(overViewRows, river, access.getLowerKm(), access.getUpperKm(), dr.getFromYear(), dr.getToYear(), true);
         }
@@ -91,8 +90,7 @@
         if (access.getYears() != null) {
             for (final int year : access.getYears())
                 calculateDetails(detailsRows, infoProvider, access.getLowerKm(), access.getUpperKm(), year, year, qFinders, zoneFinders);
-        }
-        else {
+        } else {
             for (final DateRange dr : access.getEpochs())
                 calculateDetails(detailsRows, infoProvider, access.getLowerKm(), access.getUpperKm(), dr.getFromYear(), dr.getToYear(), qFinders, zoneFinders);
         }
@@ -110,7 +108,7 @@
             final int toYear, final boolean isEpoch) {
         for (final CollisionAggregateValue aggregate : CollisionAggregateValue.getValuesByKm(river, fromKm, toKm, fromYear, toYear)) {
             rows.add(ResultRow.create().putValue(GeneralResultType.station, aggregate.getStation())
-                    .putValue(SInfoResultType.years, (isEpoch? String.format("%d-%d", fromYear, toYear) : Integer.toString(fromYear)))
+                    .putValue(SInfoResultType.years, (isEpoch ? String.format("%d-%d", fromYear, toYear) : Integer.toString(fromYear)))
                     .putValue(SInfoResultType.collisionCount, aggregate.getCount()));
         }
     }
@@ -120,18 +118,15 @@
      * and adds them to a ResultRow collection
      */
     private void calculateDetails(final Collection<ResultRow> rows, final RiverInfoProvider riverInfo, final double fromKm, final double toKm,
-            final int fromYear, final int toYear, final Map<Gauge, GaugeDischargeValuesFinder> qFinders,
-            final Map<Gauge, GaugeMainValueFinder> zoneFinders) {
+            final int fromYear, final int toYear, final Map<Gauge, GaugeDischargeValuesFinder> qFinders, final Map<Gauge, GaugeMainValueFinder> zoneFinders) {
         for (final CollisionValue collision : CollisionValue.getValues(riverInfo.getRiver(), fromKm, toKm, DateUtil.getStartDateFromYear(fromYear),
                 DateUtil.getEndDateFromYear(toYear))) {
             final Gauge gauge = riverInfo.getGauge(collision.getStation(), true);
             final double q = qFinders.get(gauge).getDischarge(collision.getGaugeW());
             final double qOut = Double.isInfinite(q) ? Double.NaN : q;
             rows.add(ResultRow.create().putValue(GeneralResultType.station, collision.getStation())
-                    .putValue(GeneralResultType.date, collision.getEventDate())
-                    .putValue(SInfoResultType.collisionGaugeW, collision.getGaugeW())
-                    .putValue(SInfoResultType.gaugeLabel, collision.getGaugeName())
-                    .putValue(SInfoResultType.discharge, qOut)
+                    .putValue(GeneralResultType.dateShort, collision.getEventDate()).putValue(SInfoResultType.collisionGaugeW, collision.getGaugeW())
+                    .putValue(GeneralResultType.gaugeLabelCm, collision.getGaugeName()).putValue(SInfoResultType.dischargeLong, qOut)
                     .putValue(SInfoResultType.dischargeZone, zoneFinders.get(gauge).findZoneName(q)));
         }
     }

http://dive4elements.wald.intevation.org