annotate backend/src/main/java/org/dive4elements/river/importer/parsers/AbstractSedimentLoadParser.java @ 8081:3ae11daff343

Removed obsolete imports.
author Sascha L. Teichmann <teichmann@intevation.de>
date Mon, 11 Aug 2014 16:41:15 +0200
parents bde5f5ec7c72
children 3bb1c62ad732
rev   line source
8043
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
3 *
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
6 * documentation coming with Dive4Elements River for details.
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
7 */
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
8
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
9 package org.dive4elements.river.importer.parsers;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
10
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
11 import java.io.File;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
12 import java.io.IOException;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
13
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
14 import java.text.NumberFormat;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
15 import java.text.ParseException;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
16
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
17 import java.util.regex.Matcher;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
18 import java.util.regex.Pattern;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
19
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
20 import org.apache.log4j.Logger;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
21
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
22 import org.dive4elements.river.importer.ImporterSession;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
23 import org.dive4elements.river.importer.ImportGrainFraction;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
24 import org.dive4elements.river.importer.ImportTimeInterval;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
25
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
26 import org.dive4elements.river.model.GrainFraction;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
27
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
28 import org.dive4elements.river.utils.DateUtil;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
29 import org.dive4elements.river.utils.EpsilonComparator;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
30
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
31 /** Parses sediment load files. */
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
32 public abstract class AbstractSedimentLoadParser extends LineParser {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
33
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
34 private static final Logger log =
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
35 Logger.getLogger(AbstractSedimentLoadParser.class);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
36
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
37
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
38 public static final NumberFormat nf = NumberFormat.getInstance(DEFAULT_LOCALE);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
39
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
40
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
41 public static final Pattern TIMEINTERVAL_SINGLE =
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
42 Pattern.compile("\\D*([0-9]+?)\\D*");
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
43
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
44 public static final Pattern TIMEINTERVAL_EPOCH =
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
45 Pattern.compile("\\D*([0-9]+?)\\s*-\\s*([0-9]+?)\\D*");
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
46
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
47 public static final Pattern META_FRACTION =
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
48 Pattern.compile("^Fraktion: (.*)");
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
49
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
50 public static final Pattern META_FRACTION_NAME =
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
51 Pattern.compile("^Fraktionsname: (.*)");
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
52
8059
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
53 public static final Pattern META_SQ_TIMEINTERVAL =
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
54 Pattern.compile("^S-Q-Beziehung: (.*)");
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
55
8043
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
56 public static final Pattern META_COLUMN_NAMES =
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
57 Pattern.compile("^Fluss-km.*");
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
58
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
59 public static final Pattern META_GRAIN_SIZE =
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
60 Pattern.compile("([0-9]*,*[0-9]+)-([0-9]*,*[0-9]+) *mm");
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
61
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
62
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
63 protected abstract void handleDataLine(String line);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
64
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
65 /** Initialize SedimentLoadLSs from columns, set the kind
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
66 * with respect to file location (offical epoch or not?) */
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
67 protected abstract void initializeSedimentLoads();
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
68
8056
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents: 8043
diff changeset
69 protected abstract void handleMetaLine(String line)
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents: 8043
diff changeset
70 throws LineParserException;
d86cc6a17b7a Importer: Import sediment load at measurement stations.
Tom Gottfried <tom@intevation.de>
parents: 8043
diff changeset
71
8043
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
72
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
73 protected ImportGrainFraction grainFraction;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
74
8059
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
75 protected ImportTimeInterval sqTimeInterval;
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
76
8043
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
77 protected String description;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
78
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
79 protected String[] columnNames;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
80
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
81 private String upper;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
82
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
83 private String lower;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
84
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
85
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
86 @Override
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
87 public void parse(File file) throws IOException {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
88 description = file.getName();
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
89
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
90 super.parse(file);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
91 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
92
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
93
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
94 @Override
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
95 protected void handleLine(int lineNum, String line) throws LineParserException {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
96 if (line.startsWith(START_META_CHAR)) {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
97 handleMetaLine(stripMetaLine(line));
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
98 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
99 else {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
100 handleDataLine(line);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
101 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
102 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
103
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
104
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
105 public boolean handleMetaFraction(String line) {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
106 Matcher m = META_FRACTION.matcher(line);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
107
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
108 if (m.matches()) {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
109 String interval = m.group(1);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
110
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
111 Matcher sizes = META_GRAIN_SIZE.matcher(interval);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
112 if (sizes.matches()) {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
113 lower = sizes.group(1);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
114 upper = sizes.group(2);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
115
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
116 return true;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
117 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
118
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
119 log.warn("ASLP: Unrecognized grain-size interval. Ignored.");
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
120 return true;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
121
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
122 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
123
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
124 return false;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
125 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
126
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
127
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
128 public boolean handleMetaFractionName(String line) throws LineParserException {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
129 Matcher m = META_FRACTION_NAME.matcher(line);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
130
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
131 if (m.matches()) {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
132 String name = m.group(1);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
133
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
134
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
135 GrainFraction gf = ImporterSession.getInstance().getGrainFraction(name);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
136
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
137 if (gf != null) {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
138
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
139 if (lower != null && upper != null) {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
140 // Validate grain size interval
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
141 try {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
142 Double lowval = nf.parse(lower).doubleValue();
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
143 Double upval = nf.parse(upper).doubleValue();
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
144
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
145 if (EpsilonComparator.CMP.compare(lowval,
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
146 gf.getLower()) != 0 ||
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
147 EpsilonComparator.CMP.compare(upval,
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
148 gf.getUpper()) != 0) {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
149 log.warn("ASLP: Invalid grain size for grain fraction '" +
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
150 name + "'. Ignored.");
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
151 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
152 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
153 catch (ParseException pe) {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
154 log.warn("ASLP: Could not parse grain-size interval. Ignored.");
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
155 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
156 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
157
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
158 grainFraction = new ImportGrainFraction(gf);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
159 return true;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
160 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
161
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
162 throw new LineParserException("ASLP: Unknown grain fraction: '" +
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
163 name + "'");
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
164 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
165
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
166 return false;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
167 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
168
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
169
8059
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
170 public boolean handleMetaSQTimeInterval(String line) {
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
171 Matcher m = META_SQ_TIMEINTERVAL.matcher(line);
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
172
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
173 if (m.matches()) {
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
174 String interval = m.group(1);
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
175
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
176 try {
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
177 Matcher a = TIMEINTERVAL_EPOCH.matcher(interval);
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
178 if (a.matches()) {
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
179 int yearA = nf.parse(a.group(1)).intValue();
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
180 int yearB = nf.parse(a.group(2)).intValue();
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
181
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
182 sqTimeInterval = new ImportTimeInterval(
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
183 DateUtil.getStartDateFromYear(yearA),
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
184 DateUtil.getEndDateFromYear(yearB)
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
185 );
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
186 }
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
187 else {
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
188 log.warn("ASLP: Unknown SQ-time string: '" + interval +
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
189 "'. Ignored.");
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
190 }
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
191 }
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
192 catch (ParseException pe) {
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
193 log.error("ASLP: Could not parse SQ-time string: '" +
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
194 interval + "'. Ignored.", pe);
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
195 }
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
196
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
197 return true;
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
198
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
199 }
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
200
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
201 return false;
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
202 }
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
203
bde5f5ec7c72 SCHEMA CHANGE and Importer: get time intervals of SQ-relations from metalines in sediment load files.
Tom Gottfried <tom@intevation.de>
parents: 8056
diff changeset
204
8043
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
205 public boolean handleColumnNames(String line) throws LineParserException {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
206 Matcher m = META_COLUMN_NAMES.matcher(line);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
207
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
208 if (m.matches()) {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
209 columnNames = line.split(SEPERATOR_CHAR);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
210
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
211 // 'Fluss-km', 'Hinweise' and at least one data column required
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
212 if (columnNames.length < 3) {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
213 throw new LineParserException("ASLP: missing columns in '" +
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
214 line + "'");
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
215 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
216
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
217 initializeSedimentLoads();
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
218
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
219 return true;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
220 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
221
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
222 return false;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
223 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
224
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
225
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
226 protected ImportTimeInterval getTimeInterval(String column) {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
227 try {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
228 Matcher a = TIMEINTERVAL_EPOCH.matcher(column);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
229 if (a.matches()) {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
230 int yearA = nf.parse(a.group(1)).intValue();
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
231 int yearB = nf.parse(a.group(2)).intValue();
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
232
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
233 return new ImportTimeInterval(
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
234 DateUtil.getStartDateFromYear(yearA),
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
235 DateUtil.getEndDateFromYear(yearB)
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
236 );
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
237 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
238
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
239 Matcher b = TIMEINTERVAL_SINGLE.matcher(column);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
240 if (b.matches()) {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
241 int year = nf.parse(b.group(1)).intValue();
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
242
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
243 return new ImportTimeInterval(DateUtil.getStartDateFromYear(year));
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
244 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
245
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
246 log.warn("ASLP: Unknown time interval string: '" + column + "'");
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
247 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
248 catch (ParseException pe) {
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
249 log.warn("ASLP: Could not parse years: " + column, pe);
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
250 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
251
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
252 return null;
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
253 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
254
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
255 }
bd0dea643440 Divide SedimentLoadLSParser into AbstractSedimentLoadParser and SedimentLoadLSParser to be able to reuse code for a new SedimentLoadParser for data at measurement stations.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
256 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org