comparison 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
comparison
equal deleted inserted replaced
9266:465347d12990 9267:c7e5285d434f
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
2 * Software engineering by Intevation GmbH
3 *
4 * This file is Free Software under the GNU AGPL (>=v3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
6 * documentation coming with Dive4Elements River for details.
7 */
8
9 package org.dive4elements.river.artifacts.bundu.bezugswst;
10
11 import org.apache.log4j.Logger;
12 import org.dive4elements.river.artifacts.D4EArtifact;
13 import org.dive4elements.river.artifacts.access.FixAnalysisAccess;
14
15 public class BunduAccess extends FixAnalysisAccess {
16
17 private static Logger log = Logger.getLogger(BunduAccess.class);
18
19 // Alles, was in super steht, auskommentiert. TODO: endgültig löschen, nachdem ich es etwas verstanden habe
20
21 // protected DateRange referencePeriod;
22 // protected DateRange[] analysisPeriods;
23 //
24 // protected double[] qs;
25
26 public BunduAccess(final D4EArtifact artifact) {
27 super(artifact);
28 }
29
30 public boolean isAutoSelect() {
31 final String fixChoice = this.artifact.getDataAsString("fix_choice");
32 if (fixChoice != null && fixChoice.equals("state.bundu.fix.auto")) {
33 return true;
34 }
35 return false;
36 }
37
38 public Integer getBezugsJahr() {
39 return this.artifact.getDataAsInteger("singleyear");
40 }
41
42 public int[] getEventsTemp() {
43 return getIntArray("events_temp");
44 }
45
46 // /** Access the reference date period, return null in case of 'errors'. */
47 // public DateRange getReferencePeriod() {
48 // if (this.referencePeriod == null) {
49 // final StateData refStart = artifact.getData("ref_start");
50 // final StateData refEnd = artifact.getData("ref_end");
51 //
52 // if (refStart == null || refEnd == null) {
53 // log.warn("missing 'ref_start' or 'ref_start' value");
54 // return null;
55 // }
56 //
57 // try {
58 // long rs = Long.parseLong((String) refStart.getValue());
59 // long re = Long.parseLong((String) refEnd.getValue());
60 //
61 // if (rs > re) {
62 // final long t = rs;
63 // rs = re;
64 // re = t;
65 // }
66 //
67 // final Date from = new Date(rs);
68 // final Date to = new Date(re);
69 // this.referencePeriod = new DateRange(from, to);
70 // }
71 // catch (final NumberFormatException nfe) {
72 // log.warn("ref_start or ref_end is not an integer.");
73 // }
74 // }
75 //
76 // return this.referencePeriod;
77 // }
78
79 // @Override
80 // public DateRange[] getAnalysisPeriods() {
81 // if (this.analysisPeriods == null) {
82 // this.analysisPeriods = getDateRange("ana_data");
83 // }
84 //
85 // return this.analysisPeriods;
86 // }
87
88 /**
89 * @return DateRange object ranging from eldest to youngest date
90 * of analysis and reference periods.
91 */
92 // @Override
93 // public DateRange getDateRange() {
94 // final DateRange refP = getReferencePeriod();
95 //
96 // if (refP == null) {
97 // return null;
98 // }
99 //
100 // Date from = refP.getFrom();
101 // Date to = refP.getTo();
102 //
103 // final DateRange[] rs = getAnalysisPeriods();
104 // for (final DateRange r : rs) {
105 // if (r.getFrom().before(from)) {
106 // from = r.getFrom();
107 // }
108 // if (r.getTo().after(to)) {
109 // to = r.getTo();
110 // }
111 // }
112 //
113 // return new DateRange(from, to);
114 // }
115
116 // @Override
117 // public double[] getQs() {
118 // if (this.qs == null) {
119 // this.qs = getDoubleArray("qs");
120 // }
121 //
122 // if (log.isDebugEnabled() && this.qs != null) {
123 // log.debug("qs: " + Arrays.toString(this.qs));
124 // }
125 // return this.qs;
126 // }
127 }
128 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org