diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxAccess.java @ 8993:0adc6d04de95

SInfo - FlowDepthMinMax: choosing bed heights, not bed height min and max separately
author gernotbelger
date Wed, 11 Apr 2018 14:09:13 +0200
parents 5d5d482da3e9
children 611a523fc42f
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxAccess.java	Fri Apr 06 11:55:36 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxAccess.java	Wed Apr 11 14:09:13 2018 +0200
@@ -10,10 +10,7 @@
 
 package org.dive4elements.river.artifacts.sinfo.flowdepthminmax;
 
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
 
 import org.apache.commons.lang.math.DoubleRange;
 import org.dive4elements.river.artifacts.access.RangeAccess;
@@ -31,33 +28,6 @@
  */
 final class FlowDepthMinMaxAccess extends RangeAccess {
 
-    public static class MinMaxIdPair {
-
-        private final String wstId;
-
-        private final String minSoundingId;
-
-        private final String maxSoundingId;
-
-        public MinMaxIdPair(final String wstId, final String minSoundingId, final String maxSoundingId) {
-            this.wstId = wstId;
-            this.minSoundingId = minSoundingId;
-            this.maxSoundingId = maxSoundingId;
-        }
-
-        public String getWstId() {
-            return this.wstId;
-        }
-
-        public String getMinSoundingId() {
-            return this.minSoundingId;
-        }
-
-        public String getMaxSoundingId() {
-            return this.maxSoundingId;
-        }
-    }
-
     private static final String FIELD_DIFFIDS = "diffids";
 
     public FlowDepthMinMaxAccess(final SINFOArtifact artifact) {
@@ -74,32 +44,8 @@
         return new DoubleRange(from, to);
     }
 
-    public Collection<MinMaxIdPair> getMinMaxPairs() {
-
+    public Collection<WstSoundingIdPair> getMinMaxPairs() {
         final String diffids = getString(FIELD_DIFFIDS);
-
-        /* fetch the raw configured pairs */
-        final List<WstSoundingIdPair> diffPairs = WstSoundingIdPair.parsePairs(diffids);
-
-        /* now sort eleemnts into pairs of TL/KL */
-        // FIXME: use sounding-ids to determine how pairs fit together
-        // or, let the ui already enforce it somehow
-
-        final List<MinMaxIdPair> minMaxPairs = new ArrayList<>(diffPairs.size());
-        // FIXME: at the moment, we simply pair by order
-        for (int i = 0; i < diffPairs.size(); i++) {
-
-            final WstSoundingIdPair minPair = diffPairs.get(i);
-
-            if (i < diffPairs.size() - 1) {
-                final WstSoundingIdPair maxPair = diffPairs.get(i + 1);
-                minMaxPairs.add(new MinMaxIdPair(minPair.getWstId(), minPair.getSoundingId(), maxPair.getSoundingId()));
-                i++;
-            } else {
-                minMaxPairs.add(new MinMaxIdPair(minPair.getWstId(), minPair.getSoundingId(), null));
-            }
-        }
-
-        return Collections.unmodifiableCollection(minMaxPairs);
+        return WstSoundingIdPair.parsePairs(diffids);
     }
 }
\ No newline at end of file

http://dive4elements.wald.intevation.org