Program: 47775
Project: 47775
Buggy source:
/** 
 * Returns the range of y-values in the specified dataset for the data items belonging to the visible series and with x-values in the given range.
 * @param dataset  the dataset ({@code null} not permitted).
 * @param visibleSeriesKeys  the visible series keys ({@code null} notpermitted).
 * @param xRange  the x-range ({@code null} not permitted).
 * @param includeInterval  a flag that determines whether or not they-interval for the dataset is included (this only applies if the dataset is an instance of IntervalXYDataset).
 * @return The y-range (possibly {@code null}).
 * @since 1.0.13
 */
public static Range iterateToFindRangeBounds(XYDataset dataset,List<Comparable> visibleSeriesKeys,Range xRange,boolean includeInterval){
  ParamChecks.nullNotPermitted(dataset,"String_Node_Str");
  ParamChecks.nullNotPermitted(visibleSeriesKeys,"String_Node_Str");
  ParamChecks.nullNotPermitted(xRange,"String_Node_Str");
  double minimum=Double.POSITIVE_INFINITY;
  double maximum=Double.NEGATIVE_INFINITY;
  if (includeInterval && dataset instanceof OHLCDataset) {
    OHLCDataset ohlc=(OHLCDataset)dataset;
    for (    Comparable seriesKey : visibleSeriesKeys) {
      int series=dataset.indexOf(seriesKey);
      int itemCount=dataset.getItemCount(series);
      for (int item=0; item < itemCount; item++) {
        double x=ohlc.getXValue(series,item);
        if (xRange.contains(x)) {
          double lvalue=ohlc.getLowValue(series,item);
          double uvalue=ohlc.getHighValue(series,item);
          if (!Double.isNaN(lvalue)) {
            minimum=Math.min(minimum,lvalue);
          }
          if (!Double.isNaN(uvalue)) {
            maximum=Math.max(maximum,uvalue);
          }
        }
      }
    }
  }
 else   if (includeInterval && dataset instanceof BoxAndWhiskerXYDataset) {
    BoxAndWhiskerXYDataset bx=(BoxAndWhiskerXYDataset)dataset;
    for (    Comparable seriesKey : visibleSeriesKeys) {
      int series=dataset.indexOf(seriesKey);
      int itemCount=dataset.getItemCount(series);
      for (int item=0; item < itemCount; item++) {
        double x=bx.getXValue(series,item);
        if (xRange.contains(x)) {
          Number lvalue=bx.getMinRegularValue(series,item);
          Number uvalue=bx.getMaxRegularValue(series,item);
          if (lvalue != null) {
            minimum=Math.min(minimum,lvalue.doubleValue());
          }
          if (uvalue != null) {
            maximum=Math.max(maximum,uvalue.doubleValue());
          }
        }
      }
    }
  }
 else   if (includeInterval && dataset instanceof IntervalXYDataset) {
    IntervalXYDataset ixyd=(IntervalXYDataset)dataset;
    for (    Comparable seriesKey : visibleSeriesKeys) {
      int series=dataset.indexOf(seriesKey);
      int itemCount=dataset.getItemCount(series);
      for (int item=0; item < itemCount; item++) {
        double x=ixyd.getXValue(series,item);
        if (xRange.contains(x)) {
          double lvalue=ixyd.getStartYValue(series,item);
          double uvalue=ixyd.getEndYValue(series,item);
          if (!Double.isNaN(lvalue)) {
            minimum=Math.min(minimum,lvalue);
          }
          if (!Double.isNaN(uvalue)) {
            maximum=Math.max(maximum,uvalue);
          }
        }
      }
    }
  }
 else {
    for (    Comparable seriesKey : visibleSeriesKeys) {
      int series=dataset.indexOf(seriesKey);
      int itemCount=dataset.getItemCount(series);
      for (int item=0; item < itemCount; item++) {
        double x=dataset.getXValue(series,item);
        double y=dataset.getYValue(series,item);
        if (xRange.contains(x)) {
          if (!Double.isNaN(y)) {
            minimum=Math.min(minimum,y);
            maximum=Math.max(maximum,y);
          }
        }
      }
    }
  }
  if (minimum == Double.POSITIVE_INFINITY) {
    return null;
  }
 else {
    return new Range(minimum,maximum);
  }
}

