[Demonstration 1]

[Buggy Method]
double heuristics(State a, State b) {
    double temp;
    double min = Math.abs(a.getX() - b.getX());
    double max = Math.abs(a.getY() - a.getY());
    if (min > max) {
        temp = min;
        min = max;
        max = temp;
    }
    return ((m_sqrt2 - 1.0) * min + max);
}

[Buggy Hunk]
double max = Math.abs(a.getY() - a.getY());

[Patch]
double max = Math.abs(a.getY() - b.getY());

[Demonstration 2]

[Buggy Method]
public static FacetName createPredicateWithDataType(String predicate, Configurations config) {
    FacetName facetName = new FacetName();
    facetName.setName(predicate);
    PredicateTypeEnum type = PredicateTypeEnum.INTEGER;
    String query = String.format("SELECT DISTINCT ?z WHERE {?x <%s> ?z}", predicate);
    ResultSet tupleIterator = config.getTripleStore().executeQuery(query, true);
    Float min = Float.POSITIVE_INFINITY;
    Float max = Float.NEGATIVE_INFINITY;
    Float number;
    if (tupleIterator != null) {
        tupleIterator.open();
        while (tupleIterator.hasNext() && !type.equals(PredicateTypeEnum.UNKNOWN)) {
            String object = tupleIterator.getItem(0);
            if (type.equals(PredicateTypeEnum.INTEGER)) {
                try {
                    number = (float) Integer.parseInt(object);
                    if (number > max)
                        max = number;
                    if (number < min)
                        min = number;
                } catch (NumberFormatException e) {
                    type = PredicateTypeEnum.FLOAT;
                }
            } else if (type.equals(PredicateTypeEnum.FLOAT)) {
                try {
                    number = Float.parseFloat(object);
                    if (number > max)
                        max = number;
                    if (number < min)
                        min = number;
                } catch (NumberFormatException e) {
                    type = PredicateTypeEnum.UNKNOWN;
                }
            }
            tupleIterator.next();
        }
        tupleIterator.dispose();
    }
    if (!type.equals(PredicateTypeEnum.UNKNOWN)) {
        facetName.setMax(max);
        facetName.setMin(min);
    }
    facetName.setType(type.toString());
    return facetName;
}

[Buggy Hunk]
if (!type.equals(PredicateTypeEnum.UNKNOWN)) {

[Patch]
if (!type.equals(PredicateTypeEnum.UNKNOWN) && !min.equals(Float.POSITIVE_INFINITY) && !max.equals(Float.NEGATIVE_INFINITY)) {

[Demonstration 3]

[Buggy Method]
private double scale(double num, double min, double max, double limitMin, double limitMax) {
    return (limitMax - limitMin) * (num - min) / (max - min) + limitMin;
}

[Buggy Hunk]
private double scale(double num, double min, double max, double limitMin, double limitMax) {

[Patch]
protected double scale(double num, double min, double max, double limitMin, double limitMax) {