comparison flys-backend/src/main/java/de/intevation/flys/importer/AnnotationsParser.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 cf8cbcb6a10d
children d37ccb04ab5d
comparison
equal deleted inserted replaced
188:003ac16812dd 189:bc3747a371cc
8 import java.io.IOException; 8 import java.io.IOException;
9 import java.io.File; 9 import java.io.File;
10 import java.io.LineNumberReader; 10 import java.io.LineNumberReader;
11 import java.io.InputStreamReader; 11 import java.io.InputStreamReader;
12 import java.io.FileInputStream; 12 import java.io.FileInputStream;
13
14 import java.math.BigDecimal;
13 15
14 import org.apache.log4j.Logger; 16 import org.apache.log4j.Logger;
15 17
16 import de.intevation.flys.utils.FileTools; 18 import de.intevation.flys.utils.FileTools;
17 19
72 attributes.put(parts[1], attribute); 74 attributes.put(parts[1], attribute);
73 } 75 }
74 76
75 String [] r = parts[2].replace(",", ".").split("\\s*#\\s*"); 77 String [] r = parts[2].replace(",", ".").split("\\s*#\\s*");
76 78
77 Double from, to; 79 BigDecimal from, to;
78 80
79 try { 81 try {
80 from = Double.valueOf(r[0]); 82 from = new BigDecimal(r[0]);
81 to = r.length < 2 ? null : Double.valueOf(r[1]); 83 to = r.length < 2 ? null : new BigDecimal(r[1]);
82 if (to != null && from > to) { 84 if (to != null && from.compareTo(to) > 0) {
83 Double t = from; from = to; to = t; 85 BigDecimal t = from; from = to; to = t;
84 } 86 }
85 } 87 }
86 catch (NumberFormatException nfe) { 88 catch (NumberFormatException nfe) {
87 log.warn("invalid number in line " + in.getLineNumber()); 89 log.warn("invalid number in line " + in.getLineNumber());
88 continue; 90 continue;

http://dive4elements.wald.intevation.org