Program: 28980
Project: 28980
Buggy source:
public static CollectionExecutor buildCollectionExecutor(CollectionExpression collectionExpression,MatchingMetaStateHolder matchingMetaStateHolder,List<VariableExpressionExecutor> variableExpressionExecutors,Map<String,EventTable> eventTableMap,ExecutionPlanContext executionPlanContext,boolean isFirst){
  if (collectionExpression instanceof AttributeCollectionExpression) {
    return new CompareCollectionExecutor(((AttributeCollectionExpression)collectionExpression).getAttribute(),Compare.Operator.EQUAL,new ConstantExpressionExecutor(true,Attribute.Type.BOOL));
  }
 else   if (collectionExpression instanceof CompareCollectionExpression) {
    ExpressionExecutor valueExpressionExecutor=ExpressionParser.parseExpression(((CompareCollectionExpression)collectionExpression).getValueCollectionExpression().getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
    AttributeCollectionExpression attributeCollectionExpression=((AttributeCollectionExpression)((CompareCollectionExpression)collectionExpression).getAttributeCollectionExpression());
    return new CompareCollectionExecutor(attributeCollectionExpression.getAttribute(),((CompareCollectionExpression)collectionExpression).getOperator(),valueExpressionExecutor);
  }
 else   if (collectionExpression instanceof NullCollectionExpression) {
    return new CompareCollectionExecutor(((NullCollectionExpression)collectionExpression).getAttribute(),Compare.Operator.EQUAL,new ConstantExpressionExecutor(null,Attribute.Type.OBJECT));
  }
 else   if (collectionExpression instanceof AndCollectionExpression) {
    CollectionExpression leftCollectionExpression=((AndCollectionExpression)collectionExpression).getLeftCollectionExpression();
    CollectionExpression rightCollectionExpression=((AndCollectionExpression)collectionExpression).getRightCollectionExpression();
    ExpressionExecutor expressionExecutor=null;
    CollectionExecutor aCollectionExecutor=null;
    CollectionExecutor leftCollectionExecutor;
    CollectionExecutor rightCollectionExecutor;
switch (leftCollectionExpression.getCollectionScope()) {
case NON:
switch (rightCollectionExpression.getCollectionScope()) {
case NON:
        expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
      return new NonCollectionExecutor(expressionExecutor);
case INDEXED_ATTRIBUTE:
case INDEXED_RESULT_SET:
case OPTIMISED_RESULT_SET:
case EXHAUSTIVE:
    expressionExecutor=ExpressionParser.parseExpression(leftCollectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
  aCollectionExecutor=buildCollectionExecutor(rightCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
return new NonAndCollectionExecutor(expressionExecutor,aCollectionExecutor,rightCollectionExpression.getCollectionScope());
}
break;
case INDEXED_ATTRIBUTE:
switch (rightCollectionExpression.getCollectionScope()) {
case NON:
expressionExecutor=ExpressionParser.parseExpression(rightCollectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
aCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
return new NonAndCollectionExecutor(expressionExecutor,aCollectionExecutor,rightCollectionExpression.getCollectionScope());
case INDEXED_ATTRIBUTE:
case INDEXED_RESULT_SET:
case OPTIMISED_RESULT_SET:
if (isFirst) {
aCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
leftCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
rightCollectionExecutor=buildCollectionExecutor(rightCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
return new AnyAndCollectionExecutor(leftCollectionExecutor,rightCollectionExecutor,aCollectionExecutor);
case EXHAUSTIVE:
if (isFirst) {
aCollectionExecutor=buildCollectionExecutor(collectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
}
leftCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
return new CompareExhaustiveAndCollectionExecutor(leftCollectionExecutor,aCollectionExecutor);
}
break;
case INDEXED_RESULT_SET:
switch (rightCollectionExpression.getCollectionScope()) {
case NON:
expressionExecutor=ExpressionParser.parseExpression(rightCollectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
aCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
return new NonAndCollectionExecutor(expressionExecutor,aCollectionExecutor,rightCollectionExpression.getCollectionScope());
case INDEXED_ATTRIBUTE:
if (isFirst) {
aCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
leftCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
rightCollectionExecutor=buildCollectionExecutor(rightCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
return new AnyAndCollectionExecutor(rightCollectionExecutor,leftCollectionExecutor,aCollectionExecutor);
case INDEXED_RESULT_SET:
case OPTIMISED_RESULT_SET:
if (isFirst) {
aCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
leftCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
rightCollectionExecutor=buildCollectionExecutor(rightCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
return new AnyAndCollectionExecutor(leftCollectionExecutor,rightCollectionExecutor,aCollectionExecutor);
case EXHAUSTIVE:
if (isFirst) {
aCollectionExecutor=buildCollectionExecutor(collectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
}
leftCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
return new CompareExhaustiveAndCollectionExecutor(leftCollectionExecutor,aCollectionExecutor);
}
break;
case OPTIMISED_RESULT_SET:
switch (rightCollectionExpression.getCollectionScope()) {
case NON:
expressionExecutor=ExpressionParser.parseExpression(rightCollectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
aCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
return new NonAndCollectionExecutor(expressionExecutor,aCollectionExecutor,rightCollectionExpression.getCollectionScope());
case INDEXED_ATTRIBUTE:
if (isFirst) {
aCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
leftCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
rightCollectionExecutor=buildCollectionExecutor(rightCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
return new AnyAndCollectionExecutor(rightCollectionExecutor,leftCollectionExecutor,aCollectionExecutor);
case INDEXED_RESULT_SET:
case OPTIMISED_RESULT_SET:
if (isFirst) {
aCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
leftCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
rightCollectionExecutor=buildCollectionExecutor(rightCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
return new AnyAndCollectionExecutor(leftCollectionExecutor,rightCollectionExecutor,aCollectionExecutor);
case EXHAUSTIVE:
if (isFirst) {
aCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
leftCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
return new CompareExhaustiveAndCollectionExecutor(leftCollectionExecutor,aCollectionExecutor);
}
break;
case EXHAUSTIVE:
switch (rightCollectionExpression.getCollectionScope()) {
case NON:
expressionExecutor=ExpressionParser.parseExpression(rightCollectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
aCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
return new NonAndCollectionExecutor(expressionExecutor,aCollectionExecutor,rightCollectionExpression.getCollectionScope());
case INDEXED_ATTRIBUTE:
case INDEXED_RESULT_SET:
case OPTIMISED_RESULT_SET:
if (isFirst) {
aCollectionExecutor=buildCollectionExecutor(collectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
}
rightCollectionExecutor=buildCollectionExecutor(rightCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
return new CompareExhaustiveAndCollectionExecutor(rightCollectionExecutor,aCollectionExecutor);
case EXHAUSTIVE:
if (isFirst) {
expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
}
return new ExhaustiveCollectionExecutor(expressionExecutor,matchingMetaStateHolder.getCandidateEventIndex());
}
break;
}
}
 else if (collectionExpression instanceof OrCollectionExpression) {
CollectionExpression leftCollectionExpression=((OrCollectionExpression)collectionExpression).getLeftCollectionExpression();
CollectionExpression rightCollectionExpression=((OrCollectionExpression)collectionExpression).getRightCollectionExpression();
ExpressionExecutor expressionExecutor=null;
CollectionExecutor aCollectionExecutor=null;
CollectionExecutor leftCollectionExecutor;
CollectionExecutor rightCollectionExecutor;
if (leftCollectionExpression.getCollectionScope() == CollectionExpression.CollectionScope.NON && rightCollectionExpression.getCollectionScope() == CollectionExpression.CollectionScope.NON) {
expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
return new NonCollectionExecutor(expressionExecutor);
}
 else if (leftCollectionExpression.getCollectionScope() == CollectionExpression.CollectionScope.EXHAUSTIVE || rightCollectionExpression.getCollectionScope() == CollectionExpression.CollectionScope.EXHAUSTIVE) {
if (isFirst) {
expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
}
return new ExhaustiveCollectionExecutor(expressionExecutor,matchingMetaStateHolder.getCandidateEventIndex());
}
 else {
if (isFirst) {
aCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
leftCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
rightCollectionExecutor=buildCollectionExecutor(rightCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
return new OrCollectionExecutor(leftCollectionExecutor,rightCollectionExecutor,aCollectionExecutor);
}
}
 else if (collectionExpression instanceof NotCollectionExpression) {
ExpressionExecutor expressionExecutor=null;
switch (collectionExpression.getCollectionScope()) {
case NON:
expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
return new NonCollectionExecutor(expressionExecutor);
case INDEXED_ATTRIBUTE:
case INDEXED_RESULT_SET:
case OPTIMISED_RESULT_SET:
ExhaustiveCollectionExecutor exhaustiveCollectionExecutor=null;
if (isFirst) {
exhaustiveCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
CollectionExecutor notCollectionExecutor=buildCollectionExecutor(((NotCollectionExpression)collectionExpression).getCollectionExpression(),matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
return new NotCollectionExecutor(notCollectionExecutor,exhaustiveCollectionExecutor);
case EXHAUSTIVE:
if (isFirst) {
expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
}
return new ExhaustiveCollectionExecutor(expressionExecutor,matchingMetaStateHolder.getCandidateEventIndex());
}
}
 else {
ExpressionExecutor expressionExecutor=null;
if (collectionExpression.getCollectionScope() == CollectionExpression.CollectionScope.NON) {
expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
return new NonCollectionExecutor(expressionExecutor);
}
 else {
if (isFirst) {
expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
}
return new ExhaustiveCollectionExecutor(expressionExecutor,matchingMetaStateHolder.getCandidateEventIndex());
}
}
throw new UnsupportedOperationException(collectionExpression.getClass().getName() + "String_Node_Str");
}

Fixed version (ground truth):
public static CollectionExecutor buildCollectionExecutor(CollectionExpression collectionExpression,MatchingMetaStateHolder matchingMetaStateHolder,List<VariableExpressionExecutor> variableExpressionExecutors,Map<String,EventTable> eventTableMap,ExecutionPlanContext executionPlanContext,boolean isFirst){
  if (collectionExpression instanceof AttributeCollectionExpression) {
    return new CompareCollectionExecutor(((AttributeCollectionExpression)collectionExpression).getAttribute(),Compare.Operator.EQUAL,new ConstantExpressionExecutor(true,Attribute.Type.BOOL));
  }
 else   if (collectionExpression instanceof CompareCollectionExpression) {
    ExpressionExecutor valueExpressionExecutor=ExpressionParser.parseExpression(((CompareCollectionExpression)collectionExpression).getValueCollectionExpression().getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
    AttributeCollectionExpression attributeCollectionExpression=((AttributeCollectionExpression)((CompareCollectionExpression)collectionExpression).getAttributeCollectionExpression());
    return new CompareCollectionExecutor(attributeCollectionExpression.getAttribute(),((CompareCollectionExpression)collectionExpression).getOperator(),valueExpressionExecutor);
  }
 else   if (collectionExpression instanceof NullCollectionExpression) {
    return new CompareCollectionExecutor(((NullCollectionExpression)collectionExpression).getAttribute(),Compare.Operator.EQUAL,new ConstantExpressionExecutor(null,Attribute.Type.OBJECT));
  }
 else   if (collectionExpression instanceof AndCollectionExpression) {
    CollectionExpression leftCollectionExpression=((AndCollectionExpression)collectionExpression).getLeftCollectionExpression();
    CollectionExpression rightCollectionExpression=((AndCollectionExpression)collectionExpression).getRightCollectionExpression();
    ExpressionExecutor expressionExecutor=null;
    CollectionExecutor aCollectionExecutor=null;
    ExhaustiveCollectionExecutor exhaustiveCollectionExecutor=null;
    CollectionExecutor leftCollectionExecutor;
    CollectionExecutor rightCollectionExecutor;
switch (leftCollectionExpression.getCollectionScope()) {
case NON:
switch (rightCollectionExpression.getCollectionScope()) {
case NON:
        expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
      return new NonCollectionExecutor(expressionExecutor);
case INDEXED_ATTRIBUTE:
case INDEXED_RESULT_SET:
case OPTIMISED_RESULT_SET:
case EXHAUSTIVE:
    expressionExecutor=ExpressionParser.parseExpression(leftCollectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
  aCollectionExecutor=buildCollectionExecutor(rightCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
return new NonAndCollectionExecutor(expressionExecutor,aCollectionExecutor,rightCollectionExpression.getCollectionScope());
}
break;
case INDEXED_ATTRIBUTE:
switch (rightCollectionExpression.getCollectionScope()) {
case NON:
expressionExecutor=ExpressionParser.parseExpression(rightCollectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
aCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
return new NonAndCollectionExecutor(expressionExecutor,aCollectionExecutor,rightCollectionExpression.getCollectionScope());
case INDEXED_ATTRIBUTE:
case INDEXED_RESULT_SET:
case OPTIMISED_RESULT_SET:
if (isFirst) {
aCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
leftCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
rightCollectionExecutor=buildCollectionExecutor(rightCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
return new AnyAndCollectionExecutor(leftCollectionExecutor,rightCollectionExecutor,aCollectionExecutor);
case EXHAUSTIVE:
if (isFirst) {
exhaustiveCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
leftCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
return new CompareExhaustiveAndCollectionExecutor(leftCollectionExecutor,exhaustiveCollectionExecutor);
}
break;
case INDEXED_RESULT_SET:
case OPTIMISED_RESULT_SET:
switch (rightCollectionExpression.getCollectionScope()) {
case NON:
expressionExecutor=ExpressionParser.parseExpression(rightCollectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
aCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
return new NonAndCollectionExecutor(expressionExecutor,aCollectionExecutor,rightCollectionExpression.getCollectionScope());
case INDEXED_ATTRIBUTE:
if (isFirst) {
aCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
leftCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
rightCollectionExecutor=buildCollectionExecutor(rightCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
return new AnyAndCollectionExecutor(rightCollectionExecutor,leftCollectionExecutor,aCollectionExecutor);
case INDEXED_RESULT_SET:
case OPTIMISED_RESULT_SET:
if (isFirst) {
aCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
leftCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
rightCollectionExecutor=buildCollectionExecutor(rightCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
return new AnyAndCollectionExecutor(leftCollectionExecutor,rightCollectionExecutor,aCollectionExecutor);
case EXHAUSTIVE:
if (isFirst) {
exhaustiveCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
leftCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
return new CompareExhaustiveAndCollectionExecutor(leftCollectionExecutor,exhaustiveCollectionExecutor);
}
break;
case EXHAUSTIVE:
switch (rightCollectionExpression.getCollectionScope()) {
case NON:
expressionExecutor=ExpressionParser.parseExpression(rightCollectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
aCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
return new NonAndCollectionExecutor(expressionExecutor,aCollectionExecutor,rightCollectionExpression.getCollectionScope());
case INDEXED_ATTRIBUTE:
case INDEXED_RESULT_SET:
case OPTIMISED_RESULT_SET:
if (isFirst) {
exhaustiveCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
rightCollectionExecutor=buildCollectionExecutor(rightCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
return new CompareExhaustiveAndCollectionExecutor(rightCollectionExecutor,exhaustiveCollectionExecutor);
case EXHAUSTIVE:
if (isFirst) {
expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
}
return new ExhaustiveCollectionExecutor(expressionExecutor,matchingMetaStateHolder.getCandidateEventIndex());
}
break;
}
}
 else if (collectionExpression instanceof OrCollectionExpression) {
CollectionExpression leftCollectionExpression=((OrCollectionExpression)collectionExpression).getLeftCollectionExpression();
CollectionExpression rightCollectionExpression=((OrCollectionExpression)collectionExpression).getRightCollectionExpression();
ExpressionExecutor expressionExecutor=null;
CollectionExecutor aCollectionExecutor=null;
CollectionExecutor leftCollectionExecutor;
CollectionExecutor rightCollectionExecutor;
if (leftCollectionExpression.getCollectionScope() == CollectionExpression.CollectionScope.NON && rightCollectionExpression.getCollectionScope() == CollectionExpression.CollectionScope.NON) {
expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
return new NonCollectionExecutor(expressionExecutor);
}
 else if (leftCollectionExpression.getCollectionScope() == CollectionExpression.CollectionScope.EXHAUSTIVE || rightCollectionExpression.getCollectionScope() == CollectionExpression.CollectionScope.EXHAUSTIVE) {
if (isFirst) {
expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
}
return new ExhaustiveCollectionExecutor(expressionExecutor,matchingMetaStateHolder.getCandidateEventIndex());
}
 else {
if (isFirst) {
aCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
leftCollectionExecutor=buildCollectionExecutor(leftCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
rightCollectionExecutor=buildCollectionExecutor(rightCollectionExpression,matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,isFirst);
return new OrCollectionExecutor(leftCollectionExecutor,rightCollectionExecutor,aCollectionExecutor);
}
}
 else if (collectionExpression instanceof NotCollectionExpression) {
ExpressionExecutor expressionExecutor=null;
switch (collectionExpression.getCollectionScope()) {
case NON:
expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
return new NonCollectionExecutor(expressionExecutor);
case INDEXED_ATTRIBUTE:
case INDEXED_RESULT_SET:
case OPTIMISED_RESULT_SET:
ExhaustiveCollectionExecutor exhaustiveCollectionExecutor=null;
if (isFirst) {
exhaustiveCollectionExecutor=new ExhaustiveCollectionExecutor(ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0),matchingMetaStateHolder.getCandidateEventIndex());
}
CollectionExecutor notCollectionExecutor=buildCollectionExecutor(((NotCollectionExpression)collectionExpression).getCollectionExpression(),matchingMetaStateHolder,variableExpressionExecutors,eventTableMap,executionPlanContext,false);
return new NotCollectionExecutor(notCollectionExecutor,exhaustiveCollectionExecutor);
case EXHAUSTIVE:
if (isFirst) {
expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
}
return new ExhaustiveCollectionExecutor(expressionExecutor,matchingMetaStateHolder.getCandidateEventIndex());
}
}
 else {
ExpressionExecutor expressionExecutor=null;
if (collectionExpression.getCollectionScope() == CollectionExpression.CollectionScope.NON) {
expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
return new NonCollectionExecutor(expressionExecutor);
}
 else {
if (isFirst) {
expressionExecutor=ExpressionParser.parseExpression(collectionExpression.getExpression(),matchingMetaStateHolder.getMetaStateEvent(),matchingMetaStateHolder.getDefaultStreamEventIndex(),eventTableMap,variableExpressionExecutors,executionPlanContext,false,0);
}
return new ExhaustiveCollectionExecutor(expressionExecutor,matchingMetaStateHolder.getCandidateEventIndex());
}
}
throw new UnsupportedOperationException(collectionExpression.getClass().getName() + "String_Node_Str");
}