comparison gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java @ 642:83f8f98a4f11

Log important values used for gap detection if debug level is enabled. gnv-artifacts/trunk@728 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 03 Mar 2010 16:26:19 +0000
parents 4cbcc130cffc
children b98d1adee7a6
comparison
equal deleted inserted replaced
641:8d2bd52f05e3 642:83f8f98a4f11
49 49
50 private static final String DATE_FORMAT = "chart.timeseries.date.format"; 50 private static final String DATE_FORMAT = "chart.timeseries.date.format";
51 51
52 public static final String DEFAULT_DATE_FORMAT = "dd-MMM-yyyy"; 52 public static final String DEFAULT_DATE_FORMAT = "dd-MMM-yyyy";
53 53
54 private static final long NO_TIME_GAP = Long.MAX_VALUE - 1000; 54 public static final long NO_TIME_GAP = Long.MAX_VALUE - 1000;
55 public static final int GAP_SIZE = 5; // in percent
55 56
56 private static Logger log = Logger.getLogger(TimeSeriesChart.class); 57 private static Logger log = Logger.getLogger(TimeSeriesChart.class);
57 58
58 59
59 public TimeSeriesChart( 60 public TimeSeriesChart(
398 int gapID = results[startPos].getInteger("GAPID"); 399 int gapID = results[startPos].getInteger("GAPID");
399 long maxDiff = calculateGapSize( 400 long maxDiff = calculateGapSize(
400 startDate, endDate, startPos, endPos, gapID 401 startDate, endDate, startPos, endPos, gapID
401 ); 402 );
402 403
404 if (log.isDebugEnabled()) {
405 log.debug("*****************************************************");
406 log.debug("Values of gap detection.");
407 log.debug("Start date: " + startDate.toString());
408 log.debug("End date: " + endDate.toString());
409 long diff = endDate.getTime() - startDate.getTime();
410 log.debug("Time difference (in ms): " + diff);
411 log.debug("Time difference (in h): " + (diff/(1000*60*60)));
412 log.debug("Configured gap size (in %): " + GAP_SIZE);
413 log.debug("Calculated gap size (in ms): " + maxDiff);
414 log.debug("Calculated gap size (in h): " + (maxDiff/(1000*60*60)));
415 log.debug("*****************************************************");
416 }
417
403 Date last = startDate; 418 Date last = startDate;
404 for (int i = startPos+1; i < endPos; i++) { 419 for (int i = startPos+1; i < endPos; i++) {
405 Result res = results[i]; 420 Result res = results[i];
406 Date now = res.getDate("XORDINATE"); 421 Date now = res.getDate("XORDINATE");
407 422
425 Date end, 440 Date end,
426 int startPos, 441 int startPos,
427 int endPos, 442 int endPos,
428 int gapID 443 int gapID
429 ){ 444 ){
430 long maxGap = (end.getTime() - start.getTime()) / 20; 445 long maxGap = (end.getTime() - start.getTime()) / 100 * GAP_SIZE;
431 long interval = getTimeGapValue(start, end, startPos, endPos, gapID); 446 long interval = getTimeGapValue(start, end, startPos, endPos, gapID);
432 447
433 if (maxGap < interval) 448 if (maxGap < interval)
434 maxGap = interval + 10; 449 maxGap = interval + 10;
435 450

http://dive4elements.wald.intevation.org