view artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BunduResultType.java @ 9573:b9c87bbff6a4

mean bed height -> mean bed LEVEL
author gernotbelger
date Tue, 06 Nov 2018 10:56:22 +0100
parents 3fa8551c3d1b
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.bundu;

import java.text.NumberFormat;

import org.dive4elements.artifacts.CallContext;
import org.dive4elements.river.artifacts.common.AbstractResultType;
import org.dive4elements.river.artifacts.common.I18NStrings;
import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.utils.Formatter;

/**
 * @author Domenico Nardi Tironi
 *
 */
public abstract class BunduResultType extends AbstractResultType {

    protected BunduResultType(final String unit, final String csvHeader, final String pdfHeader) {
        super(unit, csvHeader, pdfHeader);
    }

    protected BunduResultType(final String unit, final String csvHeader) {
        super(unit, csvHeader, csvHeader);
    }

    private static final long serialVersionUID = 1L;

    public static final BunduResultType bezugswst = new BunduResultType(I18NStrings.UNIT_NONE, "bundu.wst.export.csv.meta.header.bezugswst",
            "bundu.wst.export.pdf.meta.header.bezugswst") { // Unit dynamic

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getFlowDepth(context); // REMARK same as SInfoResultType.waterlevel
        }
    };

    public static final BunduResultType sounding = new BunduResultType(I18NStrings.UNIT_NONE, "bundu.export.bezugswst.csv.meta.miss.sounding") {

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            return exportStringValue(value);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            throw new UnsupportedOperationException();
        }
    };

    public static final BunduResultType channelLowerEdge = new BunduResultType(I18NStrings.UNIT_NONE, "bundu.export.bezugswst.csv.meta.miss.channel.lower_edge",
            "bundu.export.bezugswst.pdf.meta.miss.channel.lower_edge") { // Unit dynamic

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getFlowDepth(context); // REMARK same as SInfoResultType.waterlevel
        }
    };

    public static final BunduResultType channelDepth = new BunduResultType(I18NStrings.UNIT_M, "bundu.export.bezugswst.csv.meta.miss.channel.min_depth",
            "bundu.export.bezugswst.pdf.meta.miss.channel.min_depth") {

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getFlowDepth(context);
        }
    };

    public static final BunduResultType hasMissingDepth = new BunduResultType(I18NStrings.UNIT_NONE, "bundu.export.bezugswst.csv.meta.miss.exists",
            "bundu.export.bezugswst.pdf.meta.miss.exists") {
        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            return exportBooleanValue(context, value);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            throw new UnsupportedOperationException();
        }
    };

    // TODO missVolumeTotal und missMassTotal differenzieren in Gesamtsumme und Feld1-10-Summe
    public static final BunduResultType missVolumeTotal = new BunduResultType(I18NStrings.UNIT_CUBIC_M, "bundu.export.bezugswst.csv.meta.miss.volume.total") {
        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getIntegerFormatter(context);
        }
    };

    public static final BunduResultType missMassTotal = new BunduResultType(I18NStrings.UNIT_TON, "bundu.export.bezugswst.csv.meta.miss.mass.total") {
        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getMassFormat(context);
        }
    };

    public static final BunduResultType excavationVolume = new BunduResultType(I18NStrings.UNIT_CUBIC_M, "bundu.export.bezugswst.csv.meta.miss.excavation",
            "bundu.export.bezugswst.pdf.meta.miss.excavation") {
        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getIntegerFormatter(context);
        }
    };

    public static final BunduResultType excavationCosts = new BunduResultType(I18NStrings.UNIT_EURO, "bundu.export.bezugswst.csv.meta.miss.costs",
            "bundu.export.bezugswst.pdf.meta.miss.costs") {
        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getCurrencyFormat(context);
        }
    };

    public static final BunduResultType excavationVolumeTotal = new BunduResultType(I18NStrings.UNIT_CUBIC_M,
            "bundu.export.bezugswst.csv.meta.miss.excavationtotal", "bundu.export.bezugswst.pdf.meta.miss.excavationtotal") {
        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getIntegerFormatter(context);
        }
    };

    public static final BunduResultType excavationCostsTotal = new BunduResultType(I18NStrings.UNIT_EURO, "bundu.export.bezugswst.csv.meta.miss.coststotal",
            "bundu.export.bezugswst.pdf.meta.miss.coststotal") {
        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getCurrencyFormat(context);
        }
    };

    public static final BunduResultType channelWidth = new BunduResultType(I18NStrings.UNIT_M, "bundu.export.bezugswst.csv.meta.miss.channel.width",
            "bundu.export.bezugswst.pdf.meta.miss.channel.width") {
        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getChannelWidth(context);
        }
    };

    public static final BunduResultType density = new BunduResultType(I18NStrings.UNIT_M, "bundu.export.bezugswst.csv.meta.miss.density",
            "bundu.export.bezugswst.pdf.meta.miss.density") {
        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getDensityFormat(context);
        }
    };

    public static final SInfoResultType heightMeanBed = new SInfoResultType(null, "bundu.export.bezugswst.csv.meta.miss.height.mean_bed") {
        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getMeanBedHeight(context);
        }
    };

    public static final SInfoResultType flowdepthMeanBed = new SInfoResultType(I18NStrings.UNIT_M, "bundu.export.bezugswst.csv.meta.miss.flowdepth.mean_bed") {
        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getFlowDepth(context);
        }
    };

    public static final BunduResultType missDepthMeanBed = new BunduResultType(I18NStrings.UNIT_NONE, null) {

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getFlowDepth(context);
        }
    };

    public static final BunduResultType missAreaMeanBed = new BunduResultType(I18NStrings.UNIT_NONE, null) {

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getMassFormat(context);
        }
    };

    public static final BunduResultType missVolumeMeanBed = new BunduResultType(I18NStrings.UNIT_NONE, "bundu.export.bezugswst.csv.meta.miss.volume.mean_bed") {

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getMassFormat(context);
        }
    };

    public static final BunduResultType missMassMeanBed = new BunduResultType(I18NStrings.UNIT_NONE, "bundu.export.bezugswst.csv.meta.miss.mass.mean_bed") {

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getMassFormat(context);
        }
    };

    /**
     * List of bed level values of the 10 fields of a cross section
     */
    public static final BunduResultType bedHeightFields = new BunduResultType(null, null) {

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getMeanBedHeight(context);
        }
    };

    /**
     * List of depth values of the 10 fields of a cross section
     */
    public static final BunduResultType depthFields = new BunduResultType(I18NStrings.UNIT_NONE, null) {

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getFlowDepth(context);
        }
    };

    /**
     * List of missing depth values of the 10 fields of a cross section
     */
    public static final BunduResultType missDepthFields = new BunduResultType(I18NStrings.UNIT_NONE, null) {

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            throw new UnsupportedOperationException();
        }
    };

    /**
     * List of missing width values of the 10 fields of a cross section
     */
    public static final BunduResultType missWidthFields = new BunduResultType(I18NStrings.UNIT_NONE, null) {

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            throw new UnsupportedOperationException();
        }
    };

    /**
     * List of missing area values of the 10 fields of a cross section
     */
    public static final BunduResultType missAreaFields = new BunduResultType(I18NStrings.UNIT_NONE, null) {

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            throw new UnsupportedOperationException();
        }
    };

    /**
     * List of volume values of the 10 fields of a cross section
     */
    public static final BunduResultType missVolumeFields = new BunduResultType(I18NStrings.UNIT_NONE, "bundu.export.bezugswst.csv.meta.miss.volume.field") {

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getMassFormat(context);
        }
    };

    /**
     * List of mass values of the 10 fields of a cross section
     */
    public static final BunduResultType missMassFields = new BunduResultType(I18NStrings.UNIT_NONE, "bundu.export.bezugswst.csv.meta.miss.mass.field") {

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getMassFormat(context);
        }
    };

    public static final BunduResultType missStationRangeFrom = new BunduResultType(I18NStrings.UNIT_KM, "bundu.export.bezugswst.csv.meta.miss.km_from") {

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getWaterlevelKM(context);
        }
    };

    public static final BunduResultType missStationRangeTo = new BunduResultType(I18NStrings.UNIT_KM, "bundu.export.bezugswst.csv.meta.miss.km_to") {

        private static final long serialVersionUID = 1L;

        @Override
        public String exportValue(final CallContext context, final Object value) {
            final double doubleValue = asDouble(value);
            return exportDoubleValue(context, doubleValue);
        }

        @Override
        protected NumberFormat createFormatter(final CallContext context) {
            return Formatter.getWaterlevelKM(context);
        }
    };
}

http://dive4elements.wald.intevation.org