9071
|
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.uinfo.vegetationzones; |
|
11 |
|
12 import java.util.ArrayList; |
|
13 import java.util.List; |
|
14 |
|
15 /** |
|
16 * @author Domenico Nardi Tironi |
|
17 * |
|
18 */ |
|
19 public class VegetationZoneAccessHelper { |
|
20 // IMMER ABGLEICHEN MIT SuperVegZonesTablePanel.TABLE_CELL_SEPARATOR |
|
21 private static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR"; |
|
22 private static final String TABLE_ROW_SEPARATOR = "TABLE_ROW_SEPARATOR"; |
|
23 private final String zoneName; |
|
24 private final int min_day_overflow; |
|
25 private final int max_day_overflow; |
|
26 |
|
27 public static List<VegetationZoneAccessHelper> parse(final String zonesRaw) { |
|
28 final List<VegetationZoneAccessHelper> resultList = new ArrayList<>(); |
|
29 |
|
30 final List<String[]> results = new ArrayList<>(); |
|
31 if (zonesRaw.contains(TABLE_ROW_SEPARATOR)) { |
|
32 final String[] rows = zonesRaw.split(TABLE_ROW_SEPARATOR); |
|
33 for (final String row : rows) { |
|
34 if (row.contains(TABLE_CELL_SEPARATOR)) { |
|
35 final String[] result = row.split(TABLE_CELL_SEPARATOR); |
|
36 results.add(result); |
|
37 } |
|
38 } |
|
39 } |
|
40 for (final String[] zone : results) { |
|
41 |
|
42 final VegetationZoneAccessHelper helper = new VegetationZoneAccessHelper(zone[0], Integer.valueOf(zone[1]), Integer.valueOf(zone[2])); |
|
43 resultList.add(helper); |
|
44 } |
|
45 |
|
46 return resultList; |
|
47 } |
|
48 |
|
49 private VegetationZoneAccessHelper(final String zone, final Integer min_day_overflow, final Integer max_day_overflow) { |
|
50 // TODO Auto-generated constructor stub |
|
51 this.zoneName = zone; |
|
52 this.min_day_overflow = min_day_overflow; |
|
53 this.max_day_overflow = max_day_overflow; |
|
54 } |
|
55 |
|
56 public int getMax_day_overflow() { |
|
57 return this.max_day_overflow; |
|
58 } |
|
59 |
|
60 public String getZoneName() { |
|
61 return this.zoneName; |
|
62 } |
|
63 |
|
64 public int getMin_day_overflow() { |
|
65 return this.min_day_overflow; |
|
66 } |
|
67 } |