Mercurial > dive4elements > river
view gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SINFOArtifact.java @ 9414:096f151a0a9f
bundu bezugswst länge der abflusszeitreihe fix + klasse vergessen
author | gernotbelger |
---|---|
date | Thu, 16 Aug 2018 15:47:10 +0200 |
parents | abf14917be32 |
children | 9826b465b751 |
line wrap: on
line source
/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde * Software engineering by Intevation GmbH * * 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.client.shared.model; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; /** * The SINFO implementation of an Artifact. * * @author Gernot Belger */ public class SINFOArtifact extends DefaultArtifact { /** The name of this artifact: 'sinfo'. */ private static final String NAME = "sinfo"; /** Necessary for serialization */ public SINFOArtifact() { } public SINFOArtifact(final String uuid, final String hash, final boolean inBackground, final List<CalculationMessage> messages) { super(uuid, hash, inBackground, messages); } @Override public String getName() { return NAME; } public Set<Double> getValidDurationChartKms(final CollectionItem item) { final String validKmsText = item.getData().get("validStations"); if (validKmsText == null || validKmsText.trim().isEmpty()) return Collections.emptySet(); final String[] split = validKmsText.split(","); final Set<Double> validKms = new HashSet<Double>(split.length); for (final String stationText : split) { try { final double station = Double.parseDouble(stationText); validKms.add(station); } catch (final NumberFormatException e) { e.printStackTrace(); } } return validKms; } }