Exemple #1
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;
        }
            public EnumMethodMode Validate(EnumMethodValidateContext context)
            {
                var    stateClass   = typeof(MyLocalEnumMethodMedianState);   // the class providing state
                var    serviceClass = typeof(MyLocalEnumMethodMedianService); // the class providing the processing method
                var    methodName   = "Next";                                 // the name of the method for processing an item of input values
                EPType returnType   = new ClassEPType(typeof(double?));       // indicate that we are returning a Double-type value
                var    earlyExit    = false;

                var mode = new EnumMethodModeStaticMethod(stateClass, serviceClass, methodName, returnType, earlyExit);

                // we allow 1, 2 or 3 parameters
                mode.LambdaParameters = descriptor => {
                    if (descriptor.LambdaParameterNumber == 1)
                    {
                        return(EnumMethodLambdaParameterTypeIndex.INSTANCE);
                    }

                    if (descriptor.LambdaParameterNumber == 2)
                    {
                        return(EnumMethodLambdaParameterTypeSize.INSTANCE);
                    }

                    return(EnumMethodLambdaParameterTypeValue.INSTANCE);
                };

                return(mode);
            }
Exemple #3
0
 public EnumForgePlugin(
     IList <ExprDotEvalParam> bodiesAndParameters,
     EnumMethodModeStaticMethod mode,
     Type expectedStateReturnType,
     int numStreamsIncoming,
     EventType inputEventType)
 {
     _bodiesAndParameters = bodiesAndParameters;
     _mode = mode;
     _expectedStateReturnType = expectedStateReturnType;
     _numStreamsIncoming      = numStreamsIncoming;
     _inputEventType          = inputEventType;
 }
Exemple #4
0
 public EnumForgeDescFactoryPlugin(
     EnumMethodModeStaticMethod mode,
     string enumMethodUsedName,
     DotMethodFP footprint,
     IList<ExprNode> parameters,
     EventType inputEventType,
     Type collectionComponentType,
     StatementRawInfo raw,
     StatementCompileTimeServices services)
 {
     _mode = mode;
     _enumMethodUsedName = enumMethodUsedName;
     _footprint = footprint;
     _parameters = parameters;
     _inputEventType = inputEventType;
     _collectionComponentType = collectionComponentType;
     _raw = raw;
     _services = services;
 }
            public EnumMethodMode Validate(EnumMethodValidateContext context)
            {
                var mode = new EnumMethodModeStaticMethod(
                    typeof(MyLocalEnumMethodForgeStateWValueState),
                    typeof(MyLocalEnumMethodForgeStateWValueState),
                    "Next",
                    new ClassEPType(typeof(string)),
                    false);

                mode.LambdaParameters =
                    descriptor => {
                    if (descriptor.LambdaParameterNumber == 0)
                    {
                        return(new EnumMethodLambdaParameterTypeStateGetter(typeof(string), "Result"));
                    }

                    return(EnumMethodLambdaParameterTypeValue.INSTANCE);
                };
                return(mode);
            }
            public EnumMethodMode Validate(EnumMethodValidateContext context)
            {
                var mode = new EnumMethodModeStaticMethod(
                    typeof(MyLocalEnumMethodForgeThreeState),
                    typeof(MyLocalEnumMethodForgeThree),
                    "Next",
                    new ClassEPType(typeof(int?)),
                    false);

                mode.LambdaParameters =
                    descriptor => {
                    if (descriptor.LambdaParameterNumber == 0)
                    {
                        return(EnumMethodLambdaParameterTypeValue.INSTANCE);
                    }

                    return(EnumMethodLambdaParameterTypeIndex.INSTANCE);
                };
                return(mode);
            }