diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/WstSoundingIdPair.java @ 8946:5d5d482da3e9

Implementing SINFO - FlowDepthMinMax calculation
author gernotbelger
date Tue, 13 Mar 2018 18:49:33 +0100
parents
children 5c34fe17ef15
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/WstSoundingIdPair.java	Tue Mar 13 18:49:33 2018 +0100
@@ -0,0 +1,56 @@
+/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ *  Björnsen Beratende Ingenieure GmbH
+ *  Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+package org.dive4elements.river.artifacts.sinfo.flowdepth;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.dive4elements.river.backend.utils.StringUtil;
+
+/**
+ * @author Gernot Belger
+ */
+public final class WstSoundingIdPair {
+
+    private final String wstId;
+
+    private final String soundingId;
+
+    public WstSoundingIdPair(final String wstId, final String soundingId) {
+        this.wstId = wstId;
+        this.soundingId = soundingId;
+    }
+
+    public String getWstId() {
+        return this.wstId;
+    }
+
+    public String getSoundingId() {
+        return this.soundingId;
+    }
+
+    public static List<WstSoundingIdPair> parsePairs(final String diffids) {
+
+        // FIXME: this way of parsing the datacage-ids is repeated all over flys!
+        final String datas[] = diffids.split("#");
+
+        final List<WstSoundingIdPair> diffPairs = new ArrayList<>(datas.length);
+
+        for (int i = 0; i < datas.length; i += 2) {
+            final String leftId = StringUtil.unbracket(datas[i]);
+            final String rightId = StringUtil.unbracket(datas[i + 1]);
+
+            diffPairs.add(new WstSoundingIdPair(leftId, rightId));
+        }
+
+        return Collections.unmodifiableList(diffPairs);
+    }
+}
\ No newline at end of file

http://dive4elements.wald.intevation.org