diff flys-backend/src/main/java/de/intevation/flys/importer/ImportRange.java @ 189:bc3747a371cc

First part of parsing main values. flys-backend/trunk@1520 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 18 Mar 2011 16:12:24 +0000
parents 003ac16812dd
children 3169b559ca3c
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportRange.java	Fri Mar 18 12:10:33 2011 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportRange.java	Fri Mar 18 16:12:24 2011 +0000
@@ -17,20 +17,20 @@
 {
     private static Logger log = Logger.getLogger(ImportRange.class);
 
-    protected Double from;
-    protected Double to;
+    protected BigDecimal a;
+    protected BigDecimal b;
 
     protected Range peer;
 
     public ImportRange() {
     }
 
-    public ImportRange(Double from, Double to) {
-        this.from = from;
-        this.to   = to;
+    public ImportRange(BigDecimal a, BigDecimal b) {
+        this.a = a;
+        this.b = b;
     }
 
-    private static final int compare(Double a, Double b) {
+    private static final int compare(BigDecimal a, BigDecimal b) {
         if (a == null && b == null) {
             return 0;
         }
@@ -44,25 +44,25 @@
     }
 
     public int compareTo(ImportRange other) {
-        int cmp = compare(from, other.from);
+        int cmp = compare(a, other.a);
         if (cmp != 0) return cmp;
-        return compare(to, other.to);
-    }
-
-    public Double getFrom() {
-        return from;
+        return compare(b, other.b);
     }
 
-    public void setFrom(Double from) {
-        this.from = from;
+    public BigDecimal getA() {
+        return a;
     }
 
-    public Double getTo() {
-        return to;
+    public void setA(BigDecimal a) {
+        this.a = a;
     }
 
-    public void setTo(Double to) {
-        this.to = to;
+    public BigDecimal getB() {
+        return b;
+    }
+
+    public void setB(BigDecimal b) {
+        this.b = b;
     }
 
     public Range getPeer(River river) {
@@ -70,8 +70,6 @@
             Session session = Importer.sessionHolder.get();
             Query query = session.createQuery(
                 "from Range where a=:a and b=:b and river.id=:river");
-            BigDecimal a = from != null ? BigDecimal.valueOf(from) : null;
-            BigDecimal b = to   != null ? BigDecimal.valueOf(to) : null;
             query.setParameter("a", a);
             query.setParameter("b", b);
             query.setParameter("river", river.getId());

http://dive4elements.wald.intevation.org