8946
|
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
|
2 * Software engineering by |
|
3 * Björnsen Beratende Ingenieure GmbH |
|
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt |
|
5 * |
|
6 * This file is Free Software under the GNU AGPL (>=v3) |
|
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
|
8 * documentation coming with Dive4Elements River for details. |
|
9 */ |
|
10 package org.dive4elements.river.artifacts.sinfo.flowdepth; |
|
11 |
|
12 import java.util.ArrayList; |
|
13 import java.util.Collections; |
|
14 import java.util.List; |
|
15 |
|
16 import org.dive4elements.river.backend.utils.StringUtil; |
|
17 |
|
18 /** |
|
19 * @author Gernot Belger |
|
20 */ |
|
21 public final class WstSoundingIdPair { |
|
22 |
|
23 private final String wstId; |
|
24 |
|
25 private final String soundingId; |
|
26 |
|
27 public WstSoundingIdPair(final String wstId, final String soundingId) { |
|
28 this.wstId = wstId; |
|
29 this.soundingId = soundingId; |
|
30 } |
|
31 |
|
32 public String getWstId() { |
|
33 return this.wstId; |
|
34 } |
|
35 |
|
36 public String getSoundingId() { |
|
37 return this.soundingId; |
|
38 } |
|
39 |
|
40 public static List<WstSoundingIdPair> parsePairs(final String diffids) { |
|
41 |
|
42 // FIXME: this way of parsing the datacage-ids is repeated all over flys! |
|
43 final String datas[] = diffids.split("#"); |
|
44 |
|
45 final List<WstSoundingIdPair> diffPairs = new ArrayList<>(datas.length); |
|
46 |
|
47 for (int i = 0; i < datas.length; i += 2) { |
|
48 final String leftId = StringUtil.unbracket(datas[i]); |
|
49 final String rightId = StringUtil.unbracket(datas[i + 1]); |
|
50 |
|
51 diffPairs.add(new WstSoundingIdPair(leftId, rightId)); |
|
52 } |
|
53 |
|
54 return Collections.unmodifiableList(diffPairs); |
|
55 } |
|
56 } |