Program: 59306
Project: 59306
Buggy source:
/** 
 * Combine two aggregate sets according to the passed reducer. The resulting aggregate set will have a realized subset region sufficient to cover the realized subset region of both source aggregate sets (regardless of  the values found in those sources).  If one of the two aggregate sets provided is already of sufficient size, it will be used as both a source and a target.
 * @param left Aggregate set to use for left-hand arguments
 * @param right Aggregate set to use for right-hand arguments
 * @param red Reduction operation
 * @return Resulting aggregate set (may be new or a destructively updated left or right parameter) 
 */
public static <T>Aggregates<T> horizontalRollup(Aggregates<T> left,Aggregates<T> right,Aggregator<?,T> red){
  if (left == null) {
    return right;
  }
  if (right == null) {
    return left;
  }
  T identity=red.identity();
  if ((left instanceof ConstantAggregates) && Util.isEqual(identity,left.defaultValue())) {
    return right;
  }
  if ((right instanceof ConstantAggregates) && Util.isEqual(identity,right.defaultValue())) {
    return right;
  }
  List<Aggregates<T>> sources=new ArrayList<Aggregates<T>>();
  Aggregates<T> target;
  Rectangle rb=new Rectangle(right.lowX(),right.lowY(),right.highX() - right.lowX(),right.highY() - right.lowY());
  Rectangle lb=new Rectangle(left.lowX(),left.lowY(),left.highX() - left.lowX(),left.highY() - left.lowY());
  Rectangle bounds=rb.union(lb);
  if (lb.contains(bounds)) {
    target=left;
    sources.add(right);
  }
 else   if (rb.contains(bounds)) {
    target=right;
    sources.add(left);
  }
 else {
    sources.add(left);
    sources.add(right);
    target=new FlatAggregates<T>(bounds.x,bounds.y,bounds.x + bounds.width,bounds.y + bounds.height,red.identity());
  }
  for (  Aggregates<T> source : sources) {
    for (int x=Math.max(0,source.lowX()); x < source.highX(); x++) {
      for (int y=Math.max(0,source.lowY()); y < source.highY(); y++) {
        T comb=red.rollup(Arrays.asList(target.get(x,y),source.get(x,y)));
        target.set(x,y,comb);
      }
    }
  }
  return target;
}

Fixed version (ground truth):
/** 
 * Combine two aggregate sets according to the passed reducer. The resulting aggregate set will have a realized subset region sufficient to cover the realized subset region of both source aggregate sets (regardless of  the values found in those sources).  If one of the two aggregate sets provided is already of sufficient size, it will be used as both a source and a target.
 * @param left Aggregate set to use for left-hand arguments
 * @param right Aggregate set to use for right-hand arguments
 * @param red Reduction operation
 * @return Resulting aggregate set (may be new or a destructively updated left or right parameter) 
 */
public static <T>Aggregates<T> horizontalRollup(Aggregates<T> left,Aggregates<T> right,Aggregator<?,T> red){
  if (left == null) {
    return right;
  }
  if (right == null) {
    return left;
  }
  T identity=red.identity();
  if ((left instanceof ConstantAggregates) && Util.isEqual(identity,left.defaultValue())) {
    return right;
  }
  if ((right instanceof ConstantAggregates) && Util.isEqual(identity,right.defaultValue())) {
    return left;
  }
  List<Aggregates<T>> sources=new ArrayList<Aggregates<T>>();
  Aggregates<T> target;
  Rectangle rb=new Rectangle(right.lowX(),right.lowY(),right.highX() - right.lowX(),right.highY() - right.lowY());
  Rectangle lb=new Rectangle(left.lowX(),left.lowY(),left.highX() - left.lowX(),left.highY() - left.lowY());
  Rectangle bounds=rb.union(lb);
  if (lb.contains(bounds)) {
    target=left;
    sources.add(right);
  }
 else   if (rb.contains(bounds)) {
    target=right;
    sources.add(left);
  }
 else {
    sources.add(left);
    sources.add(right);
    target=new FlatAggregates<T>(bounds.x,bounds.y,bounds.x + bounds.width,bounds.y + bounds.height,red.identity());
  }
  for (  Aggregates<T> source : sources) {
    for (int x=Math.max(0,source.lowX()); x < source.highX(); x++) {
      for (int y=Math.max(0,source.lowY()); y < source.highY(); y++) {
        T comb=red.rollup(Arrays.asList(target.get(x,y),source.get(x,y)));
        target.set(x,y,comb);
      }
    }
  }
  return target;
}