[Dive4elements-commits] [PATCH 04 of 12] Remove code dupe, doc

Wald Commits scm-commit at wald.intevation.org
Wed Jun 12 11:51:13 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1371030214 -7200
# Node ID cc11780b349106050b7395fa00a4d11d74a2407b
# Parent  f40d236098c1204474d06629f0c63f3ffffbebd1
Remove code dupe, doc.

diff -r f40d236098c1 -r cc11780b3491 backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java	Wed Jun 12 11:27:36 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java	Wed Jun 12 11:43:34 2013 +0200
@@ -40,6 +40,7 @@
 import org.dive4elements.river.importer.ImportUnit;
 import org.dive4elements.river.model.BedHeightType;
 import org.dive4elements.river.importer.ImporterSession;
+import org.dive4elements.river.importer.parsers.LineParser;
 
 public abstract class BedHeightParser {
 
@@ -159,23 +160,6 @@
     }
 
 
-    public static Date getStartDateFromYear(int year) {
-        Calendar cal = Calendar.getInstance();
-	cal.clear();
-        cal.set(year, 0, 1, 0, 0, 0);
-
-        return cal.getTime();
-    }
-
-    public static Date getEndDateFromYear(int year) {
-        Calendar cal = Calendar.getInstance();
-	cal.clear();
-        cal.set(year, 11, 31, 23, 59, 59);
-
-        return cal.getTime();
-    }
-
-
     protected void handleMetaLine(ImportBedHeight obj, String line) {
         String meta = stripMetaLine(line);
 
@@ -246,8 +230,8 @@
                 int lower = Integer.valueOf(lo);
                 int upper = Integer.valueOf(up);
 
-                Date fromYear = getStartDateFromYear(lower);
-                Date toYear   = getEndDateFromYear(upper);
+                Date fromYear = LineParser.getStartDateFromYear(lower);
+                Date toYear   = LineParser.getEndDateFromYear(upper);
 
                 obj.setTimeInterval(new ImportTimeInterval(fromYear, toYear));
             }
diff -r f40d236098c1 -r cc11780b3491 backend/src/main/java/org/dive4elements/river/importer/parsers/LineParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/LineParser.java	Wed Jun 12 11:27:36 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/LineParser.java	Wed Jun 12 11:43:34 2013 +0200
@@ -147,7 +147,7 @@
     }
 
 
-    /** Create Date on las moment (31st dec) of given year. */
+    /** Create Date on last moment (31st dec) of given year. */
     public static Date getEndDateFromYear(int year) {
         Calendar cal = Calendar.getInstance();
 	cal.clear();


More information about the Dive4elements-commits mailing list