protected override ThreeFormNoParamFactory.ForgeFunction NoParamsForge(
     EnumMethodEnum enumMethod,
     EPType type,
     StatementCompileTimeServices services)
 {
     throw new IllegalStateException();
 }
Пример #2
0
 protected override ThreeFormNoParamFactory.ForgeFunction NoParamsForge(
     EnumMethodEnum enumMethod,
     EPType type,
     StatementCompileTimeServices services)
 {
     if (type.GetNormalizedClass().IsBigInteger())
     {
         return(streamCountIncoming => new EnumAverageBigIntegerScalarNoParam(streamCountIncoming));
         // services.ImportServiceCompileTime.DefaultMathContext
     }
     else if (type.GetNormalizedClass().IsDecimal())
     {
         return(streamCountIncoming => new EnumAverageDecimalScalarNoParam(
                    streamCountIncoming));
     }
     else if (type.GetNormalizedClass().IsDouble())
     {
         return(streamCountIncoming => new EnumAverageDoubleScalarNoParam(
                    streamCountIncoming));
     }
     else
     {
         throw new ArgumentException("Failed to find a suitable scalar no-param");
     }
 }
Пример #3
0
 protected override ThreeFormNoParamFactory.ForgeFunction NoParamsForge(
     EnumMethodEnum enumMethod,
     EPType type,
     StatementCompileTimeServices services)
 {
     return(streamCountIncoming => new EnumArrayOfScalarNoParams(ComponentType(type)));
 }
Пример #4
0
 protected override ThreeFormNoParamFactory.ForgeFunction NoParamsForge(
     EnumMethodEnum enumMethod,
     EPType type,
     StatementCompileTimeServices services)
 {
     return(_ => new EnumCountOfNoParams(_));
 }
Пример #5
0
 protected override ThreeFormNoParamFactory.ForgeFunction NoParamsForge(
     EnumMethodEnum enumMethod,
     EPType type,
     StatementCompileTimeServices services)
 {
     return(streamCountIncoming => new EnumDistinctOfScalarNoParams(streamCountIncoming, ((ClassMultiValuedEPType)type).Component));
 }
Пример #6
0
 protected override ThreeFormScalarFactory.ForgeFunction SingleParamScalar(EnumMethodEnum enumMethod)
 {
     return((
                lambda,
                fieldType,
                numParams,
                typeInfo,
                services) => {
         if (typeInfo.GetNormalizedClass().IsBigInteger())
         {
             return new EnumAverageBigIntegerScalar(lambda, fieldType, numParams);
         }
         else if (typeInfo.GetNormalizedClass().IsDecimal())
         {
             return new EnumAverageDecimalScalar(lambda, fieldType, numParams);
         }
         else if (typeInfo.GetNormalizedClass().IsDouble())
         {
             return new EnumAverageDoubleScalar(lambda, fieldType, numParams);
         }
         else
         {
             throw new ArgumentException("Failed to find a suitable scalar");
         }
     });
 }
Пример #7
0
 protected override ThreeFormNoParamFactory.ForgeFunction NoParamsForge(
     EnumMethodEnum enumMethod,
     EPType type,
     StatementCompileTimeServices services)
 {
     return(streamCountIncoming => new EnumMinMaxScalarNoParam(streamCountIncoming, enumMethod == EnumMethodEnum.MAX, type));
 }
