[Demonstration 1]

[Buggy Method]
Rule Identifier() {
    Var<String> id = new Var<>();
    return Sequence(Identifier(id), push(new VariableExpr<Void>(match())), setLocations);
}

[Buggy Hunk]
return Sequence(Identifier(id), push(new VariableExpr<Void>(match())), setLocations);

[Patch]
return Sequence(Identifier(id), push(new VariableExpr<Void>(id.get())), setLocations);

[Demonstration 2]

[Buggy Method]
@Override
public Map<Long, HostResources> mapVMsToHost(List<HostResources> rankedHosts) {
    if (standardDeviationHostsUsage == 0) {
        return new HashMap<Long, HostResources>();
    }
    List<HostResources> rankedHostsStdVms = cloneListOfHosts(rankedHosts);
    List<HostResources> rankedHostsStdHosts = cloneListOfHosts(rankedHosts);
    List<HostResources> rankedHostsStdAverage = cloneListOfHosts(rankedHosts);
    logger.debug("Simulating migration mapping with VMs resource standard deviation");
    Map<Long, HostResources> vmsToHostStdVms = simulateVmsMigrations(rankedHostsStdVms, standardDeviationVmsConfiguration);
    logger.debug("Simulating migration mapping with hosts resource standard deviation");
    Map<Long, HostResources> vmsToHostStdHosts = simulateVmsMigrations(rankedHostsStdHosts, standardDeviationHostsUsage);
    logger.debug("Simulating migration mapping with the average of hosts resource and VMs resource standard deviation");
    Map<Long, HostResources> vmsToHostStdAverage = simulateVmsMigrations(rankedHostsStdAverage, standardDeviationAverage);
    double[] usedMemoryHostsWithStdVms = new double[rankedHosts.size()];
    for (int i = 0; i < rankedHostsStdVms.size(); i++) {
        usedMemoryHostsWithStdVms[i] = rankedHostsStdVms.get(i).getUsedMemoryInMegaBytes();
    }
    double stdWithStdVms = std.evaluate(usedMemoryHostsWithStdVms);
    logger.debug(String.format("The Std. achieved using the VMs resource standard deviation as parameter for the simulation was [%f]", stdWithStdVms));
    double[] usedMemoryHostsWithStdHost = new double[rankedHosts.size()];
    for (int i = 0; i < rankedHostsStdHosts.size(); i++) {
        usedMemoryHostsWithStdHost[i] = rankedHostsStdHosts.get(i).getUsedMemoryInMegaBytes();
    }
    double stdWithStdHosts = std.evaluate(usedMemoryHostsWithStdHost);
    logger.debug(String.format("The Std. achieved using the hosts resource standard deviation as parameter for the simulation was [%f]", stdWithStdHosts));
    double[] usedMemoryHostsWithStdAverage = new double[rankedHosts.size()];
    for (int i = 0; i < rankedHostsStdAverage.size(); i++) {
        usedMemoryHostsWithStdAverage[i] = rankedHostsStdAverage.get(i).getUsedMemoryInMegaBytes();
    }
    double stdWithStdAverage = std.evaluate(usedMemoryHostsWithStdAverage);
    logger.debug(String.format("The Std. achieved using the average between hosts resource and VMs resource standard deviation as parameter for the simulation was [%f]", stdWithStdAverage));
    if (stdWithStdAverage <= stdWithStdHosts && stdWithStdAverage <= stdWithStdVms) {
        logger.debug("The simulation that won the competition was the one executed with alpha as the average of host resource and VMs resource standard deviation.");
        logger.debug(String.format("The number of migrations that will be executed is[%d].", vmsToHostStdAverage.size()));
        return vmsToHostStdAverage;
    }
    if (stdWithStdHosts <= stdWithStdVms) {
        logger.debug("The simulation that won the competition was the one executed with alpha as the host resource standard deviation.");
        logger.debug(String.format("The number of migrations that will be executed is[%d].", vmsToHostStdHosts.size()));
        return vmsToHostStdHosts;
    }
    logger.debug("The simulation that won the competition was the one executed with alpha as the VMs resource standard deviation.");
    logger.debug(String.format("The number of migrations that will be executed is[%d].", vmsToHostStdVms.size()));
    return vmsToHostStdVms;
}

[Buggy Hunk]
if (standardDeviationHostsUsage == 0) {

[Patch]
if (MathUtils.equals(standardDeviationHostsUsage, 0)) {

[Demonstration 3]

[Buggy Method]
public Connection getConnection(String database) throws SQLException {
    if (!connectionPool.containsKey(database)) {
        log.info(String.format("Connecting to database <%s> for the first time", database));
        String url = "jdbc:postgresql://" + POSTGRES_HOST + "/" + database;
        Flyway flyway = new Flyway();
        flyway.setDataSource(url, POSTGRES_USER, POSTGRES_PASS);
        flyway.setBaselineOnMigrate(true);
        flyway.setLocations("schema");
        if (!"".equals(database) && !"postgres".equals(database) && !"meta".equals(database)) {
            flyway.setBaselineDescription("Baseline");
            flyway.migrate();
        } else if ("meta".equals(database)) {
            flyway.setLocations("schema-meta");
            flyway.setBaselineDescription("Baseline");
            flyway.migrate();
        }
        BasicDataSource bds = new BasicDataSource();
        bds.setUrl(url + "?ApplicationName=Weaver Postgres Connector");
        bds.setUsername(POSTGRES_USER);
        bds.setPassword(POSTGRES_PASS);
        bds.setDriverClassName("org.postgresql.Driver");
        bds.setInitialSize(5);
        bds.setMaxTotal(10);
        connectionPool.put(database, bds);
    }
    return connectionPool.get(database).getConnection();
}

[Buggy Hunk]
public Connection getConnection(String database) throws SQLException {

[Patch]
public Connection getConnection(String database) throws SQLException, FlywayException {