view artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/DurationWaterlevel.java @ 9630:8da911b5169c

3 Significant also for Q_1, Q_2...
author dnt_bjoernsen <d.tironi@bjoernsen.de>
date Mon, 14 Oct 2019 18:07:31 +0200
parents 5ce50640688c
children
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;

import org.dive4elements.artifacts.CallContext;
import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;

/**
 * @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 getQFormatted3Significant(final CallContext context) {
        return SInfoResultType.floodDischarge.exportValue(context, 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