changeset 2378:c5d83366d0b1

CrossSectionLine: Simplified creation of Point2Ds. flys-backend/trunk@3687 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 16 Jan 2012 14:16:52 +0000
parents d183ae164cfc
children 8be27b950dbe
files flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/model/CrossSectionLine.java
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Tue Jan 10 10:33:14 2012 +0000
+++ b/flys-backend/ChangeLog	Mon Jan 16 14:16:52 2012 +0000
@@ -1,3 +1,8 @@
+2012-01-16	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/CrossSectionLine.java
+	  (fetchCrossSectionLinesPoints): Simplified and prevent reallocations.
+
 2012-01-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/importer/parsers/StaFileParser.java:
--- a/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionLine.java	Tue Jan 10 10:33:14 2012 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionLine.java	Mon Jan 16 14:16:52 2012 +0000
@@ -119,18 +119,13 @@
 
 
     public List<Point2D> fetchCrossSectionLinesPoints() {
-        List<Point2D> points = new ArrayList<Point2D>();
-
-        List<CrossSectionPoint> linePoints = getPoints();
 
-        if (linePoints.isEmpty()) {
-            logger.info("No points in selected CrossSectionLine.");
-            return points;
-        }
+        List<CrossSectionPoint> linePoints = 
+            new ArrayList<CrossSectionPoint>(getPoints());
 
-        linePoints = new ArrayList(linePoints);
         Collections.sort(linePoints, COL_POS_CMP);
 
+        List<Point2D> points = new ArrayList<Point2D>(linePoints.size());
         for (CrossSectionPoint p: linePoints) {
             double x = p.getX().doubleValue();
             double y = p.getY().doubleValue();

http://dive4elements.wald.intevation.org