[PATCH] merged changes from default into double-precision branch

Wald Commits scm-commit at wald.intevation.org
Fri Jun 28 19:32:46 CEST 2013


# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1372440763 -7200
# Branch double-precision
# Node ID 49dd3e478ccd709f5b6c83860105a5052ea3a65b
# Parent  f4fb7e38a288b008993f62bfbec9fb02351f299f
# Parent  b2eab164a4415cc119fa64e62a5705a7754aef8f
merged changes from default into double-precision branch

diff -r f4fb7e38a288 -r 49dd3e478ccd backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java
--- 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));
         }


More information about the Dive4elements-commits mailing list