public static void ProcessJoinResultCodegen(
            ResultSetProcessorRowPerEventForge forge,
            CodegenClassScope classScope,
            CodegenMethod method,
            CodegenInstanceAux instance)
        {
            method.Block.DeclareVar<EventBean[]>("selectOldEvents", ConstantNull())
                .DeclareVarNoInit(typeof(EventBean[]), "selectNewEvents");

            if (forge.IsUnidirectional) {
                method.Block.ExprDotMethod(Ref("this"), "Clear");
            }

            method.Block.StaticMethod(
                typeof(ResultSetProcessorUtil),
                METHOD_APPLYAGGJOINRESULT,
                MEMBER_AGGREGATIONSVC,
                MEMBER_AGENTINSTANCECONTEXT,
                REF_NEWDATA,
                REF_OLDDATA);

            ResultSetProcessorUtil.ProcessJoinResultCodegen(
                method,
                classScope,
                instance,
                forge.OptionalHavingNode != null,
                forge.IsSelectRStream,
                forge.IsSorting,
                true);
        }
        public static void ApplyViewResultCodegen(
            ResultSetProcessorRowPerGroupForge forge,
            CodegenClassScope classScope,
            CodegenMethod method,
            CodegenInstanceAux instance)
        {
            method.Block.DeclareVar<EventBean[]>(NAME_EPS, NewArrayByLength(typeof(EventBean), Constant(1)));

            {
                CodegenBlock ifNew = method.Block.IfCondition(NotEqualsNull(REF_NEWDATA));
                {
                    CodegenBlock newLoop = ifNew.ForEach(typeof(EventBean), "aNewData", REF_NEWDATA);
                    newLoop.AssignArrayElement(NAME_EPS, Constant(0), Ref("aNewData"))
                        .DeclareVar<object>(
                            "mk",
                            LocalMethod(forge.GenerateGroupKeySingle, REF_EPS, ConstantTrue()))
                        .ExprDotMethod(Ref("groupReps"), "Put", Ref("mk"), Ref("aNewData"))
                        .ExprDotMethod(MEMBER_AGGREGATIONSVC, "ApplyEnter", REF_EPS, Ref("mk"), MEMBER_AGENTINSTANCECONTEXT);
                }
            }

            {
                CodegenBlock ifOld = method.Block.IfCondition(NotEqualsNull(REF_OLDDATA));
                {
                    CodegenBlock oldLoop = ifOld.ForEach(typeof(EventBean), "anOldData", REF_OLDDATA);
                    oldLoop.AssignArrayElement(NAME_EPS, Constant(0), Ref("anOldData"))
                        .DeclareVar<object>(
                            "mk",
                            LocalMethod(forge.GenerateGroupKeySingle, REF_EPS, ConstantFalse()))
                        .ExprDotMethod(MEMBER_AGGREGATIONSVC, "ApplyLeave", REF_EPS, Ref("mk"), MEMBER_AGENTINSTANCECONTEXT);
                }
            }
        }
        protected internal static void ProcessOutputLimitedLastAllNonBufferedCodegen(
            string methodName,
            ResultSetProcessorRowForAllForge forge,
            CodegenClassScope classScope,
            CodegenMethod method,
            CodegenInstanceAux instance)
        {
            var factory = classScope.AddOrGetDefaultFieldSharable(ResultSetProcessorHelperFactoryField.INSTANCE);

            if (forge.OutputLimitSpec.DisplayLimit == OutputLimitLimitType.ALL) {
                instance.AddMember(NAME_OUTPUTALLHELPER, typeof(ResultSetProcessorRowForAllOutputAllHelper));
                instance.ServiceCtor.Block.AssignRef(
                    NAME_OUTPUTALLHELPER,
                    ExprDotMethod(factory, "MakeRSRowForAllOutputAll", Ref("this"), MEMBER_AGENTINSTANCECONTEXT));
                method.Block.ExprDotMethod(
                    Member(NAME_OUTPUTALLHELPER),
                    methodName,
                    REF_NEWDATA,
                    REF_OLDDATA,
                    REF_ISSYNTHESIZE);
            }
            else if (forge.OutputLimitSpec.DisplayLimit == OutputLimitLimitType.LAST) {
                instance.AddMember(NAME_OUTPUTLASTHELPER, typeof(ResultSetProcessorRowForAllOutputLastHelper));
                instance.ServiceCtor.Block.AssignRef(
                    NAME_OUTPUTLASTHELPER,
                    ExprDotMethod(factory, "MakeRSRowForAllOutputLast", Ref("this"), MEMBER_AGENTINSTANCECONTEXT));
                method.Block.ExprDotMethod(
                    Member(NAME_OUTPUTLASTHELPER),
                    methodName,
                    REF_NEWDATA,
                    REF_OLDDATA,
                    REF_ISSYNTHESIZE);
            }
        }