Пример #8
0
        public override void Initialize(
            DotMethodFP footprint,
            EnumMethodEnum enumMethod,
            string enumMethodUsedName,
            EventType inputEventType,
            Type collectionComponentType,
            IList<ExprNode> parameters,
            StreamTypeService streamTypeService,
            StatementRawInfo statementRawInfo,
            StatementCompileTimeServices services)
        {
            // validate
            var ctx = new EnumMethodValidateContext(
                footprint,
                inputEventType,
                collectionComponentType,
                streamTypeService,
                enumMethod,
                parameters,
                statementRawInfo);
            var enumMethodMode = _forgeFactory.Validate(ctx);
            if (!(enumMethodMode is EnumMethodModeStaticMethod)) {
                throw new ExprValidationException("Unexpected EnumMethodMode implementation, expected a provided implementation");
            }

            Mode = (EnumMethodModeStaticMethod) enumMethodMode;
        }
 protected override ThreeFormEventPlainFactory.ForgeFunction SingleParamEventPlain(
     EnumMethodEnum enumMethod)
 {
     return((lambda, typeInfo, services) =>
            enumMethod == EnumMethodEnum.TAKEWHILELAST
                             ? (EnumForge) new EnumTakeWhileLastEvent(lambda)
                             : (EnumForge) new EnumTakeWhileEvent(lambda));
 }
Пример #10
0
 public abstract EnumForgeDescFactory GetForgeFactory(
     DotMethodFP footprint,
     IList<ExprNode> parameters,
     EnumMethodEnum enumMethod,
     string enumMethodUsedName,
     EventType inputEventType,
     Type collectionComponentType,
     ExprValidationContext validationContext);
Пример #11
0
 protected override ThreeFormEventPlusFactory.ForgeFunction SingleParamEventPlus(
     EnumMethodEnum enumMethod)
 {
     return((lambda, fieldType, numParameters, typeInfo, services) =>
            enumMethod == EnumMethodEnum.TAKEWHILELAST
                     ? (EnumForge) new EnumTakeWhileLastEventPlus(lambda, fieldType, numParameters)
                     : (EnumForge) new EnumTakeWhileEventPlus(lambda, fieldType, numParameters));
 }
Пример #12
0
 protected override ThreeFormScalarFactory.ForgeFunction SingleParamScalar(
     EnumMethodEnum enumMethod)
 {
     return((lambda, eventType, numParams, typeInfo, services) =>
            enumMethod == EnumMethodEnum.TAKEWHILELAST
                     ? (EnumForge) new EnumTakeWhileLastScalar(lambda, eventType, numParams)
                     : (EnumForge) new EnumTakeWhileScalar(lambda, eventType, numParams));
 }
Пример #13
0
 protected override ThreeFormScalarFactory.ForgeFunction SingleParamScalar(EnumMethodEnum enumMethod)
 {
     return((
                lambda,
                fieldType,
                numParams,
                typeInfo,
                services) => new EnumArrayOfScalar(lambda, fieldType, numParams, ComponentType(typeInfo)));
 }
Пример #14
0
 public EnumForgeDescFactoryEIU(
     EnumMethodEnum enumMethod,
     EPType type,
     ExprDotEnumerationSourceForge enumSrc)
 {
     _enumMethod = enumMethod;
     _type = type;
     _enumSrc = enumSrc;
 }
Пример #15
0
 public EnumForgeDescFactoryTake(
     EnumMethodEnum enumMethod,
     EPType type,
     bool isScalar)
 {
     _enumMethod = enumMethod;
     _type = type;
     _isScalar = isScalar;
 }
Пример #16
0
 protected override ThreeFormScalarFactory.ForgeFunction SingleParamScalar(EnumMethodEnum enumMethod)
 {
     return((
                lambda,
                fieldType,
                numParams,
                typeInfo,
                services) => new EnumWhereScalar(lambda, fieldType, numParams));
 }
Пример #17
0
 protected override ThreeFormScalarFactory.ForgeFunction SingleParamScalar(EnumMethodEnum enumMethod)
 {
     return((
                lambda,
                fieldType,
                numParams,
                typeInfo,
                services) => new EnumAllOfAnyOfScalar(lambda, fieldType, numParams, enumMethod == EnumMethodEnum.ALLOF));
 }
