[Demonstration 1]

[Buggy Method]
private void updateDistance(int[][] grid, int[][] reach, int[][] distance, int row, int col, int x, int y) {
    Deque<int[]> queue = new ArrayDeque<>();
    queue.offer(new int[] { x, y });
    int cur = 1;
    boolean[][] visited = new boolean[row][col];
    while (!queue.isEmpty()) {
        int next = 0;
        for (int i = 0; i < cur; i++) {
            int[] pair = queue.poll();
            for (int j = 0; j < 4; j++) {
                int newX = pair[0] + dx[j];
                int newY = pair[1] + dy[j];
                if (newX >= 0 && newX < row && newY >= 0 && newY < col && grid[newX][newY] == 0 && !visited[newX][newY]) {
                    distance[newX][newY] += (Math.abs(newX - x) + Math.abs(newY - y));
                    reach[newX][newY] += 1;
                    visited[newX][newY] = true;
                    queue.offer(new int[] { newX, newY });
                    next++;
                }
            }
        }
        cur = next;
    }
}

[Buggy Hunk]
if (newX >= 0 && newX < row && newY >= 0 && newY < col && grid[newX][newY] == 0 && !visited[newX][newY]) {

[Patch]
if (newX >= 0 && newX < row && newY >= 0 && newY < col && !visited[newX][newY]) {

[Demonstration 2]

[Buggy Method]
public void handleTouchDrag(float normalizedX, float normalizedY) {
    xOffset = xOffset + (normalizedX - startTouchX) * screenWidth / DRAGSCALEFACTOR;
    yOffset = yOffset + (normalizedY - startTouchY) * screenHeight / DRAGSCALEFACTOR;
    xOffset = Math.max(-2 * RADIUS * myScaleFactor, Math.min(xOffset, 2 * RADIUS * myScaleFactor));
    yOffset = Math.max(-2 * RADIUS * myScaleFactor, Math.min(yOffset, 2 * RADIUS * myScaleFactor));
    startTouchX = normalizedX;
    startTouchY = normalizedY;
    RightAscensionDeclination cursor = CursorPosition.cursorRA(context, location, gmt, xOffset, yOffset, myScaleFactor, showReverseSky);
    ((Registration) context).reportCursor(cursor.getDeclination(), cursor.getRightAcension(), location, cursor.getLst());
}

[Buggy Hunk]
((Registration) context).reportCursor(cursor.getDeclination(), cursor.getRightAcension(), location, cursor.getLst());

[Patch]
((Registration) context).reportCursor(cursor, ((MainActivity)context).computeHorizontal(cursor, location, cursor.getLst()), location);

[Demonstration 3]

[Buggy Method]
public static boolean isPlaying() {
    return _player != null && _player.isPlaying();
}

[Buggy Hunk]
return _player != null && _player.isPlaying();

[Patch]
return mPlayer != null && mPlayer.isPlaying();