Exemplo n.º 4
0
 public void ApplyJoinResultCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     // no action
 }
Exemplo n.º 5
0
 public void StopMethodCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorSimpleImpl.StopMethodCodegen(method, instance);
 }
 public void ApplyJoinResultCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorRowPerGroupImpl.ApplyJoinResultCodegen(this, classScope, method, instance);
 }
Exemplo n.º 7
0
 public void GetEnumeratorJoinCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorSimpleImpl.GetEnumeratorJoinCodegen(this, classScope, method, instance);
 }
Exemplo n.º 8
0
 public void ApplyJoinResultCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorRowForAllImpl.ApplyJoinResultCodegen(method);
 }
Exemplo n.º 9
0
 public void InstanceCodegen(
     CodegenInstanceAux instance,
     CodegenClassScope classScope,
     CodegenCtor factoryCtor,
     IList<CodegenTypedParam> factoryMembers)
 {
     instance.Properties.AddProperty(
         typeof(AggregationService),
         "AggregationService",
         typeof(ResultSetProcessorRowForAll),
         classScope,
         node => node.GetterBlock.BlockReturn(MEMBER_AGGREGATIONSVC));
     instance.Properties.AddProperty(
         typeof(ExprEvaluatorContext),
         "ExprEvaluatorContext",
         typeof(ResultSetProcessorRowForAll),
         classScope,
         node => node.GetterBlock.BlockReturn(MEMBER_AGENTINSTANCECONTEXT));
     instance.Properties.AddProperty(
         typeof(bool),
         "IsSelectRStream",
         typeof(ResultSetProcessorRowForAll),
         classScope,
         node => node.GetterBlock.BlockReturn(Constant(IsSelectRStream)));
     ResultSetProcessorUtil.EvaluateHavingClauseCodegen(OptionalHavingNode, classScope, instance);
     ResultSetProcessorRowForAllImpl.GetSelectListEventsAsArrayCodegen(this, classScope, instance);
 }
Exemplo n.º 10
0
 public void GetEnumeratorViewCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorRowForAllImpl.GetEnumeratorViewCodegen(this, classScope, method, instance);
 }
Exemplo n.º 11
0
 public void ProcessOutputLimitedViewCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorRowForAllImpl.ProcessOutputLimitedViewCodegen(this, classScope, method, instance);
 }
Exemplo n.º 12
0
 public void ApplyViewResultCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorRowPerEventImpl.ApplyViewResultCodegen(method);
 }
Exemplo n.º 13
0
 public void ProcessJoinResultCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorRowPerEventImpl.ProcessJoinResultCodegen(this, classScope, method, instance);
 }
        public static void ProcessViewResultCodegen(
            ResultSetProcessorRowPerEventForge forge,
            CodegenClassScope classScope,
            CodegenMethod method,
            CodegenInstanceAux instance)
        {
            method.Block
                .DeclareVar<EventBean[]>("selectOldEvents", ConstantNull())
                .DeclareVarNoInit(typeof(EventBean[]), "selectNewEvents")
                .DeclareVar<EventBean[]>("eventsPerStream", NewArrayByLength(typeof(EventBean), Constant(1)))
                .StaticMethod(
                    typeof(ResultSetProcessorUtil),
                    METHOD_APPLYAGGVIEWRESULT,
                    MEMBER_AGGREGATIONSVC,
                    MEMBER_AGENTINSTANCECONTEXT,
                    REF_NEWDATA,
                    REF_OLDDATA,
                    Ref("eventsPerStream"));

            ResultSetProcessorUtil.ProcessViewResultCodegen(
                method,
                classScope,
                instance,
                forge.OptionalHavingNode != null,
                forge.IsSelectRStream,
                forge.IsSorting,
                true);
        }
