[Demonstration 1]

[Buggy Method]
public void setX1(float x1) {
    this.x1 = x1;
}

[Buggy Hunk]
this.x1 = x1;

[Patch]
x = x1 + width/2;

[Demonstration 2]

[Buggy Method]
public void redoChoice(String path, String choice) {
    try {
        XsdNode currentNode = rootNode;
        /* never a choice on rootNode */
        String nextIndexes = path.substring(path.indexOf(".") + 1);
        int index = 0;
        Annotated annotated = (Annotated) (currentNode.getUserObject());
        /* for each element on the path */
        while (nextIndexes.length() > 0 && nextIndexes != "-1") {
            /* if choice do it */
            annotated = (Annotated) (currentNode.getUserObject());
            /* if not extended, do it */
            if (!currentNode.isExtended) {
                extendPath(currentNode);
            } else {
                if (nextIndexes.indexOf(".") >= 0) {
                    index = Integer.parseInt(nextIndexes.substring(0, nextIndexes.indexOf(".")));
                    nextIndexes = nextIndexes.substring(nextIndexes.indexOf(".") + 1);
                    try {
                        currentNode = (XsdNode) currentNode.getChildAt(index);
                    } catch (java.lang.ArrayIndexOutOfBoundsException aiobe) {
                        /*
                             * to keep compatibility: if mapping done without
                             * auto-duplication of nodes and applied without
                             * this option, an exception will be rised if the
                             * node has not been manually duplicated. In this
                             * case try to duplicate "upper" node.
                             */
                        /* get upper node's index */
                        duplicateNode((XsdNode) currentNode.getChildAt(index - 1));
                        currentNode = (XsdNode) currentNode.getChildAt(index);
                    }
                } else {
                    index = Integer.parseInt(nextIndexes);
                    nextIndexes = "-1";
                    try {
                        currentNode = (XsdNode) currentNode.getChildAt(index);
                    } catch (ArrayIndexOutOfBoundsException e) {
                        return;
                    }
                }
            }
        }
        /* add choice */
        annotated = (Annotated) (currentNode.getUserObject());
        Group g = (Group) annotated;
        try {
            if (g.getOrder().getType() == Order.CHOICE && manageChoices) {
                XsdNode parent = (XsdNode) currentNode.getParent();
                int position = parent.getIndex(currentNode);
                ArrayList<Annotated> choices = getChoices(g);
                ArrayList<String> possibilities = new ArrayList<String>();
                for (int i = 0; i < choices.size(); i++) {
                    try {
                        possibilities.add(((ElementDecl) choices.get(i)).getName());
                    } catch (ClassCastException e) {
                        /* a group: give an overview */
                        possibilities.add(XsdNode.choiceToString((Group) choices.get(i)));
                    }
                }
                XsdNode newNode;
                newNode = new XsdNode((Annotated) choices.get(possibilities.indexOf(choice)));
                newNode.isRequired = currentNode.isRequired;
                /**
                 * If the max occurs is specified, transfer it to the child.
                 */
                /**
                 * TODO: check if we should verify that max/min is indedd specified for the group.
                 */
                //node.min;
                newNode.min = g.getMaxOccurs();
                //node.max;
                newNode.max = g.getMaxOccurs();
                //
                //                    newNode.min = currentNode.min;
                //                    newNode.max = currentNode.max;
                newNode.originalParent = currentNode;
                currentNode.transparent = true;
                currentNode.isExtended = true;
                currentNode.add(newNode);
                currentNode = newNode;
            }
        } catch (StringIndexOutOfBoundsException e) {
            return;
        }
    } catch (ArrayIndexOutOfBoundsException aioobe) {
        log.error("path not found: " + path);
        throw aioobe;
    }
    check((XsdNode) treeModel.getRoot());
    treeModel.reload((XsdNode) treeModel.getRoot());
    expendChoices.add(path);
    expendChoices.add(choice);
}

[Buggy Hunk]
newNode.min = g.getMaxOccurs(); //node.min;

[Patch]
newNode.min = g.getMinOccurs(); //node.min;

[Demonstration 3]

[Buggy Method]
@Override
protected void print(boolean focus, Decision decision) {
    for (int i = 0; i < vars.length; i++) {
        for (int j = 0; j < vars[i].length; j++) {
            writer.var(vars[i][j], (i + 1) + " " + (j + 1), 3);
        }
    }
    if (decision != null) {
        for (int i = 0; i < vars.length; i++) {
            for (int j = 0; j < vars[i].length; j++) {
                if (decision.getDecisionVariable() == vars[i][j]) {
                    if (focus) {
                        writer.focus((i + 1) + Writer._S + (j + 1), group);
                    } else {
                        writer.fail((i + 1) + Writer._S + (j + 1), group, (Integer) decision.getDecisionValue());
                    }
                }
            }
        }
    }
}

[Buggy Hunk]
if (decision.getDecisionVariable()== vars[i][j]) {

[Patch]
if (decision.getDecisionVariables()== vars[i][j]) {