[Demonstration 1]

[Buggy Method]
public ArrayList<Span> segToSentenceSpans(String text) {
    ArrayList<Span> output = new ArrayList<Span>();
    HashMap<Determinants, ArrayList<Span>> result = fcrp.processString(text, DirectionPrefer.none);
    if (debug) {
        text = text.replaceAll("\n", " ");
        for (Map.Entry<Determinants, ArrayList<Span>> ent : result.entrySet()) {
            System.out.println(ent.getKey());
            for (Span span : ent.getValue()) {
                System.out.println("\t" + span.begin + "-" + span.end + ":" + span.score + "\t" + text.substring(0, span.begin) + "<" + text.substring(span.begin, span.begin + 1) + ">\t" + span.ruleId + "\t" + fcrp.getRuleString(span.ruleId));
            }
        }
    }
    ArrayList<Span> begins = result.get(begin);
    ArrayList<Span> ends = result.get(end);
    //        if(begins==null)
    //        System.out.println(text);
    if (begins == null || begins.size() == 0) {
        begins = new ArrayList<Span>();
        begins.add(new Span(0, 1, 1, -1));
    }
    if (ends == null || ends.size() == 0) {
        ends = new ArrayList<Span>();
        ends.add(new Span(text.length() - 1, text.length(), 1, -1));
    }
    int stBegin = 0;
    boolean sentenceStarted = false;
    int stEnd = 0, i = 0, j = 0;
    for (i = 0; i < begins.size(); i++) {
        if (!sentenceStarted) {
            stBegin = begins.get(i).begin;
            if (begins.get(i).score == 1 || stBegin < stEnd)
                continue;
            sentenceStarted = true;
        } else {
            continue;
        }
        for (int k = j; k < ends.size(); k++) {
            if (ends.get(k).score == 3)
                continue;
            if (i < begins.size() - 1 && k < ends.size() - 1 && begins.get(i + 1).getBegin() < ends.get(k).begin + 1) {
                break;
            }
            stEnd = ends.get(k).begin + 1;
            j = k;
            //                right trim
            while (stEnd >= 1 && (Character.isWhitespace(text.charAt(stEnd - 1)) || (int) text.charAt(stEnd - 1) == 160)) {
                stEnd--;
            }
            if (stEnd < stBegin)
                //                   if this end is for previous sentence, move the pointer to the next
                continue;
            else if (sentenceStarted) {
                //                   if current status is after a sentence begin marker
                output.add(new Span(stBegin, stEnd));
                sentenceStarted = false;
                if (i == begins.size() - 1 || (k < ends.size() - 1 && begins.get(i + 1).getBegin() > ends.get(k + 1).getEnd()))
                    continue;
                break;
            } else {
                //                   if current status is after a sentence end marker, then replace the last output
                output.set(output.size() - 1, new Span(stBegin, stEnd));
                sentenceStarted = false;
            }
        }
    }
    return output;
}

[Buggy Hunk]
} else {

[Patch]
} else if(begins.get(i).begin < stEnd) {

[Demonstration 2]

[Buggy Method]
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    } else if (id == R.id.action_sign_out) {
        FirebaseAuth.getInstance().signOut();
        Intent intent = new Intent(DisplayNotesList.this, ViewAddNote.class);
        startActivity(intent);
        return true;
    }
    return super.onOptionsItemSelected(item);
}

[Buggy Hunk]
Intent intent = new Intent(DisplayNotesList.this, ViewAddNote.class);

[Patch]
Intent intent = new Intent(DisplayNotesList.this, LoginActivity.class);

[Demonstration 3]

[Buggy Method]
@Override
protected void onPostExecute(Lexicon game) {
    // update layout
    findViewById(R.id.loaderLayout).setVisibility(View.GONE);
    findViewById(R.id.linPlayerNames).setVisibility(View.VISIBLE);
    findViewById(R.id.addLetterLin).setVisibility(View.VISIBLE);
    letterCombination.setVisibility(View.VISIBLE);
}

[Buggy Hunk]
protected void onPostExecute(Lexicon game) {

[Patch]
protected void onPostExecute(Lexicon lexicon) {