Exemplo n.º 15
0
        private static void GenerateInstrumentedProcessView(
            ResultSetProcessorFactoryForge forge,
            CodegenClassScope classScope,
            CodegenMethod method,
            CodegenInstanceAux instance)
        {
            if (!classScope.IsInstrumented) {
                forge.ProcessViewResultCodegen(classScope, method, instance);
                return;
            }

            var instrumented = method.MakeChild(typeof(UniformPair<EventBean[]>), forge.GetType(), classScope)
                .AddParam(typeof(EventBean[]), NAME_NEWDATA)
                .AddParam(typeof(EventBean[]), NAME_OLDDATA)
                .AddParam(typeof(bool), NAME_ISSYNTHESIZE);
            forge.ProcessViewResultCodegen(classScope, instrumented, instance);

            method.Block
                .DebugStack()
                .Apply(InstrumentationCode.Instblock(classScope, "q" + forge.InstrumentedQName))
                .DeclareVar<UniformPair<EventBean[]>>(
                    "pair",
                    LocalMethod(instrumented, REF_NEWDATA, REF_OLDDATA, REF_ISSYNTHESIZE))
                .Apply(InstrumentationCode.Instblock(classScope, "a" + forge.InstrumentedQName, Ref("pair")))
                .MethodReturn(Ref("pair"));
        }
Exemplo n.º 16
0
 private static void ProcessOutputLimitedLastAllNonBufferedCodegen(
     ResultSetProcessorSimpleForge forge,
     string methodName,
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     var factory = classScope.AddOrGetDefaultFieldSharable(ResultSetProcessorHelperFactoryField.INSTANCE);
     CodegenExpression eventTypes = classScope.AddDefaultFieldUnshared(
         true,
         typeof(EventType[]),
         EventTypeUtility.ResolveTypeArrayCodegen(forge.EventTypes, EPStatementInitServicesConstants.REF));
     if (forge.IsOutputAll) {
         instance.AddMember(NAME_OUTPUTALLHELPER, typeof(ResultSetProcessorSimpleOutputAllHelper));
         instance.ServiceCtor.Block.AssignRef(
             NAME_OUTPUTALLHELPER,
             ExprDotMethod(factory, "MakeRSSimpleOutputAll", Ref("this"), MEMBER_AGENTINSTANCECONTEXT, eventTypes));
         method.Block.ExprDotMethod(Member(NAME_OUTPUTALLHELPER), methodName, REF_NEWDATA, REF_OLDDATA);
     }
     else if (forge.IsOutputLast) {
         instance.AddMember(NAME_OUTPUTLASTHELPER, typeof(ResultSetProcessorSimpleOutputLastHelper));
         instance.ServiceCtor.Block.AssignRef(
             NAME_OUTPUTLASTHELPER,
             ExprDotMethod(
                 factory,
                 "MakeRSSimpleOutputLast",
                 Ref("this"),
                 MEMBER_AGENTINSTANCECONTEXT,
                 eventTypes));
         method.Block.ExprDotMethod(Member(NAME_OUTPUTLASTHELPER), methodName, REF_NEWDATA, REF_OLDDATA);
     }
 }
 public void ProcessOutputLimitedJoinCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorRowPerGroupImpl.ProcessOutputLimitedJoinCodegen(this, classScope, method, instance);
 }
        protected internal static void ApplyViewResultUnboundCodegen(
            ResultSetProcessorRowPerGroupRollupForge forge,
            CodegenClassScope classScope,
            CodegenMethod method,
            CodegenInstanceAux instance)
        {
            var generateGroupKeysView = GenerateGroupKeysViewCodegen(forge, classScope, instance);

            method.Block
                .DeclareVar<object[][]>(
                    "newDataMultiKey",
                    LocalMethod(
                        generateGroupKeysView,
                        REF_NEWDATA,
                        ExprDotName(Ref(NAME_UNBOUNDHELPER), "Buffer"),
                        ConstantTrue()))
                .DeclareVar<object[][]>(
                    "oldDataMultiKey",
                    LocalMethod(
                        generateGroupKeysView,
                        REF_OLDDATA,
                        ExprDotName(Ref(NAME_UNBOUNDHELPER), "Buffer"),
                        ConstantFalse()))
                .DeclareVar<EventBean[]>("eventsPerStream", NewArrayByLength(typeof(EventBean), Constant(1)))
                .StaticMethod(
                    typeof(ResultSetProcessorGroupedUtil),
                    METHOD_APPLYAGGVIEWRESULTKEYEDVIEW,
                    MEMBER_AGGREGATIONSVC,
                    MEMBER_AGENTINSTANCECONTEXT,
                    REF_NEWDATA,
                    Ref("newDataMultiKey"),
                    REF_OLDDATA,
                    Ref("oldDataMultiKey"),
                    Ref("eventsPerStream"));
        }
 public void ContinueOutputLimitedLastAllNonBufferedJoinCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorRowPerGroupImpl.ContinueOutputLimitedLastAllNonBufferedJoinCodegen(this, method);
 }
Exemplo n.º 20
0
 public void ContinueOutputLimitedLastAllNonBufferedJoinCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     method.Block.MethodReturn(ConstantNull());
 }
