comparison backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java @ 6287:8d9e9b1ded7d

Waterl.Diff.Parser issue1354: Extract years from name, to later set timeintervals.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 12 Jun 2013 11:20:36 +0200
parents b47ab6a21425
children db7d0600d39d
comparison
equal deleted inserted replaced
6286:b47ab6a21425 6287:8d9e9b1ded7d
38 NumberFormat.getInstance(DEFAULT_LOCALE); 38 NumberFormat.getInstance(DEFAULT_LOCALE);
39 39
40 public static final Pattern META_UNIT = 40 public static final Pattern META_UNIT =
41 Pattern.compile("^Einheit: \\[(.*)\\].*"); 41 Pattern.compile("^Einheit: \\[(.*)\\].*");
42 42
43 public static final Pattern YEARS_IN_COLUMN =
44 Pattern.compile(".*(\\d{4})-(\\d{4})$");
45
43 /** List of parsed differences as ImportWst s. */ 46 /** List of parsed differences as ImportWst s. */
44 private List<ImportWst> differences; 47 private List<ImportWst> differences;
45 48
46 private ImportWstColumn[] columns; 49 private ImportWstColumn[] columns;
47 50
161 String name = cols[i].replace("\"", ""); 164 String name = cols[i].replace("\"", "");
162 165
163 log.debug("Create new column '" + name + "'"); 166 log.debug("Create new column '" + name + "'");
164 current.getColumn(i).setName(name); 167 current.getColumn(i).setName(name);
165 current.getColumn(i).setDescription(name); 168 current.getColumn(i).setDescription(name);
169
170 Matcher m = YEARS_IN_COLUMN.matcher(name);
171
172 if (m.matches()) {
173 String startYear = m.group(1);
174 String endYear = m.group(2);
175 // TODO create and set ImportTimeInterval
176 } else {
177 log.debug("No time interval in column header found: " + name);
178 }
166 } 179 }
167 } 180 }
168 181
169 182
170 private void handleDataLine(String line) { 183 private void handleDataLine(String line) {

http://dive4elements.wald.intevation.org