[Demonstration 1]

[Buggy Method]
private void checkNPCs(MapData currentMap) {
    for (Direction direction : Direction.values()) {
        for (int dist = 1; dist <= NPCEntity.NPC_SIGHT_DISTANCE; dist++) {
            Point newLocation = Point.add(this.getLocation(), Point.scale(direction.getDeltaPoint(), dist));
            if (!currentMap.getPassValue(newLocation).isPassable(direction)) {
                break;
            }
            Entity newEntity = currentMap.getEntity(newLocation);
            if (newEntity instanceof NPCEntity) {
                NPCEntity npc = (NPCEntity) newEntity;
                if (npc.canWalkToPlayer()) {
                    this.stall();
                    npc.walkTowards(dist - 1, direction.getOpposite().getPathDirection());
                    if (npc.isTrainer()) {
                        SoundPlayer.soundPlayer.playMusic(SoundTitle.TRAINER_SPOTTED);
                    }
                }
            }
        }
    }
}

[Buggy Hunk]
if (newEntity instanceof NPCEntity) {

[Patch]
if (newEntity instanceof NPCEntity && newEntity != currentInteractionEntity) {

[Demonstration 2]

[Buggy Method]
public String getInputArgOfComponent(Component c) {
    String map = this.getComponentMap().get(c);
    String text = null;
    if (c instanceof JTextField) {
        return (text = ((JTextField) c).getText()).equals("") ? "" : " SIGNARG2 is like" + " WORDARG \"" + text + "\"";
    } else if (c instanceof JComboBox) {
        text = (String) ((JComboBox) c).getSelectedItem();
        if (map.equals("Type")) {
            if (text.equals("None") || text.equals("Any")) {
                return "";
            } else {
                return " TYPEARG \"" + text + "\"";
            }
        } else if (map.equals("Origin")) {
            if (text.equals("None") || text.equals("Any")) {
                return "";
            } else {
                return " ORIGINARG \"" + text + "\"";
            }
        } else if (map.equals("Order")) {
            if (text.equals("Price")) {
                return " ORDERARG serv.price";
            } else if (text.equals("Rating")) {
                return " ORDERARG d.avgRating";
            } else {
                System.err.println("Unexpected ordering argument");
            }
        } else {
            System.err.println("Unexpected container mapping: " + map);
        }
    }
    return null;
}

[Buggy Hunk]
return (text = ((JTextField)c).getText()).equals("") ? "" : " SIGNARG2 is like" + " WORDARG \"" + text + "\"";

[Patch]
return (text = ((JTextField)c).getText()).equals("") ? "" : " SIGNARG2 is like" + " WORDARG " + text;

[Demonstration 3]

[Buggy Method]
public static Command getByName(String name) {
    for (Command c : values()) if (c.command.equalsIgnoreCase(name))
        return c;
    return null;
}

[Buggy Hunk]
if (c.command.equalsIgnoreCase(name))

[Patch]
if (c.name.equalsIgnoreCase(name))