[Demonstration 1]

[Buggy Method]
@Override
protected List<Attribute> init(AbstractDefinition inputDefinition, ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) {
    if (attributeExpressionExecutors.length == 4) {
        if (!(attributeExpressionExecutors[0] instanceof VariableExpressionExecutor)) {
            throw new ExecutionPlanValidationException("MarkovChainMatrixTimeBatchStreamProcessor's 1st parameter consumerKey should be a variable, but found " + attributeExpressionExecutors[0].getClass());
        }
        consumerKeyExpressionExecutor = (VariableExpressionExecutor) attributeExpressionExecutors[0];
        if (!(attributeExpressionExecutors[1] instanceof VariableExpressionExecutor)) {
            throw new ExecutionPlanValidationException("MarkovChainMatrixTimeBatchStreamProcessor's 2nd parameter userId should be a variable, but found " + attributeExpressionExecutors[1].getClass());
        }
        userIdExpressionExecutor = (VariableExpressionExecutor) attributeExpressionExecutors[1];
        if (!(attributeExpressionExecutors[2] instanceof VariableExpressionExecutor)) {
            throw new ExecutionPlanValidationException("MarkovChainMatrixTimeBatchStreamProcessor's 3rd parameter state should be a variable, but found " + attributeExpressionExecutors[2].getClass());
        }
        stateExpressionExecutor = (VariableExpressionExecutor) attributeExpressionExecutors[2];
        if (attributeExpressionExecutors[3].getReturnType() == Attribute.Type.INT) {
            timeToKeep = (Integer) ((ConstantExpressionExecutor) attributeExpressionExecutors[3]).getValue();
        } else if (attributeExpressionExecutors[3].getReturnType() == Attribute.Type.LONG) {
            timeToKeep = (Long) ((ConstantExpressionExecutor) attributeExpressionExecutors[3]).getValue();
        } else {
            throw new ExecutionPlanValidationException("MarkovChainMatrixTimeBatchStreamProcessor's 4th parameter windowTime should be either int or long, but found " + attributeExpressionExecutors[3].getReturnType());
        }
    } else {
        throw new ExecutionPlanValidationException("MarkovChainMatrixTimeBatchStreamProcessor should only have four parameters (<variable> consumerKey, <variable> userId, <variable> state, <int|long|time> windowTime), but found " + attributeExpressionExecutors.length + " input attributes");
    }
    this.consumerKeyToMarkovMatrix = new HashMap<String, MarkovChainMatrixTimeBatchStreamProcessor.MarkovMatrix>();
    this.userToLastStates = new HashMap<String, Map<String, String>>();
    ArrayList<Attribute> attributes = new ArrayList<Attribute>(4);
    attributes.add(new Attribute("appConsumerKey", Attribute.Type.STRING));
    attributes.add(new Attribute("startState", Attribute.Type.STRING));
    attributes.add(new Attribute("endState", Attribute.Type.STRING));
    attributes.add(new Attribute("probability", Attribute.Type.DOUBLE));
    return attributes;
}

[Buggy Hunk]
this.consumerKeyToMarkovMatrix = new HashMap<String, MarkovChainMatrixTimeBatchStreamProcessor.MarkovMatrix>();

[Patch]
this.consumerKeyToMarkovMatrix = new HashMap<String, MarkovMatrix>();

[Demonstration 2]

[Buggy Method]
private ClassDecl visiClassDecl(ClassDeclarationContext c) {
    Identifier id = this.visiIdentifier(c.Identifier(0));
    VarDeclList varList = this.visiVarDeclList(c.varDeclaration());
    MethodDeclList ml = this.visitMethodDeclList(c.methodDeclaration());
    return new ClassDeclSimple(id, varList, ml);
}

[Buggy Hunk]
Identifier id = this.visiIdentifier(c.Identifier(0));

[Patch]
Identifier id = this.visitIdentifier(c.Identifier(0));

[Demonstration 3]

[Buggy Method]
static boolean identMatch(final ParameterDescriptorGroup parameters, final String regex, final String identifier) {
    if (identifier != null) {
        for (final Identifier id : parameters.getIdentifiers()) {
            if (Constants.EPSG.equals(id.getCodeSpace())) {
                return identifier.equals(id.getCode());
            }
        }
    }
    return parameters.getName().getCode().matches(regex);
}

[Buggy Hunk]
return parameters.getName().getCode().matches(regex);

[Patch]
return parameters.getName().getCode().replace('_',' ').matches(regex);