public override EnumEval GetEnumEval(EngineImportService engineImportService, EventAdapterService eventAdapterService, StreamTypeService streamTypeService, int statementId, string enumMethodUsedName, IList <ExprDotEvalParam> bodiesAndParameters, EventType inputEventType, Type collectionComponentType, int numStreamsIncoming, bool disablePropertyExpressionEventCollCache) { ExprDotEvalParam initValueParam = bodiesAndParameters[0]; ExprEvaluator initValueEval = initValueParam.BodyEvaluator; base.TypeInfo = EPTypeHelper.SingleValue(initValueEval.ReturnType.GetBoxedType()); var resultAndAdd = (ExprDotEvalParamLambda)bodiesAndParameters[1]; if (inputEventType != null) { return(new EnumEvalAggregateEvents( initValueEval, resultAndAdd.BodyEvaluator, resultAndAdd.StreamCountIncoming, (ObjectArrayEventType)resultAndAdd.GoesToTypes[0])); } else { return(new EnumEvalAggregateScalar( initValueEval, resultAndAdd.BodyEvaluator, resultAndAdd.StreamCountIncoming, (ObjectArrayEventType)resultAndAdd.GoesToTypes[0], (ObjectArrayEventType)resultAndAdd.GoesToTypes[1])); } }
public override EnumEval GetEnumEval(MethodResolutionService methodResolutionService, EventAdapterService eventAdapterService, StreamTypeService streamTypeService, int statementId, string enumMethodUsedName, IList <ExprDotEvalParam> bodiesAndParameters, EventType inputEventType, Type collectionComponentType, int numStreamsIncoming, bool disablePropertyExpressionEventCollCache) { ExprDotEvalParam first = bodiesAndParameters[0]; ExprDotEnumerationSource enumSrc = ExprDotNodeUtility.GetEnumerationSource( first.Body, streamTypeService, eventAdapterService, statementId, true, disablePropertyExpressionEventCollCache); if (inputEventType != null) { base.TypeInfo = EPTypeHelper.CollectionOfEvents(inputEventType); } else { base.TypeInfo = EPTypeHelper.CollectionOfSingleValue(collectionComponentType); } if (enumSrc.Enumeration == null) { String message = "Enumeration method '" + enumMethodUsedName + "' requires an expression yielding an event-collection as input paramater"; throw new ExprValidationException(message); } var setType = enumSrc.Enumeration.GetEventTypeCollection(eventAdapterService, statementId); if (!Equals(setType, inputEventType)) { bool isSubtype = EventTypeUtility.IsTypeOrSubTypeOf(setType, inputEventType); if (!isSubtype) { String message = "Enumeration method '" + enumMethodUsedName + "' expects event type '" + inputEventType.Name + "' but receives event type '" + enumSrc.Enumeration.GetEventTypeCollection(eventAdapterService, statementId).Name + "'"; throw new ExprValidationException(message); } } if (EnumMethodEnum == EnumMethodEnum.UNION) { return(new EnumEvalUnion(numStreamsIncoming, enumSrc.Enumeration, inputEventType == null)); } else if (EnumMethodEnum == EnumMethodEnum.INTERSECT) { return(new EnumEvalIntersect(numStreamsIncoming, enumSrc.Enumeration, inputEventType == null)); } else if (EnumMethodEnum == EnumMethodEnum.EXCEPT) { return(new EnumEvalExcept(numStreamsIncoming, enumSrc.Enumeration, inputEventType == null)); } else { throw new ArgumentException("Invalid enumeration method for this factory: " + EnumMethodEnum); } }