comparison flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java @ 3087:4a76da133144

Removed repeated x.size() calls from for loops. flys-artifacts/trunk@4684 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 18 Jun 2012 09:16:05 +0000
parents 31772c144725
children 0dd569e9b9f1
comparison
equal deleted inserted replaced
3086:ba7df29264cd 3087:4a76da133144
494 List<XYTextAnnotation> xy = new ArrayList<XYTextAnnotation>(); 494 List<XYTextAnnotation> xy = new ArrayList<XYTextAnnotation>();
495 HashMap<Day, String> names = new HashMap<Day, String>(); 495 HashMap<Day, String> names = new HashMap<Day, String>();
496 496
497 try { 497 try {
498 JSONArray points = new JSONArray((String) o); 498 JSONArray points = new JSONArray((String) o);
499 for (int i = 0; i < points.length(); i++) { 499 for (int i = 0, P = points.length(); i < P; i++) {
500 JSONArray array = points.getJSONArray(i); 500 JSONArray array = points.getJSONArray(i);
501 double x = array.getDouble(0); 501 double x = array.getDouble(0);
502 double y = array.getDouble(1); 502 double y = array.getDouble(1);
503 String name = array.getString(2); 503 String name = array.getString(2);
504 boolean act = array.getBoolean(3); 504 boolean act = array.getBoolean(3);
517 } 517 }
518 518
519 TimeSeriesCollection tsc = new TimeSeriesCollection(); 519 TimeSeriesCollection tsc = new TimeSeriesCollection();
520 tsc.addSeries(series); 520 tsc.addSeries(series);
521 // Add Annotations. 521 // Add Annotations.
522 for (int i = 0; i < series.getItemCount(); i++) { 522 for (int i = 0, S = series.getItemCount(); i < S; i++) {
523 double x = tsc.getXValue(0, i); 523 double x = tsc.getXValue(0, i);
524 double y = tsc.getYValue(0, i); 524 double y = tsc.getYValue(0, i);
525 xy.add(new CollisionFreeXYTextAnnotation( 525 xy.add(new CollisionFreeXYTextAnnotation(
526 names.get(series.getTimePeriod(i)), x, y)); 526 names.get(series.getTimePeriod(i)), x, y));
527 } 527 }

http://dive4elements.wald.intevation.org