Fixed version (ground truth):
/** 
 * Returns the range of y-values in the specified dataset for the data items belonging to the visible series and with x-values in the given range.
 * @param dataset  the dataset ({@code null} not permitted).
 * @param visibleSeriesKeys  the visible series keys ({@code null} notpermitted).
 * @param xRange  the x-range ({@code null} not permitted).
 * @param includeInterval  a flag that determines whether or not they-interval for the dataset is included (this only applies if the dataset is an instance of IntervalXYDataset).
 * @return The y-range (possibly {@code null}).
 * @since 1.0.13
 */
public static Range iterateToFindRangeBounds(XYDataset dataset,List<Comparable> visibleSeriesKeys,Range xRange,boolean includeInterval){
  ParamChecks.nullNotPermitted(dataset,"String_Node_Str");
  ParamChecks.nullNotPermitted(visibleSeriesKeys,"String_Node_Str");
  ParamChecks.nullNotPermitted(xRange,"String_Node_Str");
  double minimum=Double.POSITIVE_INFINITY;
  double maximum=Double.NEGATIVE_INFINITY;
  if (includeInterval && dataset instanceof OHLCDataset) {
    OHLCDataset ohlc=(OHLCDataset)dataset;
    for (    Comparable seriesKey : visibleSeriesKeys) {
      int series=dataset.indexOf(seriesKey);
      int itemCount=dataset.getItemCount(series);
      for (int item=0; item < itemCount; item++) {
        double x=ohlc.getXValue(series,item);
        if (xRange.contains(x)) {
          double lvalue=ohlc.getLowValue(series,item);
          double uvalue=ohlc.getHighValue(series,item);
          if (!Double.isNaN(lvalue)) {
            minimum=Math.min(minimum,lvalue);
          }
          if (!Double.isNaN(uvalue)) {
            maximum=Math.max(maximum,uvalue);
          }
        }
      }
    }
  }
 else   if (includeInterval && dataset instanceof BoxAndWhiskerXYDataset) {
    BoxAndWhiskerXYDataset bx=(BoxAndWhiskerXYDataset)dataset;
    for (    Comparable seriesKey : visibleSeriesKeys) {
      int series=dataset.indexOf(seriesKey);
      int itemCount=dataset.getItemCount(series);
      for (int item=0; item < itemCount; item++) {
        double x=bx.getXValue(series,item);
        if (xRange.contains(x)) {
          Number lvalue=bx.getMinRegularValue(series,item);
          Number uvalue=bx.getMaxRegularValue(series,item);
          if (lvalue != null) {
            minimum=Math.min(minimum,lvalue.doubleValue());
          }
          if (uvalue != null) {
            maximum=Math.max(maximum,uvalue.doubleValue());
          }
        }
      }
    }
  }
 else   if (includeInterval && dataset instanceof IntervalXYDataset) {
    IntervalXYDataset ixyd=(IntervalXYDataset)dataset;
    for (    Comparable seriesKey : visibleSeriesKeys) {
      int series=dataset.indexOf(seriesKey);
      int itemCount=dataset.getItemCount(series);
      for (int item=0; item < itemCount; item++) {
        double x=ixyd.getXValue(series,item);
        if (xRange.contains(x)) {
          double yvalue=ixyd.getYValue(series,item);
          double lvalue=ixyd.getStartYValue(series,item);
          double uvalue=ixyd.getEndYValue(series,item);
          if (!Double.isNaN(yvalue)) {
            minimum=Math.min(minimum,yvalue);
            maximum=Math.max(maximum,yvalue);
          }
          if (!Double.isNaN(lvalue)) {
            minimum=Math.min(minimum,lvalue);
          }
          if (!Double.isNaN(uvalue)) {
            maximum=Math.max(maximum,uvalue);
          }
        }
      }
    }
  }
 else {
    for (    Comparable seriesKey : visibleSeriesKeys) {
      int series=dataset.indexOf(seriesKey);
      int itemCount=dataset.getItemCount(series);
      for (int item=0; item < itemCount; item++) {
        double x=dataset.getXValue(series,item);
        double y=dataset.getYValue(series,item);
        if (xRange.contains(x)) {
          if (!Double.isNaN(y)) {
            minimum=Math.min(minimum,y);
            maximum=Math.max(maximum,y);
          }
        }
      }
    }
  }
  if (minimum == Double.POSITIVE_INFINITY) {
    return null;
  }
 else {
    return new Range(minimum,maximum);
  }
}