Range mzRange = null, rtRange = null;
// Check the peaks for selected data files
for (RawDataFile dataFile : dataFiles) {
ChromatographicPeak peak = peakListRow.getPeak(dataFile);
if (peak == null)
continue;
if ((mzRange == null) || (rtRange == null)) {
mzRange = new Range(peak.getRawDataPointsMZRange());
rtRange = new Range(peak.getRawDataPointsRTRange());
} else {
mzRange.extendRange(peak.getRawDataPointsMZRange());
rtRange.extendRange(peak.getRawDataPointsRTRange());
}
}
// If none of the data files had a peak, check the whole row
if (mzRange == null) {
for (ChromatographicPeak peak : peakListRow.getPeaks()) {
if (peak == null)
continue;
if ((mzRange == null) || (rtRange == null)) {
mzRange = new Range(peak.getRawDataPointsMZRange());
rtRange = new Range(peak.getRawDataPointsRTRange());
} else {
mzRange.extendRange(peak.getRawDataPointsMZRange());
rtRange.extendRange(peak.getRawDataPointsRTRange());
}
}
}