view artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/DurationWaterlevel.java @ 9357:5ce50640688c

S-Info flood duration: fixed error report output name, changed duration from int to double, added formatter
author mschaefer
date Wed, 01 Aug 2018 13:18:45 +0200
parents 83ebeb620b5a
children 8da911b5169c
line wrap: on
line source
/** 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.flood_duration;

import java.io.Serializable;
import java.text.NumberFormat;

/**
 * @author Domenico Nardi Tironi
 *
 */
public class DurationWaterlevel implements Serializable {

    private static final long serialVersionUID = 1L;

    private final double w;
    private final double q;
    private final String bezeichnung;
    private final double floodDurDaysPerYear;

    public DurationWaterlevel(final double w, final double floodDurDaysPerYear, final double q, final String bezeichnung) {
        this.w = w;
        this.q = q;
        this.bezeichnung = bezeichnung;
        this.floodDurDaysPerYear = floodDurDaysPerYear;
    }

    public double getWaterlevel() {
        return this.w;
    }

    public double getDischarge() {
        return this.q;
    }

    public double getFloodDurDaysPerYear() {
        return this.floodDurDaysPerYear;
    }

    public String getFloodDurDaysPerYearFormatted(final NumberFormat durFormatter) {
        return durFormatter.format(this.floodDurDaysPerYear);
    }

    public String getBezeichnung() {
        return this.bezeichnung;
    }

    public String getQFormatted(final NumberFormat qFormatter) {
        return qFormatter.format(this.q);
    }

    public String getWFormatted(final NumberFormat wFormatter) {
        return wFormatter.format(this.w);
    }

    // normally, the label is included in the type, but we need to replace the index ("_1")
    public static final String getHeaderQ() {
        return "sinfo.flood_duration.header.q_index";
    }

    public static final String getHeaderWPdf() {
        return "sinfo.flood_duration.header.pdf.w_index";
    }

    public static final String getHeaderBezeichnPdf() {
        return "sinfo.flood_duration.header.pdf.bezeichnung_index";
    }

    public static final String getHeaderFloodDurPerYearPdf() {
        return "sinfo.flood_duration.header.pdf.fd_per_year_index";
    }

    public static final String getHeaderWCsv() {
        return "sinfo.flood_duration.header.w_index";
    }

    public static final String getHeaderBezeichnCsv() {
        return "sinfo.flood_duration.header.bezeichnung_index";
    }

    public static final String getHeaderFloodDurPerYearCsv() {
        return "sinfo.flood_duration.header.fd_per_year_index";
    }

}

http://dive4elements.wald.intevation.org