comparison flys-backend/src/main/java/de/intevation/flys/importer/parsers/DA66Parser.java @ 4717:e67d396ed65d

Documentation of DA66Parser.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 27 Dec 2012 13:12:31 +0100
parents 2f7a509f5acf
children bb32793483f4
comparison
equal deleted inserted replaced
4716:6016b9aa827a 4717:e67d396ed65d
30 30
31 private static String HEAD_HEAD = "00"; 31 private static String HEAD_HEAD = "00";
32 private static String HEAD_GEOM = "66"; // "Values" 32 private static String HEAD_GEOM = "66"; // "Values"
33 private static String HEAD_ENDG = "88"; // Probably never used. 33 private static String HEAD_ENDG = "88"; // Probably never used.
34 34
35 /** Regex to match lines of files in da66 format. */
35 private static final Pattern LINE_PATTERN = 36 private static final Pattern LINE_PATTERN =
36 Pattern.compile("^([0-9 -]{2})" + // Type (00|66|88) 37 Pattern.compile("^([0-9 -]{2})" + // Type (00|66|88)
37 "([0-9 -]{5})" + // unset 38 "([0-9 -]{5})" + // unset
38 "([0-9 -]{2})" + // id 39 "([0-9 -]{2})" + // id
39 "([0-9 -]{9})" + // station 40 "([0-9 -]{9})" + // station
162 163
163 /** Data collected so far, last element will be currentLine. */ 164 /** Data collected so far, last element will be currentLine. */
164 protected Map<Double, List<XY>> data; 165 protected Map<Double, List<XY>> data;
165 166
166 167
168 /** Trivial constructor. */
167 public DA66Parser() { 169 public DA66Parser() {
168 data = new TreeMap<Double, List<XY>>(); 170 data = new TreeMap<Double, List<XY>>();
169 } 171 }
170 172
173
174 /** Get the description of the cross section parsed. */
171 @Override 175 @Override
172 public String getDescription() { 176 public String getDescription() {
177 // TODO place file name here
173 return "da66-dummy"; 178 return "da66-dummy";
174 } 179 }
175 180
181
182 /** Get the year of this cross sections measurement. */
176 @Override 183 @Override
177 public Integer getYear() { 184 public Integer getYear() {
178 return 2012; 185 return 2012;
179 } 186 }
180 187
188
189 /**
190 * Return the data parsed.
191 * @return map of stations (km) to list of points.
192 */
181 @Override 193 @Override
182 public Map<Double, List<XY>> getData() { 194 public Map<Double, List<XY>> getData() {
183 return data; 195 return data;
184 } 196 }
185 197
186 public void setData(Map<Double, List<XY>> data) { 198 public void setData(Map<Double, List<XY>> data) {
187 this.data = data; 199 this.data = data;
188 } 200 }
189 201
202 // TODO yet unused, use for description.
190 private static final String removeExtension(String name) { 203 private static final String removeExtension(String name) {
191 int index = name.lastIndexOf('.'); 204 int index = name.lastIndexOf('.');
192 return index == -1 205 return index == -1
193 ? name 206 ? name
194 : name.substring(0, index); 207 : name.substring(0, index);

http://dive4elements.wald.intevation.org