diff artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationAccess.java @ 9155:9b4f5e61c02e

Changed to list of DateRange, added methods in DateRange to support year ranges
author mschaefer
date Tue, 19 Jun 2018 14:15:32 +0200
parents 611a523fc42f
children 2f5052835b76
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationAccess.java	Thu Jun 14 17:51:30 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationAccess.java	Tue Jun 19 14:15:32 2018 +0200
@@ -10,8 +10,12 @@
 
 package org.dive4elements.river.artifacts.uinfo.inundationduration;
 
+import java.util.List;
+
+import org.dive4elements.artifacts.common.utils.DateUtils;
 import org.dive4elements.river.artifacts.access.RangeAccess;
 import org.dive4elements.river.artifacts.common.EpochYearAccessHelper;
+import org.dive4elements.river.artifacts.model.DateRange;
 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact;
 import org.dive4elements.river.artifacts.uinfo.UinfoCalcMode;
 
@@ -67,9 +71,9 @@
     }
 
     public int[] getTotalEpoch() {
-        final int[][] epochs = this.helper.getEpochs("state.uinfo.totalepoch", "totalepoch");
-        if (epochs != null) {
-            return epochs[0];
+        final List<DateRange> epochs = this.helper.getEpochs("state.uinfo.totalepoch", "totalepoch");
+        if (!epochs.isEmpty()) {
+            return new int[] { DateUtils.getYearFromDate(epochs.get(0).getFrom()), DateUtils.getYearFromDate(epochs.get(0).getTo()) };
         }
         return null;
     }

http://dive4elements.wald.intevation.org