comparison flys-backend/src/main/java/de/intevation/flys/importer/PegelGltParser.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 5391c329168c
comparison
equal deleted inserted replaced
188:003ac16812dd 189:bc3747a371cc
3 import java.io.File; 3 import java.io.File;
4 4
5 import java.util.List; 5 import java.util.List;
6 import java.util.ArrayList; 6 import java.util.ArrayList;
7 7
8 import java.util.regex.Pattern;
9 import java.util.regex.Matcher;
10
11 import java.io.IOException; 8 import java.io.IOException;
12 import java.io.LineNumberReader; 9 import java.io.LineNumberReader;
13 import java.io.FileInputStream; 10 import java.io.FileInputStream;
14 import java.io.InputStreamReader; 11 import java.io.InputStreamReader;
12
13 import java.math.BigDecimal;
15 14
16 import org.apache.log4j.Logger; 15 import org.apache.log4j.Logger;
17 16
18 import de.intevation.flys.utils.FileTools; 17 import de.intevation.flys.utils.FileTools;
19 18
69 log.warn("line " + in.getLineNumber() 68 log.warn("line " + in.getLineNumber()
70 + " has not enough columns"); 69 + " has not enough columns");
71 continue; 70 continue;
72 } 71 }
73 72
74 double from = Double.parseDouble(parts[0].replace(",", ".")); 73 BigDecimal from = new BigDecimal(parts[0].replace(",", "."));
75 double to = Double.parseDouble(parts[1].replace(",", ".")); 74 BigDecimal to = new BigDecimal(parts[1].replace(",", "."));
76 if (to < from) { double t = from; from = to; to = t; } 75 if (to.compareTo(from) > 0) {
76 BigDecimal t = from; from = to; to = t;
77 }
77 ImportRange range = new ImportRange(from, to); 78 ImportRange range = new ImportRange(from, to);
78 File staFile = FileTools.repair(new File(parent, parts[2])); 79 File staFile = FileTools.repair(new File(parent, parts[2]));
79 File atFile = FileTools.repair(new File(parent, parts[3])); 80 File atFile = FileTools.repair(new File(parent, parts[3]));
80 81
81 if (log.isDebugEnabled()) { 82 if (log.isDebugEnabled()) {

http://dive4elements.wald.intevation.org