Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/commons/UInfoResultType.java @ 8996:fb9430250899
Work on uinfo
author | gernotbelger |
---|---|
date | Thu, 12 Apr 2018 19:13:39 +0200 |
parents | |
children | 7134a4c7d1b6 |
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/commons/UInfoResultType.java Thu Apr 12 19:13:39 2018 +0200 @@ -0,0 +1,86 @@ +/** 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.commons; + +import java.text.NumberFormat; + +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.river.artifacts.common.AbstractResultType; +import org.dive4elements.river.utils.Formatter; + +/** + * @author Domenico Nardi Tironi + * + */ +public abstract class UInfoResultType extends AbstractResultType { + + public UInfoResultType(final String unit, final String csvHeader) { + super(unit, csvHeader, csvHeader); + + } + + @Override + public String exportValue(final CallContext context, final Object value) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected NumberFormat createFormatter(final CallContext context) { + // TODO Auto-generated method stub + return null; + } + + public static final UInfoResultType salixline = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.salix_line") { + @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) { + // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of + // digits. + return Formatter.getSalixLine(context); + } + }; + + public static final UInfoResultType salixlinehist = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.hist") { + @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) { + // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of + // digits. + return Formatter.getSalixLine(context); + } + }; + + public static final UInfoResultType salixlinescen = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.scen") { + @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) { + // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of + // digits. + return Formatter.getSalixLine(context); + } + }; + +}