Пример #18
0
 protected override ThreeFormScalarFactory.ForgeFunction SingleParamScalar(EnumMethodEnum enumMethod)
 {
     return((
                lambda,
                eventType,
                numParams,
                typeInfo,
                services) => new EnumMinMaxScalar(lambda, eventType, numParams, enumMethod == EnumMethodEnum.MAX));
 }
 protected override ThreeFormScalarFactory.ForgeFunction SingleParamScalar(EnumMethodEnum enumMethod)
 {
     return((
                lambda,
                eventType,
                numParams,
                typeInfo,
                services) =>
            new EnumMostLeastFrequentScalar(lambda, eventType, numParams, enumMethod == EnumMethodEnum.MOSTFREQUENT));
 }
 protected override ThreeFormNoParamFactory.ForgeFunction NoParamsForge(
     EnumMethodEnum enumMethod,
     EPType type,
     StatementCompileTimeServices services)
 {
     return(streamCountIncoming => new EnumMostLeastFrequentScalarNoParam(
                streamCountIncoming,
                enumMethod == EnumMethodEnum.MOSTFREQUENT,
                type.GetNormalizedClass()));
 }
Пример #21
0
 public override EnumForgeDescFactory GetForgeFactory(
     DotMethodFP footprint,
     IList<ExprNode> parameters,
     EnumMethodEnum enumMethod,
     String enumMethodUsedName,
     EventType inputEventType,
     Type collectionComponentType,
     ExprValidationContext validationContext)
 {
     return new EnumForgeDescFactorySeqEqual(inputEventType == null);
 }
Пример #22
0
 public EnumMethodDesc(
     string methodName,
     EnumMethodEnum enumMethod,
     ExprDotForgeEnumMethodFactory factory,
     DotMethodFP[] parameters)
 {
     _enumMethodName = methodName;
     _enumMethod     = enumMethod;
     _factory        = factory;
     _parameters     = parameters;
 }
Пример #23
0
 public virtual void Initialize(
     DotMethodFP footprint,
     EnumMethodEnum enumMethod,
     string enumMethodUsedName,
     EventType inputEventType,
     Type collectionComponentType,
     IList<ExprNode> parameters,
     StreamTypeService streamTypeService,
     StatementRawInfo statementRawInfo,
     StatementCompileTimeServices services)
 {
     // override as required
 }
Пример #24
0
 protected override ThreeFormNoParamFactory.ForgeFunction NoParamsForge(
     EnumMethodEnum enumMethod,
     EPType type,
     StatementCompileTimeServices services)
 {
     if (enumMethod == EnumMethodEnum.FIRSTOF)
     {
         return(streamCountIncoming => new EnumFirstOf(streamCountIncoming, type));
     }
     else
     {
         return(streamCountIncoming => new EnumLastOf(streamCountIncoming, type));
     }
 }
Пример #25
0
	    /// <summary>
	    ///     Ctor.
	    /// </summary>
	    /// <param name="footprintFound">actual footprint chosen</param>
	    /// <param name="inputEventType">input event type or null if the input is not a collection of events</param>
	    /// <param name="inputCollectionComponentType">type of scalar or object (non-event) input values, or null if the input is a collection of events</param>
	    /// <param name="streamTypeService">event type information</param>
	    /// <param name="currentMethod">information on the current method</param>
	    /// <param name="currentParameters">parameters</param>
	    /// <param name="statementRawInfo">EPL statement information</param>
	    public EnumMethodValidateContext(
            DotMethodFP footprintFound,
            EventType inputEventType,
            Type inputCollectionComponentType,
            StreamTypeService streamTypeService,
            EnumMethodEnum currentMethod,
            IList<ExprNode> currentParameters,
            StatementRawInfo statementRawInfo)
        {
            FootprintFound = footprintFound;
            InputEventType = inputEventType;
            InputCollectionComponentType = inputCollectionComponentType;
            StreamTypeService = streamTypeService;
            CurrentMethod = currentMethod;
            CurrentParameters = currentParameters;
            StatementRawInfo = statementRawInfo;
        }
