Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java @ 6029:f9c5e1a8032d
WstParser: set column names from specified line also if unspecified line does not exist
author | Tom Gottfried <tom.gottfried@intevation.de> |
---|---|
date | Thu, 16 May 2013 12:34:23 +0200 |
parents | 25d927cb4b25 |
children | 53d08f33d094 |
comparison
equal
deleted
inserted
replaced
6028:25d927cb4b25 | 6029:f9c5e1a8032d |
---|---|
246 if (firstAbfluesse != null) { | 246 if (firstAbfluesse != null) { |
247 if (!columnHeaderChecked) { | 247 if (!columnHeaderChecked) { |
248 int unknownCount = 0; | 248 int unknownCount = 0; |
249 HashSet<String> uniqueColumnNames = | 249 HashSet<String> uniqueColumnNames = |
250 new HashSet<String>(); | 250 new HashSet<String>(); |
251 if (langBezeichner != null) { | |
252 // use column name from '*!column-bez-text'-line | |
253 lsBezeichner = StringUtil.fitArray( | |
254 langBezeichner, lsBezeichner); | |
255 } | |
251 for (int i = 0; i < lsBezeichner.length; ++i) { | 256 for (int i = 0; i < lsBezeichner.length; ++i) { |
252 if (lsBezeichner[i] == null | 257 if (lsBezeichner[i] == null |
253 || lsBezeichner[i].length() == 0) { | 258 || lsBezeichner[i].length() == 0) { |
259 // generate alternative column names | |
254 double q = firstAbfluesse[i].doubleValue(); | 260 double q = firstAbfluesse[i].doubleValue(); |
255 if (q < 0.001) { | 261 if (q < 0.001) { |
256 lsBezeichner[i] = | 262 lsBezeichner[i] = |
257 "<unbekannt #" + unknownCount + ">"; | 263 "<unbekannt #" + unknownCount + ">"; |
258 ++unknownCount; | 264 ++unknownCount; |
307 } | 313 } |
308 | 314 |
309 } | 315 } |
310 else { // firstAbfluesse == null | 316 else { // firstAbfluesse == null |
311 if (langBezeichner != null) { | 317 if (langBezeichner != null) { |
312 lsBezeichner = StringUtil.fitArray( | 318 // nothing to do |
313 langBezeichner, lsBezeichner); | |
314 } | 319 } |
315 else if (colNaWidths != null) { | 320 else if (colNaWidths != null) { |
316 for (int j = 0, i = 0, N = input.length(); | 321 for (int j = 0, i = 0, N = input.length(); |
317 j < colNaWidths.length && i < N; | 322 j < colNaWidths.length && i < N; |
318 i += colNaWidths[j++] | 323 i += colNaWidths[j++] |