예제 #1
0
        internal override void Assign(
            CodegenMethod method,
            CodegenExpressionRef factory,
            SAIFFInitializeSymbol symbols,
            CodegenClassScope classScope)
        {
            if (scheduleCallbackId == -1) {
                throw new IllegalStateException("No schedule callback id");
            }

            method.Block
                .DeclareVar<TimePeriodCompute>("eval", timePeriodCompute.MakeEvaluator(method, classScope))
                .SetProperty(factory, "TimePeriodCompute", Ref("eval"))
                .SetProperty(factory, "ScheduleCallbackId", Constant(scheduleCallbackId));
        }
 internal override void Assign(
     CodegenMethod method,
     CodegenExpressionRef factory,
     SAIFFInitializeSymbol symbols,
     CodegenClassScope classScope)
 {
     method.Block
         .DeclareVar<TimePeriodCompute>("eval", timePeriodComputeForge.MakeEvaluator(method, classScope))
         .SetProperty(factory, "TimePeriodCompute", Ref("eval"))
         .SetProperty(
             factory,
             "TimestampEval",
             ExprNodeUtilityCodegen
                 .CodegenEvaluator(timestampExpression.Forge, method, GetType(), classScope));
 }
예제 #3
0
        public CodegenExpression Make(
            CodegenMethodScope parent,
            SAIFFInitializeSymbol symbols,
            CodegenClassScope classScope)
        {
            var method = parent.MakeChild(typeof(RowRecogDesc), GetType(), classScope);
            var desc = Ref("desc");
            CodegenExpression init = symbols.GetAddInitSvc(method);

            var startStateNums = new int[_startStates.Length];
            for (var i = 0; i < _startStates.Length; i++) {
                startStateNums[i] = _startStates[i].NodeNumFlat;
            }

            var aggregationServiceFactories = ConstantNull();
            if (_aggregationServices != null) {
                var initAggsSvcs = new CodegenExpression[_aggregationServices.Length];
                for (var i = 0; i < _aggregationServices.Length; i++) {
                    initAggsSvcs[i] = ConstantNull();
                    if (_aggregationServices[i] != null) {
                        var aggSvc = _aggregationServices[i];
                        var aggregationClassNames = new AggregationClassNames("_mra" + i);
                        var result = AggregationServiceFactoryCompiler.MakeInnerClassesAndInit(
                            false,
                            aggSvc.AggregationServiceFactoryForge,
                            method,
                            classScope,
                            classScope.OutermostClassName,
                            aggregationClassNames);
                        classScope.AddInnerClasses(result.InnerClasses);
                        initAggsSvcs[i] = LocalMethod(result.InitMethod, symbols.GetAddInitSvc(parent));
                    }
                }

                aggregationServiceFactories = NewArrayWithInit(typeof(AggregationServiceFactory), initAggsSvcs);
            }

            method.Block
                .DeclareVar<RowRecogDesc>(desc.Ref, NewInstance(typeof(RowRecogDesc)))
                .SetProperty(desc, "ParentEventType", EventTypeUtility.ResolveTypeCodegen(_parentEventType, init))
                .SetProperty(desc, "RowEventType", EventTypeUtility.ResolveTypeCodegen(RowEventType, init))
                .SetProperty(desc, "CompositeEventType", EventTypeUtility.ResolveTypeCodegen(_compositeEventType, init))
                .SetProperty(
                    desc,
                    "MultimatchEventType",
                    _multimatchEventType == null
                        ? ConstantNull()
                        : EventTypeUtility.ResolveTypeCodegen(_multimatchEventType, init))
                .SetProperty(desc, "MultimatchStreamNumToVariable", Constant(_multimatchStreamNumToVariable))
                .SetProperty(desc, "MultimatchVariableToStreamNum", Constant(_multimatchVariableToStreamNum))
                .SetProperty(
                    desc,
                    "PartitionEvalMayNull",
                    MultiKeyCodegen.CodegenExprEvaluatorMayMultikey(_partitionBy, null, _partitionByMultiKey, method, classScope))
                .SetProperty(
                    desc,
                    "PartitionEvalTypes",
                    _partitionBy == null
                        ? ConstantNull()
                        : Constant(ExprNodeUtilityQuery.GetExprResultTypes(_partitionBy)))
                .SetProperty(desc, "PartitionEvalSerde", _partitionBy == null ? ConstantNull() : _partitionByMultiKey.GetExprMKSerde(method, classScope))
                .SetProperty(desc, "VariableStreams", MakeVariableStreams(method, symbols, classScope))
                .SetProperty(desc, "HasInterval", Constant(_hasInterval))
                .SetProperty(desc, "IsIterateOnly", Constant(_iterateOnly))
                .SetProperty(desc, "IsUnbound", Constant(_unbound))
                .SetProperty(desc, "IsOrTerminated", Constant(_orTerminated))
                .SetProperty(desc, "IsCollectMultimatches", Constant(_collectMultimatches))
                .SetProperty(desc, "IsDefineAsksMultimatches", Constant(_defineAsksMultimatches))
                .SetProperty(desc, "NumEventsEventsPerStreamDefine", Constant(_numEventsEventsPerStreamDefine))
                .SetProperty(desc, "MultimatchVariablesArray", Constant(_multimatchVariablesArray))
                .SetProperty(desc, "StatesOrdered", MakeStates(method, symbols, classScope))
                .SetProperty(desc, "NextStatesPerState", MakeNextStates(method, classScope))
                .SetProperty(desc, "StartStates", Constant(startStateNums))
                .SetProperty(desc, "IsAllMatches", Constant(_allMatches))
                .SetProperty(desc, "Skip", Constant(_skip))
                .SetProperty(
                    desc,
                    "ColumnEvaluators",
                    ExprNodeUtilityCodegen.CodegenEvaluators(_columnEvaluators, method, GetType(), classScope))
                .SetProperty(desc, "ColumnNames", Constant(_columnNames))
                .SetProperty(
                    desc,
                    "IntervalCompute",
                    _intervalCompute == null ? ConstantNull() : _intervalCompute.MakeEvaluator(method, classScope))
                .SetProperty(desc, "PreviousRandomAccessIndexes", Constant(_previousRandomAccessIndexes))
                .SetProperty(desc, "AggregationServiceFactories", aggregationServiceFactories)
                .SetProperty(
                    desc,
                    "AggregationResultFutureAssignables",
                    _aggregationServices == null ? ConstantNull() : MakeAggAssignables(method, classScope))
                .MethodReturn(desc);
            return LocalMethod(method);
        }