Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/importer/parsers/SedimentLoadLSParser.java @ 8031:6954ac9b7591
Renamed ImportSedimentYield to ImportSedimentLoadLS.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 11 Jul 2014 13:10:05 +0200 |
parents | c915e99d9e52 |
children | fd3a24336e6a |
comparison
equal
deleted
inserted
replaced
8030:fac1aa67931b | 8031:6954ac9b7591 |
---|---|
20 import java.util.regex.Pattern; | 20 import java.util.regex.Pattern; |
21 | 21 |
22 import org.apache.log4j.Logger; | 22 import org.apache.log4j.Logger; |
23 | 23 |
24 import org.dive4elements.river.importer.ImportGrainFraction; | 24 import org.dive4elements.river.importer.ImportGrainFraction; |
25 import org.dive4elements.river.importer.ImportSedimentYield; | 25 import org.dive4elements.river.importer.ImportSedimentLoadLS; |
26 import org.dive4elements.river.importer.ImportSedimentLoadLSValue; | 26 import org.dive4elements.river.importer.ImportSedimentLoadLSValue; |
27 import org.dive4elements.river.importer.ImportTimeInterval; | 27 import org.dive4elements.river.importer.ImportTimeInterval; |
28 import org.dive4elements.river.importer.ImportUnit; | 28 import org.dive4elements.river.importer.ImportUnit; |
29 import org.dive4elements.river.model.GrainFraction; | 29 import org.dive4elements.river.model.GrainFraction; |
30 import org.dive4elements.river.utils.DateUtil; | 30 import org.dive4elements.river.utils.DateUtil; |
90 | 90 |
91 public static final Pattern META_GRAIN_FRACTION_C = | 91 public static final Pattern META_GRAIN_FRACTION_C = |
92 Pattern.compile("(<|>){1}\\s*((([0-9]+?,[0-9]+?)|([0-9]++))\\s*(\\w+))"); | 92 Pattern.compile("(<|>){1}\\s*((([0-9]+?,[0-9]+?)|([0-9]++))\\s*(\\w+))"); |
93 | 93 |
94 | 94 |
95 protected List<ImportSedimentYield> sedimentYields; | 95 protected List<ImportSedimentLoadLS> sedimentYields; |
96 | 96 |
97 protected ImportSedimentYield[] current; | 97 protected ImportSedimentLoadLS[] current; |
98 | 98 |
99 protected ImportGrainFraction grainFraction; | 99 protected ImportGrainFraction grainFraction; |
100 | 100 |
101 protected ImportUnit unit; | 101 protected ImportUnit unit; |
102 | 102 |
104 | 104 |
105 protected String[] columnNames; | 105 protected String[] columnNames; |
106 | 106 |
107 | 107 |
108 public SedimentLoadLSParser() { | 108 public SedimentLoadLSParser() { |
109 sedimentYields = new ArrayList<ImportSedimentYield>(); | 109 sedimentYields = new ArrayList<ImportSedimentLoadLS>(); |
110 } | 110 } |
111 | 111 |
112 | 112 |
113 @Override | 113 @Override |
114 public void parse(File file) throws IOException { | 114 public void parse(File file) throws IOException { |
127 | 127 |
128 | 128 |
129 @Override | 129 @Override |
130 protected void finish() { | 130 protected void finish() { |
131 if (current != null) { | 131 if (current != null) { |
132 for (ImportSedimentYield isy: current) { | 132 for (ImportSedimentLoadLS isy: current) { |
133 sedimentYields.add(isy); | 133 sedimentYields.add(isy); |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 description = null; | 137 description = null; |
245 | 245 |
246 /** Initialize SedimentYields from columns, set the kind | 246 /** Initialize SedimentYields from columns, set the kind |
247 * with respect to file location (offical epoch or not?) */ | 247 * with respect to file location (offical epoch or not?) */ |
248 private void initializeSedimentYields() { | 248 private void initializeSedimentYields() { |
249 // skip first column (Fluss-km) and last column (Hinweise) | 249 // skip first column (Fluss-km) and last column (Hinweise) |
250 current = new ImportSedimentYield[columnNames.length-2]; | 250 current = new ImportSedimentLoadLS[columnNames.length-2]; |
251 | 251 |
252 Integer kind; | 252 Integer kind; |
253 | 253 |
254 if (inputFile.getAbsolutePath().contains("amtliche Epochen")) { | 254 if (inputFile.getAbsolutePath().contains("amtliche Epochen")) { |
255 kind = new Integer(1); | 255 kind = new Integer(1); |
257 else { | 257 else { |
258 kind = new Integer(0); | 258 kind = new Integer(0); |
259 } | 259 } |
260 | 260 |
261 for (int i = 0, n = columnNames.length; i < n-2; i++) { | 261 for (int i = 0, n = columnNames.length; i < n-2; i++) { |
262 current[i] = new ImportSedimentYield(this.description); | 262 current[i] = new ImportSedimentLoadLS(this.description); |
263 current[i].setTimeInterval(getTimeInterval(columnNames[i+1])); | 263 current[i].setTimeInterval(getTimeInterval(columnNames[i+1])); |
264 current[i].setUnit(unit); | 264 current[i].setUnit(unit); |
265 current[i].setGrainFraction(grainFraction); | 265 current[i].setGrainFraction(grainFraction); |
266 current[i].setKind(kind); | 266 current[i].setKind(kind); |
267 } | 267 } |
405 return GrainFraction.UNKNOWN; | 405 return GrainFraction.UNKNOWN; |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 | 409 |
410 public List<ImportSedimentYield> getSedimentYields() { | 410 public List<ImportSedimentLoadLS> getSedimentYields() { |
411 return sedimentYields; | 411 return sedimentYields; |
412 } | 412 } |
413 } | 413 } |
414 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 414 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |