[Demonstration 1]

[Buggy Method]
@PostConstruct
public void setUp() {
    alphaHyperparameter = BigDecimal.valueOf(sourceModelPrior);
    betaHyperparameter = BigDecimal.valueOf(channelModelPrior);
    this.cipher = cipherDao.findByCipherName(cipherName);
    cipherKeySize = (int) cipher.getCiphertextCharacters().stream().map(c -> c.getValue()).distinct().count();
    List<LetterProbability> letterUnigramProbabilities = new ArrayList<>();
    for (Map.Entry<Character, NGramIndexNode> entry : letterMarkovModel.getRootNode().getTransitions().entrySet()) {
        letterUnigramProbabilities.add(new LetterProbability(entry.getKey(), entry.getValue().getTerminalInfo().getConditionalProbability()));
    }
    // Initialize the solution key
    CipherSolution initialSolution = new CipherSolution(cipher, cipherKeySize);
    RouletteSampler<LetterProbability> rouletteSampler = new RouletteSampler<>();
    rouletteSampler.reIndex(letterUnigramProbabilities);
    cipher.getCiphertextCharacters().stream().map(ciphertext -> ciphertext.getValue()).distinct().forEach(ciphertext -> {
        // Pick a plaintext at random according to the language model
        String nextPlaintext = letterUnigramProbabilities.get(rouletteSampler.getNextIndex(letterUnigramProbabilities)).getValue().toString();
        initialSolution.putMapping(new Ciphertext(ciphertext), new Plaintext(nextPlaintext));
    });
    initialSolution.setScore(plaintextEvaluator.evaluate(initialSolution));
    BigDecimal maxTemp = BigDecimal.valueOf(annealingTemperatureMax);
    BigDecimal minTemp = BigDecimal.valueOf(annealingTemperatureMin);
    BigDecimal iterations = BigDecimal.valueOf(samplerIterations);
    BigDecimal temperature;
    for (int i = 0; i < samplerIterations; i++) {
        /*
			 * Set temperature as a ratio of the max temperature to the number of iterations left, offset by the min
			 * temperature so as not to go below it
			 */
        temperature = maxTemp.subtract(minTemp).multiply(iterations.subtract(BigDecimal.valueOf(i)).divide(iterations, MathContext.DECIMAL128)).add(minTemp);
        runGibbsSampler(temperature, initialSolution);
    }
}

[Buggy Hunk]
initialSolution.putMapping(new Ciphertext(ciphertext), new Plaintext(nextPlaintext));

[Patch]
initialSolution.putMapping(ciphertext, new Plaintext(nextPlaintext));

[Demonstration 2]

[Buggy Method]
public String next() {
    getPaginationHelper().nextPage();
    recreateModel();
    return "browse";
}

[Buggy Hunk]
getPaginationHelper().nextPage();

[Patch]
getPagination().nextPage();

[Demonstration 3]

[Buggy Method]
private void loadPage(int pageNumber) {
    mCurrentPage = mStory.getPage(pageNumber);
    Drawable drawable = getResources().getDrawable(mCurrentPage.getImageId());
    mImageView.setImageDrawable(drawable);
    String pageText = mCurrentPage.getText();
    //Add name if placeholder included
    pageText = String.format(pageText, mName);
    mTextView.setText(pageText);
    if (mCurrentPage.isFinal()) {
        mChoice1.setText(mCurrentPage.getChoice1().getText());
        mChoice2.setText(mCurrentPage.getChoice2().getText());
        mChoice1.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                int nextPage = mCurrentPage.getChoice1().getNextPage();
                loadPage(nextPage);
            }
        });
        mChoice2.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                int nextPage = mCurrentPage.getChoice2().getNextPage();
                loadPage(nextPage);
            }
        });
    } else {
        mChoice1.setVisibility(View.INVISIBLE);
        mChoice2.setVisibility(View.INVISIBLE);
    }
}

[Buggy Hunk]
if (mCurrentPage.isFinal()) {

[Patch]
if (!mCurrentPage.isFinal()) {