Mercurial > dive4elements > river
diff flys-backend/src/main/java/de/intevation/flys/importer/StaFileParser.java @ 195:8d3533a03e10
Second part of parsing/storing main values. Should be finished now.
flys-backend/trunk@1534 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 21 Mar 2011 15:06:47 +0000 |
parents | f1fce41347ea |
children | cce054f27dac |
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/StaFileParser.java Mon Mar 21 10:52:33 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/StaFileParser.java Mon Mar 21 15:06:47 2011 +0000 @@ -12,6 +12,7 @@ import java.util.regex.Matcher; import java.util.HashMap; +import java.util.ArrayList; import org.apache.log4j.Logger; @@ -99,6 +100,12 @@ HashMap<String, ImportMainValueType> types = new HashMap<String, ImportMainValueType>(); + ArrayList<ImportNamedMainValue> namedMainValues = + new ArrayList<ImportNamedMainValue>(); + + ArrayList<ImportMainValue> mainValues = + new ArrayList<ImportMainValue>(); + while ((line = in.readLine()) != null) { Matcher m = QWTD_.matcher(line); if (m.matches()) { @@ -118,11 +125,24 @@ type = new ImportMainValueType(typeString); types.put(typeString, type); } + String name = m.group(1); + ImportNamedMainValue namedMainValue = + new ImportNamedMainValue(type, name); + namedMainValues.add(namedMainValue); + + ImportMainValue mainValue = + new ImportMainValue(gauge, namedMainValue, value); + + mainValues.add(mainValue); } else { // TODO: treat as a comment } } + gauge.setMainValueTypes( + new ArrayList<ImportMainValueType>(types.values())); + gauge.setNamedMainValues(namedMainValues); + gauge.setMainValues(mainValues); } finally { if (in != null) {