changeset 6295:1173e9f47b52

Remove code dupe, doc.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 12 Jun 2013 11:43:34 +0200
parents 0647d7f5a275
children 4c2025ec109f d518a42cdcd3
files backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java backend/src/main/java/org/dive4elements/river/importer/parsers/LineParser.java
diffstat 2 files changed, 4 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- 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 {
 
@@ -156,23 +157,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);
 
@@ -243,8 +227,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));
             }
--- 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();

http://dive4elements.wald.intevation.org