# HG changeset patch # User Felix Wolfsteller # Date 1371028836 -7200 # Node ID 8d9e9b1ded7d1926da64f3b65fb6dbf6fbd2105f # Parent b47ab6a21425d73f4dadff31b0277ecfb988cad6 Waterl.Diff.Parser issue1354: Extract years from name, to later set timeintervals. diff -r b47ab6a21425 -r 8d9e9b1ded7d backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java --- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java Wed Jun 12 11:18:47 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java Wed Jun 12 11:20:36 2013 +0200 @@ -40,6 +40,9 @@ public static final Pattern META_UNIT = Pattern.compile("^Einheit: \\[(.*)\\].*"); + public static final Pattern YEARS_IN_COLUMN = + Pattern.compile(".*(\\d{4})-(\\d{4})$"); + /** List of parsed differences as ImportWst s. */ private List differences; @@ -163,6 +166,16 @@ log.debug("Create new column '" + name + "'"); current.getColumn(i).setName(name); current.getColumn(i).setDescription(name); + + Matcher m = YEARS_IN_COLUMN.matcher(name); + + if (m.matches()) { + String startYear = m.group(1); + String endYear = m.group(2); + // TODO create and set ImportTimeInterval + } else { + log.debug("No time interval in column header found: " + name); + } } }