changeset 6509:49dd3e478ccd double-precision

merged changes from default into double-precision branch
author Tom Gottfried <tom.gottfried@intevation.de>
date Fri, 28 Jun 2013 19:32:43 +0200
parents f4fb7e38a288 (current diff) b2eab164a441 (diff)
children 62d6e1d5da47
files backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Fri Jun 28 17:48:04 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Fri Jun 28 19:32:43 2013 +0200
@@ -61,6 +61,9 @@
     public static final Pattern UNIT =
         Pattern.compile("[^\\[]*\\[([^]]+)\\].*");
 
+    public static final Pattern YEAR_INTERVAL =
+        Pattern.compile("(\\d{4})\\s*[-/]\\s*(\\d{4})");
+
     public static final double INTERVAL_GAP = 0.00001d;
 
     protected ImportWst wst;
@@ -84,6 +87,13 @@
 
     public static ImportTimeInterval guessDate(String string) {
         try {
+            Matcher m = YEAR_INTERVAL.matcher(string);
+            if (m.matches()) {
+                return new ImportTimeInterval(
+                    DateGuesser.guessDate(m.group(1)),
+                    DateGuesser.guessDate(m.group(2)));
+            }
+
             return new ImportTimeInterval(
                 DateGuesser.guessDate(string));
         }

http://dive4elements.wald.intevation.org