diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 650:6695e03e9b82

Added parser for segments flys-artifacts/trunk@2043 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 01 Jun 2011 17:01:44 +0000
parents f0c1250d1e7b
children 913b52064449
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Wed Jun 01 09:57:22 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Wed Jun 01 17:01:44 2011 +0000
@@ -2,6 +2,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -37,8 +38,11 @@
 import de.intevation.flys.model.River;
 
 import de.intevation.flys.artifacts.context.FLYSContext;
+
 import de.intevation.flys.artifacts.model.DischargeTables;
 import de.intevation.flys.artifacts.model.RiverFactory;
+import de.intevation.flys.artifacts.model.Segment;
+
 import de.intevation.flys.artifacts.states.DefaultState;
 import de.intevation.flys.artifacts.states.LocationDistanceSelect;
 
@@ -746,6 +750,20 @@
         }
     }
 
+    public List<Segment> getSegments() {
+        StateData wqValues = getData("wq_values");
+        if (wqValues == null) {
+            logger.warn("no wq_values given");
+            return Collections.emptyList();
+        }
+        String input = (String)wqValues.getValue();
+        if (input == null || (input = input.trim()).length() == 0) {
+            logger.warn("wq_values are empty");
+            return Collections.emptyList();
+        }
+        return Segment.parseSegments(input);
+    }
+
 
     /**
      * Returns the Qs for a number of Ws. This method makes use of

http://dive4elements.wald.intevation.org