Пример #26
0
 public override EnumForgeDescFactory GetForgeFactory(
     DotMethodFP footprint,
     IList<ExprNode> parameters,
     EnumMethodEnum enumMethod,
     String enumMethodUsedName,
     EventType inputEventType,
     Type collectionComponentType,
     ExprValidationContext validationContext) 
 {
     EPType type;
     if (inputEventType != null) {
         type = EPTypeHelper.CollectionOfEvents(inputEventType);
     } else {
         type = EPTypeHelper.CollectionOfSingleValue(collectionComponentType, null);
     }
     return new EnumForgeDescFactoryTake(enumMethod, type, inputEventType == null);
 }
Пример #27
0
        public override EnumForgeDescFactory GetForgeFactory(
            DotMethodFP footprint,
            IList <ExprNode> parameters,
            EnumMethodEnum enumMethod,
            string enumMethodUsedName,
            EventType inputEventType,
            Type collectionComponentType,
            ExprValidationContext validationContext)
        {
            var goesNode      = (ExprLambdaGoesNode)parameters[1];
            var numParameters = goesNode.GoesToNames.Count;
            var firstName     = goesNode.GoesToNames[0];
            var secondName    = goesNode.GoesToNames[1];

            IDictionary <string, object> fields = new Dictionary <string, object>();
            var initializationType = parameters[0].Forge.EvaluationType;

            fields.Put(firstName, initializationType);
            if (inputEventType == null)
            {
                fields.Put(secondName, collectionComponentType);
            }

            if (numParameters > 2)
            {
                fields.Put(goesNode.GoesToNames[2], typeof(int));
                if (numParameters > 3)
                {
                    fields.Put(goesNode.GoesToNames[3], typeof(int));
                }
            }

            var evalEventType = ExprDotNodeUtility.MakeTransientOAType(
                enumMethodUsedName,
                fields,
                validationContext.StatementRawInfo,
                validationContext.StatementCompileTimeService);

            if (inputEventType == null)
            {
                return(new EnumForgeDescFactoryAggregateScalar(evalEventType));
            }

            return(new EnumForgeDescFactoryAggregateEvent(evalEventType, inputEventType, secondName, numParameters));
        }
Пример #28
0
 protected override ThreeFormScalarFactory.ForgeFunction SingleParamScalar(EnumMethodEnum enumMethod)
 {
     return((
                lambda,
                eventType,
                numParams,
                typeInfo,
                services) => {
         if (enumMethod == EnumMethodEnum.FIRSTOF)
         {
             return new EnumFirstOfScalar(lambda, eventType, numParams, typeInfo);
         }
         else
         {
             return new EnumLastOfScalar(lambda, eventType, numParams, typeInfo);
         }
     });
 }
Пример #29
0
 public override EnumForgeDescFactory GetForgeFactory(
     DotMethodFP footprint,
     IList<ExprNode> parameters,
     EnumMethodEnum enumMethod,
     string enumMethodUsedName,
     EventType inputEventType,
     Type collectionComponentType,
     ExprValidationContext validationContext)
 {
     return new ProxyEnumForgeDescFactory() {
         ProcGetLambdaStreamTypesForParameter = parameterNum => new EnumForgeLambdaDesc(new EventType[0], new String[0]),
         ProcMakeEnumForgeDesc = (
             bodiesAndParameters,
             streamCountIncoming,
             services) => {
             var type = EPTypeHelper.CollectionOfEvents(inputEventType);
             return new EnumForgeDesc(type, new EnumForgeNoOp(streamCountIncoming));
         }
     };
 }
Пример #30
0
        public override EnumForgeDescFactory GetForgeFactory(
            DotMethodFP footprint,
            IList<ExprNode> parameters,
            EnumMethodEnum enumMethod,
            string enumMethodUsedName,
            EventType inputEventType,
            Type collectionComponentType,
            ExprValidationContext validationContext)
        {
            if (Mode == null) {
                throw new IllegalStateException("Initialize did not take place");
            }

            return new EnumForgeDescFactoryPlugin(
                Mode,
                enumMethodUsedName,
                footprint,
                parameters,
                inputEventType,
                collectionComponentType,
                validationContext.StatementRawInfo,
                validationContext.StatementCompileTimeService);
        }