Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BunduAccess.java @ 9267:c7e5285d434f
bundu bezugswst work
author | gernotbelger |
---|---|
date | Wed, 18 Jul 2018 15:34:53 +0200 |
parents | |
children | 2323d005f9a5 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BunduAccess.java Wed Jul 18 15:34:53 2018 +0200 @@ -0,0 +1,128 @@ +/* Copyright (C) 2011, 2012, 2013 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.artifacts.bundu.bezugswst; + +import org.apache.log4j.Logger; +import org.dive4elements.river.artifacts.D4EArtifact; +import org.dive4elements.river.artifacts.access.FixAnalysisAccess; + +public class BunduAccess extends FixAnalysisAccess { + + private static Logger log = Logger.getLogger(BunduAccess.class); + + // Alles, was in super steht, auskommentiert. TODO: endgültig löschen, nachdem ich es etwas verstanden habe + + // protected DateRange referencePeriod; + // protected DateRange[] analysisPeriods; + // + // protected double[] qs; + + public BunduAccess(final D4EArtifact artifact) { + super(artifact); + } + + public boolean isAutoSelect() { + final String fixChoice = this.artifact.getDataAsString("fix_choice"); + if (fixChoice != null && fixChoice.equals("state.bundu.fix.auto")) { + return true; + } + return false; + } + + public Integer getBezugsJahr() { + return this.artifact.getDataAsInteger("singleyear"); + } + + public int[] getEventsTemp() { + return getIntArray("events_temp"); + } + + // /** Access the reference date period, return null in case of 'errors'. */ + // public DateRange getReferencePeriod() { + // if (this.referencePeriod == null) { + // final StateData refStart = artifact.getData("ref_start"); + // final StateData refEnd = artifact.getData("ref_end"); + // + // if (refStart == null || refEnd == null) { + // log.warn("missing 'ref_start' or 'ref_start' value"); + // return null; + // } + // + // try { + // long rs = Long.parseLong((String) refStart.getValue()); + // long re = Long.parseLong((String) refEnd.getValue()); + // + // if (rs > re) { + // final long t = rs; + // rs = re; + // re = t; + // } + // + // final Date from = new Date(rs); + // final Date to = new Date(re); + // this.referencePeriod = new DateRange(from, to); + // } + // catch (final NumberFormatException nfe) { + // log.warn("ref_start or ref_end is not an integer."); + // } + // } + // + // return this.referencePeriod; + // } + + // @Override + // public DateRange[] getAnalysisPeriods() { + // if (this.analysisPeriods == null) { + // this.analysisPeriods = getDateRange("ana_data"); + // } + // + // return this.analysisPeriods; + // } + + /** + * @return DateRange object ranging from eldest to youngest date + * of analysis and reference periods. + */ + // @Override + // public DateRange getDateRange() { + // final DateRange refP = getReferencePeriod(); + // + // if (refP == null) { + // return null; + // } + // + // Date from = refP.getFrom(); + // Date to = refP.getTo(); + // + // final DateRange[] rs = getAnalysisPeriods(); + // for (final DateRange r : rs) { + // if (r.getFrom().before(from)) { + // from = r.getFrom(); + // } + // if (r.getTo().after(to)) { + // to = r.getTo(); + // } + // } + // + // return new DateRange(from, to); + // } + + // @Override + // public double[] getQs() { + // if (this.qs == null) { + // this.qs = getDoubleArray("qs"); + // } + // + // if (log.isDebugEnabled() && this.qs != null) { + // log.debug("qs: " + Arrays.toString(this.qs)); + // } + // return this.qs; + // } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :