Mercurial > dive4elements > river
comparison flys-aft/src/main/java/de/intevation/aft/DIPSGauge.java @ 4087:aad1886ea226
Store new gauges in FLYS db.
flys-aft/trunk@3568 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 02 Jan 2012 17:45:25 +0000 |
parents | 067341e86375 |
children | 83c72bc07591 |
comparison
equal
deleted
inserted
replaced
4086:ee0c60757a94 | 4087:aad1886ea226 |
---|---|
59 Calendar cal = Calendar.getInstance(); | 59 Calendar cal = Calendar.getInstance(); |
60 cal.set(year, month, day, hours, mins, secs); | 60 cal.set(year, month, day, hours, mins, secs); |
61 | 61 |
62 date = cal.getTime(); | 62 date = cal.getTime(); |
63 } | 63 } |
64 | |
65 public double getValue() { | |
66 return value; | |
67 } | |
68 | |
69 public void setValue(double value) { | |
70 this.value = value; | |
71 } | |
72 | |
73 public Date getDate() { | |
74 return date; | |
75 } | |
76 | |
77 public void setDate(Date date) { | |
78 this.date = date; | |
79 } | |
64 } // class datum | 80 } // class datum |
65 | 81 |
66 protected double aeo; | 82 protected double aeo; |
83 | |
84 protected double station; | |
67 | 85 |
68 protected String name; | 86 protected String name; |
69 | 87 |
70 protected String riverName; | 88 protected String riverName; |
71 | 89 |
78 public DIPSGauge() { | 96 public DIPSGauge() { |
79 } | 97 } |
80 | 98 |
81 public DIPSGauge(Element element) { | 99 public DIPSGauge(Element element) { |
82 | 100 |
83 name = element.getAttribute("NAME"); | 101 name = element.getAttribute("NAME"); |
84 riverName = element.getAttribute("GEWAESSER"); | 102 riverName = element.getAttribute("GEWAESSER"); |
85 | 103 |
86 String aeoString = element.getAttribute("EINZUGSGEBIET_AEO"); | 104 String aeoString = element.getAttribute("EINZUGSGEBIET_AEO"); |
87 if (aeoString.length() == 0) { | 105 if (aeoString.length() == 0) { |
88 log.warn("DIPS: Setting AEO of gauge '" + name + "' to zero."); | 106 log.warn("DIPS: Setting AEO of gauge '" + name + "' to zero."); |
89 aeoString = "0"; | 107 aeoString = "0"; |
90 } | 108 } |
91 aeo = Double.parseDouble(aeoString); | 109 aeo = Double.parseDouble(aeoString); |
110 | |
111 String stationString = element.getAttribute("STATIONIERUNG"); | |
112 if (stationString.length() == 0) { | |
113 log.warn("DIPS: Setting station of gauge '" + name + "' to zero."); | |
114 stationString = "0"; | |
115 } | |
116 station = Double.parseDouble(stationString); | |
117 if (station == 0d) { | |
118 log.warn("DIPS: Station of gauge '" + name + "' is zero."); | |
119 } | |
92 | 120 |
93 datums = new ArrayList<Datum>(); | 121 datums = new ArrayList<Datum>(); |
94 NodeList nodes = element.getElementsByTagName("PNP"); | 122 NodeList nodes = element.getElementsByTagName("PNP"); |
95 for (int i = 0, N = nodes.getLength(); i < N; ++i) { | 123 for (int i = 0, N = nodes.getLength(); i < N; ++i) { |
96 Element e = (Element)nodes.item(i); | 124 Element e = (Element)nodes.item(i); |
126 | 154 |
127 public void setAftName(String aftName) { | 155 public void setAftName(String aftName) { |
128 this.aftName = aftName; | 156 this.aftName = aftName; |
129 } | 157 } |
130 | 158 |
159 public double getStation() { | |
160 return station; | |
161 } | |
131 | 162 |
163 public double getAeo() { | |
164 return aeo; | |
165 } | |
166 | |
167 public void setAeo(double aeo) { | |
168 this.aeo = aeo; | |
169 } | |
170 | |
171 public void setStation(double station) { | |
172 this.station = station; | |
173 } | |
174 | |
175 public boolean hasDatums() { | |
176 return !datums.isEmpty(); | |
177 } | |
178 | |
179 public Datum getLatestDatum() { | |
180 return datums.get(datums.size()-1); | |
181 } | |
132 } | 182 } |
133 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 183 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |