Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZoneAccessHelper.java @ 9071:a561b882436d
create module bundu (Betrieb & Unterhaltung)
incl. original Fixierungsanalyse+Ausgelagerte Wasserspiegellage
author | gernotbelger |
---|---|
date | Wed, 16 May 2018 11:08:56 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZoneAccessHelper.java Wed May 16 11:08:56 2018 +0200 @@ -0,0 +1,67 @@ +/** 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.uinfo.vegetationzones; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Domenico Nardi Tironi + * + */ +public class VegetationZoneAccessHelper { + // IMMER ABGLEICHEN MIT SuperVegZonesTablePanel.TABLE_CELL_SEPARATOR + private static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR"; + private static final String TABLE_ROW_SEPARATOR = "TABLE_ROW_SEPARATOR"; + private final String zoneName; + private final int min_day_overflow; + private final int max_day_overflow; + + public static List<VegetationZoneAccessHelper> parse(final String zonesRaw) { + final List<VegetationZoneAccessHelper> resultList = new ArrayList<>(); + + final List<String[]> results = new ArrayList<>(); + if (zonesRaw.contains(TABLE_ROW_SEPARATOR)) { + final String[] rows = zonesRaw.split(TABLE_ROW_SEPARATOR); + for (final String row : rows) { + if (row.contains(TABLE_CELL_SEPARATOR)) { + final String[] result = row.split(TABLE_CELL_SEPARATOR); + results.add(result); + } + } + } + for (final String[] zone : results) { + + final VegetationZoneAccessHelper helper = new VegetationZoneAccessHelper(zone[0], Integer.valueOf(zone[1]), Integer.valueOf(zone[2])); + resultList.add(helper); + } + + return resultList; + } + + private VegetationZoneAccessHelper(final String zone, final Integer min_day_overflow, final Integer max_day_overflow) { + // TODO Auto-generated constructor stub + this.zoneName = zone; + this.min_day_overflow = min_day_overflow; + this.max_day_overflow = max_day_overflow; + } + + public int getMax_day_overflow() { + return this.max_day_overflow; + } + + public String getZoneName() { + return this.zoneName; + } + + public int getMin_day_overflow() { + return this.min_day_overflow; + } +}