[Demonstration 1]

[Buggy Method]
@Override
protected boolean runPartitions(List<Partition> partitions, IndexFilter range) throws IOException {
    byte[] rangeStart = null;
    boolean strictStart = false;
    byte[] rangeEnd = null;
    boolean strictEnd = false;
    if (range != null) {
        ColumnDefinition cd = tableDefinition.getKeyDefinition().getColumn(0);
        ColumnSerializer cs = tableDefinition.getColumnSerializer(cd.getName());
        if (range.keyStart != null) {
            strictStart = range.strictStart;
            rangeStart = cs.getByteArray(range.keyStart);
        }
        if (range.keyEnd != null) {
            strictEnd = range.strictEnd;
            rangeEnd = cs.getByteArray(range.keyEnd);
        }
    }
    log.debug("running partitions " + partitions);
    PriorityQueue<TcRawTuple> orderedQueue = new PriorityQueue<TcRawTuple>();
    TCBFactory tcbf = ydb.getTCBFactory();
    try {
        int i = 0;
        //first open all the partitions and collect a tuple from each
        for (Partition p : partitions) {
            TcPartition tp = (TcPartition) p;
            log.debug("opening partition " + tp);
            YBDB db = tcbf.getTcb(tableDefinition.getDataDir() + "/" + tp.filename, tableDefinition.isCompressed(), false);
            YBDBCUR cursor = db.openCursor();
            boolean found = true;
            if (rangeStart != null) {
                if (cursor.jump(rangeStart)) {
                    if ((strictStart) && (compare(rangeStart, cursor.key()) == 0)) {
                        //if filter condition is ">" we skip the first record if it is equal to the key
                        found = cursor.next();
                    }
                } else {
                    found = false;
                }
                if (!found)
                    log.debug("no record corresponding to the StartFilter");
            } else {
                if (!cursor.first()) {
                    log.debug("tcb contains no record");
                    found = false;
                }
            }
            if (!found) {
                db.closeCursor(cursor);
                tcbf.dispose(db);
            } else {
                orderedQueue.add(new TcRawTuple(cursor.key(), cursor.val(), db, cursor, i++));
            }
        }
        log.debug("got one tuple from each partition, starting the business");
        //now continue publishing the first element from the priority queue till it becomes empty
        while ((!quit) && orderedQueue.size() > 0) {
            TcRawTuple rt = orderedQueue.poll();
            if (!emitIfNotPastStop(rt, rangeEnd, strictEnd)) {
                return true;
            }
            if (rt.cursor.next()) {
                rt.key = rt.cursor.key();
                rt.value = rt.cursor.val();
                orderedQueue.add(rt);
            } else {
                log.debug(rt.db.path() + " finished");
                rt.cursor.close();
                tcbf.dispose(rt.db);
            }
        }
        return false;
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    } finally {
        for (RawTuple rt : orderedQueue) {
            TcRawTuple tcrt = (TcRawTuple) rt;
            tcrt.cursor.close();
            tcbf.dispose(tcrt.db);
        }
    }
}

[Buggy Hunk]
TCBFactory tcbf=ydb.getTCBFactory();

[Patch]
TCBFactory tcbf = TCBFactory.getInstance();

[Demonstration 2]

[Buggy Method]
protected SearchResult alphaBeta(int depth, Board currentBoard, int move, int player, int alpha, int beta) {
    List<Integer> moves = logic.generateMoves(currentBoard);
    GameState nextState = evaluator.evaluateGameState(currentBoard);
    if (depth == 0 || moves.isEmpty() || nextState != GameState.CONTINUING) {
        int score = evaluator.evaluate(currentBoard, player);
        return new SearchResult(currentBoard, move, score);
    }
    List<Integer> sortedMoves = sortMoves(currentBoard, moves, player);
    if (sortedMoves.contains(bestMove)) {
        sortedMoves.remove(sortedMoves.indexOf(bestMove));
        sortedMoves.add(0, bestMove);
    }
    for (int nextMove : sortedMoves) {
        Board nextBoard = new Board(currentBoard);
        nextBoard.doMove(nextMove, player);
        nextState = evaluator.evaluateGameState(nextBoard);
        if (evaluator.playerWin(nextState, player)) {
            return new SearchResult(nextBoard, nextMove, infinity);
        }
        int value = -alphaBeta(depth - 1, nextBoard, nextMove, -player, -beta, -alpha).score;
        if (beta >= alpha) {
            break;
        }
        if (value > beta) {
            beta = value;
            bestMove = nextMove;
        }
    }
    return new SearchResult(currentBoard, bestMove, beta);
}

[Buggy Hunk]
return new SearchResult(nextBoard, nextMove, infinity);

[Patch]
return new SearchResult(nextBoard, nextMove, infinity*player);

[Demonstration 3]

[Buggy Method]
public void previousInstruction() {
    //        tts.speak("Vorherige Anweisung");
    int index = ranges.indexOf(currentRange);
    Range previousRange;
    if (index != 0) {
        previousRange = ranges.get(index - 1);
        ArrayList<String> environmentalInfo = previousRange.getEnvironmentalInfos();
        instructionTexts = new ArrayList<>();
        instructionTexts.add("Geradeaus");
        String vorbeiAn = "Vorbei an ";
        for (String e : environmentalInfo) instructionTexts.add(vorbeiAn + e);
        instructionTexts.add(currentRange.getRelationToNextRangeAsString());
        tts.speakList(instructionTexts, 0);
    } else {
        ArrayList<String> alternative = new ArrayList<>();
        alternative.add("Die Navigation hat hier begonnen. Es gibt noch keine vorherige Anweisung.");
        tts.speakList(alternative, 0);
    }
}

[Buggy Hunk]
instructionTexts.add(currentRange.getRelationToNextRangeAsString());

[Patch]
instructionTexts.add(previousRange.getRelationToNextRangeAsString());