// Reduce data set values representing the current x pixel
for ( int set = Math.max(startPosition.getSetNumber(), 0) ; set <= endPosition.getSetNumber() ; set++ ) {
DataSet points;
Iterator iterator;
DataPoint point;
double summaryPoint;
double reductionNumerator;
DataSet dataSet;
int nextIndex;
IntegerPair range;
// Find numerator for fraction of summary point set value to keep
summaryPoint = graphContext.getSummaryData().getValue(set, xPixel - xOffset);
if ( set == startPosition.getSetNumber() && set == endPosition.getSetNumber() ) {
reductionNumerator = Math.max(summaryPoint - ( endPosition.getSetOffset() - startPosition.getSetOffset() ), 0);
} else if ( set == startPosition.getSetNumber() ) {
reductionNumerator = startPosition.getSetOffset();
} else if ( set == endPosition.getSetNumber() ) {
reductionNumerator = Math.max(summaryPoint - endPosition.getSetOffset(), 0);
} else {
reductionNumerator = 0;
}
// Reduce data points whose time falls within the single summary pixel
/*
points = graphContext.getData().getDataSet(set).pointsBetween(graphContext.getTimeFromXPixel(xPixel), graphContext.getTimeFromXPixel(xPixel + 1));
iterator = points.iterator();
while ( iterator.hasNext() ) {
point = (DataPoint)(iterator.next());
if ( summaryPoint > 0 )
point.setValue(point.getValue() * reductionNumerator / summaryPoint);
else
point.setValue(0);
}
*/
dataSet = graphContext.getData().getDataSet(set);
if ( startIndicies[set] == -1 )
range = dataSet.pointIndiciesBetween(graphContext.getTimeFromXPixel(xPixel), graphContext.getTimeFromXPixel(xPixel + 1));
else
range = dataSet.pointIndiciesBetween(graphContext.getTimeFromXPixel(xPixel), graphContext.getTimeFromXPixel(xPixel + 1), startIndicies[set]);
nextIndex = range.first;
while ( nextIndex <= range.second ) {
point = dataSet.elementAt(nextIndex);
if ( summaryPoint > 0 )
point.setValue(point.getValue() * reductionNumerator / summaryPoint);
else
point.setValue(0);
nextIndex++;
}
startIndicies[set] = range.second;
}
//logger.debug("Fragmented column after decimation:");