/**
 * Calculates suspiciousness and confidence values according to the Op2 fault localization
 * technique.
 * The usage mode is to create a coverage matrix that specifies which program
 * elements are executed by which test cases. In terms of this implementation, each program element called
 * a statement. coverage matrix is encoded as a two dimensional array where the first dimension is indexed by
 * the test case number and the second dimension is indexed by the statement number.
 */
public class Op2 {
  private boolean[][] coverageMatrix; // coverage matrix -- [test][statement]

  private int numberOfTests; // number of test cases
  private int numberOfStatements; // number of statements

  /**
   * Constructor of Op2 class
   */
  public Op2(boolean[][] coverageMatrix) {
    this.coverageMatrix = coverageMatrix;
    numberOfTests = coverageMatrix.length;
    numberOfStatements = coverageMatrix[0].length;

  }

}

@@ -582,16 +582,253 @@
 atement%5D
+%0A  private boolean%5B%5D liveTestCases; // live test cases -- %5Btest%5D%0A  private boolean%5B%5D badCoverage; // bad coverage (no coverage information, usually due to a segmentation fault) -- %5Btest%5D%0A  private boolean isBadCoverageCalculated = false;
 %0A%0A  priv
@@ -933,16 +933,17 @@
 ements%0A%0A
+%0A
   /**%0A  
@@ -1156,15 +1156,712 @@
 ength;%0A%0A
+    // initialize so that all test cases are live%0A    liveTestCases = new boolean%5BnumberOfTests%5D;%0A    for (int i = 0; i %3C liveTestCases.length; i++) %7B%0A      liveTestCases%5Bi%5D = true;%0A    %7D%0A%0A  %7D%0A%0A  private void calculateBadTestCoverage() %7B%0A    if (isBadCoverageCalculated)%0A      return;%0A    badCoverage = new boolean%5BnumberOfTests%5D;%0A    for (int i = 0; i %3C numberOfTests; i++) %7B%0A      badCoverage%5Bi%5D = true;%0A      for (int j = 0; j %3C numberOfStatements; j++) %7B%0A        //if there is a statement covered for this test case this is not a bad test case%0A        if (coverageMatrix%5Bi%5D%5Bj%5D) %7B%0A          badCoverage%5Bi%5D = false;%0A          break;%0A        %7D%0A      %7D%0A      isBadCoverageCalculated = true;%0A    %7D%0A
   %7D%0A%0A%7D%0A

initialize live test cases and calculate bad test coverage