Exemplo n.º 21
0
 public void ProcessOutputLimitedJoinCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorSimpleImpl.ProcessOutputLimitedJoinCodegen(this, method);
 }
Exemplo n.º 22
0
 public void InstanceCodegen(
     CodegenInstanceAux instance,
     CodegenClassScope classScope,
     CodegenCtor factoryCtor,
     IList<CodegenTypedParam> factoryMembers)
 {
 }
Exemplo n.º 23
0
 public void AcceptHelperVisitorCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorSimpleImpl.AcceptHelperVisitorCodegen(method, instance);
 }
Exemplo n.º 24
0
 public void ProcessJoinResultCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorHandThrough.ProcessJoinResultCodegen(this, method);
 }
Exemplo n.º 25
0
 public void ProcessViewResultCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorSimpleImpl.ProcessViewResultCodegen(this, classScope, method, instance);
 }
Exemplo n.º 26
0
 public void GetEnumeratorJoinCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorHandThrough.GetEnumeratorJoinCodegen(method);
 }
Exemplo n.º 27
0
 public static CodegenMethod GenerateGroupKeyArrayJoinCodegen(
     CodegenMethod generateGroupKeySingle,
     CodegenClassScope classScope,
     CodegenInstanceAux instance)
 {
     Consumer<CodegenMethod> code = method => {
         method.Block.IfCondition(ExprDotMethod(Ref("resultSet"), "IsEmpty"))
             .BlockReturn(ConstantNull())
             .DeclareVar<object[]>(
                 "keys",
                 NewArrayByLength(typeof(object), ExprDotName(Ref("resultSet"), "Count")))
             .DeclareVar<int>("count", Constant(0))
             .ForEach(typeof(MultiKeyArrayOfKeys<EventBean>), "eventsPerStream", Ref("resultSet"))
             .AssignArrayElement(
                 "keys",
                 Ref("count"),
                 LocalMethod(
                     generateGroupKeySingle,
                     ExprDotName(Ref("eventsPerStream"), "Array"),
                     ExprForgeCodegenNames.REF_ISNEWDATA))
             .IncrementRef("count")
             .BlockEnd()
             .MethodReturn(Ref("keys"));
     };
     return instance.Methods.AddMethod(
         typeof(object[]),
         "GenerateGroupKeyArrayJoin",
         CodegenNamedParam.From(typeof(ISet<MultiKeyArrayOfKeys<EventBean>>), "resultSet", typeof(bool), "isNewData"),
         typeof(ResultSetProcessorRowPerEventImpl),
         classScope,
         code);
 }
Exemplo n.º 28
0
 public void ProcessOutputLimitedJoinCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     method.Block.MethodReturn(ConstantNull());
 }
        public static void ProcessViewResultCodegen(
            ResultSetProcessorRowForAllForge forge,
            CodegenClassScope classScope,
            CodegenMethod method,
            CodegenInstanceAux instance)
        {
            var selectList = GetSelectListEventsAsArrayCodegen(forge, classScope, instance);

            CodegenExpression selectOld;
            if (forge.IsSelectRStream) {
                selectOld = LocalMethod(selectList, ConstantFalse(), REF_ISSYNTHESIZE, ConstantFalse());
            }
            else {
                selectOld = ConstantNull();
            }

            method.Block
                .DeclareVar<EventBean[]>("selectOldEvents", selectOld)
                .DeclareVar<EventBean[]>("eventsPerStream", NewArrayByLength(typeof(EventBean), Constant(1)))
                .StaticMethod(
                    typeof(ResultSetProcessorUtil),
                    METHOD_APPLYAGGVIEWRESULT,
                    MEMBER_AGGREGATIONSVC,
                    MEMBER_AGENTINSTANCECONTEXT,
                    REF_NEWDATA,
                    REF_OLDDATA,
                    Ref("eventsPerStream"))
                .DeclareVar<EventBean[]>(
                    "selectNewEvents",
                    LocalMethod(selectList, ConstantTrue(), REF_ISSYNTHESIZE, ConstantFalse()))
                .IfCondition(And(EqualsNull(Ref("selectNewEvents")), EqualsNull(Ref("selectOldEvents"))))
                .BlockReturn(ConstantNull())
                .MethodReturn(
                    NewInstance<UniformPair<EventBean[]>>(Ref("selectNewEvents"), Ref("selectOldEvents")));
        }
 public void StopMethodCodegen(
     CodegenClassScope classScope,
     CodegenMethod method,
     CodegenInstanceAux instance)
 {
     ResultSetProcessorAggregateGroupedImpl.StopMethodCodegen(method, instance);
 }