Program: 108096
Project: 108096
Buggy source:
/** 
 * Returns statistics
 * @return
 */
public EquivalenceClassStatistics getEquivalenceClassStatistics(){
  double averageEquivalenceClassSize=0;
  int averageEquivalenceClassSizeCounter=0;
  int maximalEquivalenceClassSize=Integer.MIN_VALUE;
  int minimalEquivalenceClassSize=Integer.MAX_VALUE;
  int numberOfEquivalenceClasses=0;
  int numberOfOutlyingEquivalenceClasses=0;
  int numberOfOutlyingTuples=0;
  HashGroupifyEntry entry=hashTableFirstEntry;
  while (entry != null) {
    if (entry.count > 0) {
      numberOfEquivalenceClasses++;
      if (!entry.isNotOutlier) {
        numberOfOutlyingEquivalenceClasses++;
        numberOfOutlyingTuples+=entry.count;
      }
 else {
        averageEquivalenceClassSizeCounter+=entry.count;
        maximalEquivalenceClassSize=Math.max(maximalEquivalenceClassSize,entry.count);
        minimalEquivalenceClassSize=Math.min(minimalEquivalenceClassSize,entry.count);
      }
    }
    entry=entry.nextOrdered;
  }
  if (minimalEquivalenceClassSize == Integer.MAX_VALUE) {
    minimalEquivalenceClassSize=0;
  }
  if (maximalEquivalenceClassSize == Integer.MIN_VALUE) {
    maximalEquivalenceClassSize=0;
  }
  if (numberOfEquivalenceClasses - numberOfOutlyingEquivalenceClasses == 0) {
    averageEquivalenceClassSize=0;
  }
 else {
    averageEquivalenceClassSize=(double)averageEquivalenceClassSizeCounter / (double)(numberOfEquivalenceClasses - numberOfOutlyingEquivalenceClasses);
  }
  double averageEquivalenceClassSizeAll=averageEquivalenceClassSize;
  int maximalEquivalenceClassSizeAll=maximalEquivalenceClassSize;
  int minimalEquivalenceClassSizeAll=minimalEquivalenceClassSize;
  if (averageEquivalenceClassSize != 0 && numberOfOutlyingTuples > 0) {
    averageEquivalenceClassSizeAll=(double)(averageEquivalenceClassSizeCounter + numberOfOutlyingTuples) / (double)(numberOfEquivalenceClasses - numberOfOutlyingEquivalenceClasses + 1);
    maximalEquivalenceClassSizeAll=Math.max(maximalEquivalenceClassSize,numberOfOutlyingTuples);
    minimalEquivalenceClassSizeAll=Math.min(minimalEquivalenceClassSize,numberOfOutlyingTuples);
  }
 else {
    averageEquivalenceClassSizeAll=0;
    maximalEquivalenceClassSizeAll=0;
    minimalEquivalenceClassSizeAll=0;
  }
  return new EquivalenceClassStatistics(averageEquivalenceClassSize,maximalEquivalenceClassSize,minimalEquivalenceClassSize,averageEquivalenceClassSizeAll,maximalEquivalenceClassSizeAll,minimalEquivalenceClassSizeAll,numberOfEquivalenceClasses,numberOfOutlyingEquivalenceClasses,numberOfOutlyingTuples);
}

Fixed version (ground truth):
/** 
 * Performs sanitization and object creation
 * @param averageEquivalenceClassSizeCounter
 * @param maximalEquivalenceClassSize
 * @param minimalEquivalenceClassSize
 * @param numberOfEquivalenceClasses
 * @param numberOfOutlyingEquivalenceClasses
 * @param numberOfOutlyingTuples
 * @param viewStatistics
 * @return
 */
private EquivalenceClassStatistics getEquivalenceClassStatistics(int averageEquivalenceClassSizeCounter,int maximalEquivalenceClassSize,int minimalEquivalenceClassSize,int numberOfEquivalenceClasses,int numberOfOutlyingEquivalenceClasses,int numberOfOutlyingTuples,EquivalenceClassStatistics viewStatistics){
  double averageEquivalenceClassSize;
  if (minimalEquivalenceClassSize == Integer.MAX_VALUE) {
    minimalEquivalenceClassSize=0;
  }
  if (maximalEquivalenceClassSize == Integer.MIN_VALUE) {
    maximalEquivalenceClassSize=0;
  }
  if (numberOfEquivalenceClasses - numberOfOutlyingEquivalenceClasses == 0) {
    averageEquivalenceClassSize=0;
  }
 else {
    averageEquivalenceClassSize=(double)averageEquivalenceClassSizeCounter / (double)(numberOfEquivalenceClasses - numberOfOutlyingEquivalenceClasses);
  }
  double averageEquivalenceClassSizeAll=averageEquivalenceClassSize;
  int maximalEquivalenceClassSizeAll=maximalEquivalenceClassSize;
  int minimalEquivalenceClassSizeAll=minimalEquivalenceClassSize;
  if (averageEquivalenceClassSize != 0 && numberOfOutlyingTuples > 0) {
    averageEquivalenceClassSizeAll=(double)(averageEquivalenceClassSizeCounter + numberOfOutlyingTuples) / (double)(numberOfEquivalenceClasses - numberOfOutlyingEquivalenceClasses + 1);
    maximalEquivalenceClassSizeAll=Math.max(maximalEquivalenceClassSize,numberOfOutlyingTuples);
    minimalEquivalenceClassSizeAll=Math.min(minimalEquivalenceClassSize,numberOfOutlyingTuples);
  }
 else {
    averageEquivalenceClassSizeAll=0;
    maximalEquivalenceClassSizeAll=0;
    minimalEquivalenceClassSizeAll=0;
  }
  return new EquivalenceClassStatistics(averageEquivalenceClassSize,maximalEquivalenceClassSize,minimalEquivalenceClassSize,averageEquivalenceClassSizeAll,maximalEquivalenceClassSizeAll,minimalEquivalenceClassSizeAll,numberOfEquivalenceClasses,numberOfOutlyingEquivalenceClasses,numberOfOutlyingTuples,viewStatistics);
}