[Demonstration 1]

[Buggy Method]
public long output(long input) {
    return outputMap.get(input);
}

[Buggy Hunk]
return outputMap.get(input);

[Patch]
return this.outputMap.get(input);

[Demonstration 2]

[Buggy Method]
public void train(List<List<Note>> data) {
    int[] counter = new int[matrixSize];
    int a = 0;
    int b = 0;
    for (List<Note> song : data) {
        Note prev = song.get(0);
        for (int i = 1; i < song.size(); i++) {
            a = prev.getmatrixPosition();
            b = song.get(i).getmatrixPosition();
            transitionMatrix.set(b, a, transitionMatrix.get(b, a));
            counter[a]++;
            prev = song.get(i);
        }
    }
    for (int i = 0; i < matrixSize; i++) {
        for (int j = 0; j < matrixSize; j++) {
            if (counter[i] == 0) {
                counter[i] = 1;
            }
            transitionMatrix.set(i, j, transitionMatrix.get(i, j) / counter[i]);
        }
    }
}

[Buggy Hunk]
transitionMatrix.set(b, a, transitionMatrix.get(b, a));

[Patch]
transitionMatrix.set(b, a, transitionMatrix.get(b, a) + 1);

[Demonstration 3]

[Buggy Method]
@Override
protected Task<Void> createTask() {
    return new Task<Void>() {

        @Override
        protected Void call() throws Exception {
            updateProgress(-1, fileList.size());
            compress(9);
            byte[] buffer = new byte[1024];
            try {
                FileOutputStream fos = new FileOutputStream(outputZipFile);
                ZipOutputStream zos = new ZipOutputStream(fos);
                zos.setLevel(compressionLevel);
                System.out.println("Output to Zip : " + outputZipFile);
                long startTime = 0;
                long endTime = 0;
                double timeDiffs = 0;
                for (int counter = 0; counter < fileList.size(); counter++) {
                    String file = fileList.get(counter);
                    try {
                        updateProgress(counter, fileList.size());
                        updateMessage(String.valueOf(counter) + "/" + String.valueOf(fileList.size()) + System.getProperty("line.separator") + file);
                        clearLine();
                        timeDiffs += (endTime - startTime) / 1000000000;
                        double eta = estimatedTimeRemaining(timeDiffs, counter, fileList.size());
                        System.out.printf("\rAdding %d / %d ETA: %.0f seconds | %.2f minutes | %.2f hours rate: %f files/second %s", counter, fileList.size(), eta, eta / 60, eta / 3600, numFilesPerSecond(timeDiffs, counter), file);
                        startTime = System.nanoTime();
                        // System.out.println("File Added : " + file);
                        ZipEntry ze = new ZipEntry(file);
                        zos.putNextEntry(ze);
                        /*
                            FileInputStream in = 
                                       new FileInputStream(sourceFolder + File.separator + file);
                            */
                        FileInputStream in = new FileInputStream(file);
                        int len;
                        while ((len = in.read(buffer)) > 0) {
                            zos.write(buffer, 0, len);
                        }
                        in.close();
                        endTime = System.nanoTime();
                        try {
                            //1000 milliseconds is one second.
                            Thread.sleep(200);
                        } catch (InterruptedException ex) {
                            Thread.currentThread().interrupt();
                        }
                    } catch (FileNotFoundException exc) {
                        exc.printStackTrace();
                        //System.out.println("\nError reading " + file);
                    } catch (IOException exc) {
                        exc.printStackTrace();
                    }
                }
                /*
                    for(String file : this.fileList){
                            
                        System.out.println("File Added : " + file);
                        ZipEntry ze= new ZipEntry(file);
                        zos.putNextEntry(ze);
                           
                        FileInputStream in = 
                                   new FileInputStream(sourceFolder + File.separator + file);
                       
                        int len;
                        while ((len = in.read(buffer)) > 0) {
                            zos.write(buffer, 0, len);
                        }
                           
                        in.close();
                    }
                    */
                zos.closeEntry();
                //remember close it
                zos.close();
                System.out.println("Done");
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            updateProgress(0, fileList.size());
            updateMessage("Done!");
            return null;
        }
    };
}

[Buggy Hunk]
for(int counter = 0; counter < fileList.size(); counter++){

[Patch]
for(int counter = 0; counter < fileList.size() && !isCancelled(); counter++){