Ejemplo n.º 1
0
        public static void GetValueCodegen(
            AggregationAccessorWindowNoEvalForge forge,
            AggregationStateLinearForge accessStateFactory,
            AggregationAccessorForgeGetCodegenContext context)
        {
            var size = accessStateFactory.AggregatorLinear.SizeCodegen();
            var iterator = accessStateFactory.AggregatorLinear.EnumeratorCodegen(
                context.ClassScope,
                context.Method,
                context.NamedMethods);

            context.Method.Block.IfCondition(EqualsIdentity(size, Constant(0)))
                .BlockReturn(ConstantNull())
                .DeclareVar(
                    TypeHelper.GetArrayType(forge.ComponentType),
                    "array",
                    NewArrayByLength(forge.ComponentType, size))
                .DeclareVar<int>("count", Constant(0))
                .DeclareVar<IEnumerator<EventBean>>("it", iterator)
                .WhileLoop(ExprDotMethod(Ref("it"), "MoveNext"))
                .DeclareVar<EventBean>("bean", Cast(typeof(EventBean), ExprDotName(Ref("it"), "Current")))
                .AssignArrayElement(
                    Ref("array"),
                    Ref("count"),
                    Cast(forge.ComponentType, ExprDotUnderlying(Ref("bean"))))
                .Increment("count")
                .BlockEnd()
                .MethodReturn(Ref("array"));
        }
Ejemplo n.º 2
0
 public static void GetValueCodegen(
     AggregationAccessorFirstLastIndexWEvalForge forge,
     AggregationAccessorForgeGetCodegenContext context)
 {
     AggregationStateLinearForge stateForge = (AggregationStateLinearForge) context.AccessStateForge;
     CodegenMethod getBeanFirstLastIndex = GetBeanFirstLastIndexCodegen(
         forge,
         context.Column,
         context.ClassScope,
         stateForge,
         context.Method,
         context.NamedMethods);
     context.Method.Block.DeclareVar<EventBean>("bean", LocalMethod(getBeanFirstLastIndex))
         .DebugStack()
         .IfRefNullReturnNull("bean")
         .DeclareVar<EventBean[]>(
             "eventsPerStreamBuf",
             NewArrayByLength(typeof(EventBean), Constant(forge.StreamNum + 1)))
         .AssignArrayElement("eventsPerStreamBuf", Constant(forge.StreamNum), Ref("bean"))
         .MethodReturn(
             LocalMethod(
                 CodegenLegoMethodExpression.CodegenExpression(
                     forge.ChildNode,
                     context.Method,
                     context.ClassScope,
                     true),
                 Ref("eventsPerStreamBuf"),
                 ConstantTrue(),
                 ConstantNull()));
 }
Ejemplo n.º 3
0
 public void GetValueCodegen(AggregationAccessorForgeGetCodegenContext context)
 {
     AggregationAccessorLastWEval.GetValueCodegen(
         this,
         (AggregationStateLinearForge) context.AccessStateForge,
         context);
 }
Ejemplo n.º 4
0
 public void GetEnumerableScalarCodegen(AggregationAccessorForgeGetCodegenContext context)
 {
     AggregationAccessorWindowNoEval.GetEnumerableScalarCodegen(
         this,
         (AggregationStateLinearForge) context.AccessStateForge,
         context);
 }
        public void GetValueCodegen(AggregationAccessorForgeGetCodegenContext context)
        {
            var eventToPublic =
                TableDeployTimeResolver.MakeTableEventToPublicField(table, context.ClassScope, GetType());
            var sorted = (AggregatorAccessSorted) context.AccessStateForge.Aggregator;
            var size = sorted.SizeCodegen();
            var enumerator = max ? sorted.ReverseEnumeratorCodegen() : sorted.EnumeratorCodegen();

            context.Method.Block.IfCondition(EqualsIdentity(size, Constant(0)))
                .BlockReturn(ConstantNull())
                .DeclareVar(TypeHelper.GetArrayType(componentType), "array", NewArrayByLength(componentType, size))
                .DeclareVar<int>("count", Constant(0))
                .DeclareVar<IEnumerator<EventBean>>("enumerator", enumerator)
                .WhileLoop(ExprDotMethod(Ref("enumerator"), "MoveNext"))
                .DeclareVar<EventBean>("bean", Cast(typeof(EventBean), ExprDotName(Ref("enumerator"), "Current")))
                .AssignArrayElement(
                    Ref("array"),
                    Ref("count"),
                    ExprDotMethod(
                        eventToPublic,
                        "ConvertToUnd",
                        Ref("bean"),
                        REF_EPS,
                        REF_ISNEWDATA,
                        REF_EXPREVALCONTEXT))
                .IncrementRef("count")
                .BlockEnd()
                .MethodReturn(Ref("array"));
        }
Ejemplo n.º 6
0
 public void GetEnumerableEventCodegen(AggregationAccessorForgeGetCodegenContext context)
 {
     AggregationAccessorFirstWEval.GetEnumerableEventCodegen(
         this,
         (AggregationStateLinearForge) context.AccessStateForge,
         context);
 }
Ejemplo n.º 7
0
 public static void GetEnumerableScalarCodegen(
     AggregationAccessorLastWEvalForge forge,
     AggregationStateLinearForge stateForge,
     AggregationAccessorForgeGetCodegenContext context)
 {
     CodegenMethod childExpr = CodegenLegoMethodExpression.CodegenExpression(
         forge.ChildNode,
         context.Method,
         context.ClassScope,
         true);
     context.Method.Block.DeclareVar<EventBean>(
             "bean",
             stateForge.AggregatorLinear.GetLastValueCodegen(
                 context.ClassScope,
                 context.Method,
                 context.NamedMethods))
         .DebugStack()
         .IfRefNullReturnNull("bean")
         .DeclareVar<EventBean[]>(
             "eventsPerStreamBuf",
             NewArrayByLength(typeof(EventBean), Constant(forge.StreamNum + 1)))
         .AssignArrayElement("eventsPerStreamBuf", Constant(forge.StreamNum), Ref("bean"))
         .DeclareVar<object>(
             "value",
             LocalMethod(childExpr, Ref("eventsPerStreamBuf"), Constant(true), ConstantNull()))
         .IfRefNullReturnNull("value")
         .MethodReturn(StaticMethod(typeof(Collections), "SingletonList", Ref("value")));
 }
Ejemplo n.º 8
0
 public static void GetEnumerableEventCodegen(
     AggregationAccessorFirstWEvalForge forge,
     AggregationStateLinearForge stateForge,
     AggregationAccessorForgeGetCodegenContext context)
 {
     context.Method.Block.MethodReturn(
         stateForge.AggregatorLinear.GetFirstValueCodegen(context.ClassScope, context.Method));
 }
Ejemplo n.º 9
0
 public void GetEnumerableEventCodegen(AggregationAccessorForgeGetCodegenContext context)
 {
     var sorted = (AggregatorAccessSorted) context.AccessStateForge.Aggregator;
     if (max) {
         context.Method.Block.MethodReturn(sorted.GetLastValueCodegen(context.ClassScope, context.Method));
     }
     else {
         context.Method.Block.MethodReturn(sorted.GetFirstValueCodegen(context.ClassScope, context.Method));
     }
 }
Ejemplo n.º 10
0
 public static void GetEnumerableEventsCodegen(
     AggregationAccessorFirstWEvalForge forge,
     AggregationStateLinearForge stateForge,
     AggregationAccessorForgeGetCodegenContext context)
 {
     context.Method.Block.DeclareVar<EventBean>(
             "bean",
             stateForge.AggregatorLinear.GetFirstValueCodegen(context.ClassScope, context.Method))
         .IfRefNullReturnNull("bean")
         .MethodReturn(StaticMethod(typeof(Collections), "SingletonList", Ref("bean")));
 }
 public override void GetValueCodegen(AggregationAccessorForgeGetCodegenContext context)
 {
     var forge = (AggregatorAccessSorted) context.AccessStateForge.Aggregator;
     context.Method.Block.DeclareVar<EventBean>(
             "@event",
             max
                 ? forge.GetLastValueCodegen(context.ClassScope, context.Method)
                 : forge.GetFirstValueCodegen(context.ClassScope, context.Method))
         .IfRefNullReturnNull("@event")
         .MethodReturn(ExprDotUnderlying(Ref("@event")));
 }
Ejemplo n.º 12
0
 public void GetEnumerableEventsCodegen(AggregationAccessorForgeGetCodegenContext context)
 {
     var forge = (AggregatorAccessSorted) context.AccessStateForge.Aggregator;
     context.Method.Block
         .DeclareVar<EventBean>(
             "bean",
             max
                 ? forge.GetLastValueCodegen(context.ClassScope, context.Method)
                 : forge.GetFirstValueCodegen(context.ClassScope, context.Method))
         .IfRefNullReturnNull("bean")
         .MethodReturn(StaticMethod(typeof(Collections), "SingletonList", Ref("bean")));
 }
Ejemplo n.º 13
0
 public static void GetEnumerableEventsCodegen(
     AggregationAccessorWindowNoEvalForge forge,
     AggregationStateLinearForge stateForge,
     AggregationAccessorForgeGetCodegenContext context)
 {
     context.Method.Block.IfCondition(EqualsIdentity(stateForge.AggregatorLinear.SizeCodegen(), Constant(0)))
         .BlockReturn(ConstantNull())
         .MethodReturn(
             stateForge.AggregatorLinear.CollectionReadOnlyCodegen(
                 context.Method,
                 context.ClassScope,
                 context.NamedMethods));
 }
Ejemplo n.º 14
0
 public static void GetEnumerableEventCodegen(
     AggregationAccessorFirstLastIndexWEvalForge forge,
     AggregationAccessorForgeGetCodegenContext context)
 {
     AggregationStateLinearForge stateForge = (AggregationStateLinearForge) context.AccessStateForge;
     CodegenMethod getBeanFirstLastIndex = GetBeanFirstLastIndexCodegen(
         forge,
         context.Column,
         context.ClassScope,
         stateForge,
         context.Method,
         context.NamedMethods);
     context.Method.Block.MethodReturn(LocalMethod(getBeanFirstLastIndex));
 }
Ejemplo n.º 15
0
 public static void GetEnumerableEventsCodegen(
     AggregationAccessorFirstLastIndexWEvalForge forge,
     AggregationAccessorForgeGetCodegenContext context)
 {
     AggregationStateLinearForge stateForge = (AggregationStateLinearForge) context.AccessStateForge;
     CodegenMethod getBeanFirstLastIndex = GetBeanFirstLastIndexCodegen(
         forge,
         context.Column,
         context.ClassScope,
         stateForge,
         context.Method,
         context.NamedMethods);
     context.Method.Block.DeclareVar<EventBean>("bean", LocalMethod(getBeanFirstLastIndex))
         .IfRefNullReturnNull("bean")
         .MethodReturn(StaticMethod(typeof(Collections), "SingletonList", Ref("bean")));
 }
Ejemplo n.º 16
0
        public void GetValueCodegen(AggregationAccessorForgeGetCodegenContext context)
        {
            var sorted = (AggregatorAccessSorted) context.AccessStateForge.Aggregator;
            var size = sorted.SizeCodegen();
            var iterator = max ? sorted.ReverseEnumeratorCodegen : sorted.EnumeratorCodegen();

            context.Method.Block.IfCondition(EqualsIdentity(size, Constant(0)))
                .BlockReturn(ConstantNull())
                .DeclareVar(TypeHelper.GetArrayType(componentType), "array", NewArrayByLength(componentType, size))
                .DeclareVar<int>("count", Constant(0))
                .DeclareVar<IEnumerator<EventBean>>("it", iterator)
                .WhileLoop(ExprDotMethod(Ref("it"), "MoveNext"))
                .DeclareVar<EventBean>("bean", Cast(typeof(EventBean), ExprDotName(Ref("it"), "Current")))
                .AssignArrayElement(Ref("array"), Ref("count"), Cast(componentType, ExprDotUnderlying(Ref("bean"))))
                .Increment("count")
                .BlockEnd()
                .MethodReturn(Ref("array"));
        }
Ejemplo n.º 17
0
 public override void GetValueCodegen(AggregationAccessorForgeGetCodegenContext context)
 {
     var eventToPublic =
         TableDeployTimeResolver.MakeTableEventToPublicField(table, context.ClassScope, GetType());
     var forge = (AggregatorAccessSorted) context.AccessStateForge.Aggregator;
     context.Method.Block.DeclareVar<EventBean>(
             "@event",
             max
                 ? forge.GetLastValueCodegen(context.ClassScope, context.Method)
                 : forge.GetFirstValueCodegen(context.ClassScope, context.Method))
         .IfRefNullReturnNull("@event")
         .MethodReturn(
             ExprDotMethod(
                 eventToPublic,
                 "ConvertToUnd",
                 Ref("@event"),
                 REF_EPS,
                 REF_ISNEWDATA,
                 REF_EXPREVALCONTEXT));
 }
Ejemplo n.º 18
0
 public static void GetValueCodegen(
     AggregationAccessorFirstWEvalForge forge,
     AggregationStateLinearForge accessStateFactory,
     AggregationAccessorForgeGetCodegenContext context)
 {
     CodegenMethod childExpr = CodegenLegoMethodExpression.CodegenExpression(
         forge.ChildNode,
         context.Method,
         context.ClassScope,
         true);
     context.Method.Block.DeclareVar<EventBean>(
             "bean",
             accessStateFactory.AggregatorLinear.GetFirstValueCodegen(context.ClassScope, context.Method))
         .DebugStack()
         .IfRefNullReturnNull("bean")
         .DeclareVar<EventBean[]>(
             "eventsPerStreamBuf",
             NewArrayByLength(typeof(EventBean), Constant(forge.StreamNum + 1)))
         .AssignArrayElement("eventsPerStreamBuf", Constant(forge.StreamNum), Ref("bean"))
         .MethodReturn(LocalMethod(childExpr, Ref("eventsPerStreamBuf"), Constant(true), ConstantNull()));
 }
 public static void GetEnumerableScalarCodegen(
     AggregationAccessorWindowWEvalForge forge,
     AggregationStateLinearForge stateForge,
     AggregationAccessorForgeGetCodegenContext context)
 {
     context.Method.Block
         .DeclareVar<int>("size", stateForge.AggregatorLinear.SizeCodegen())
         .IfCondition(EqualsIdentity(Ref("size"), Constant(0)))
         .BlockReturn(ConstantNull())
         .DeclareVar<IList<object>>("values", NewInstance<List<object>>(Ref("size")))
         .DeclareVar<IEnumerator<EventBean>>(
             "enumerator",
             stateForge.AggregatorLinear.EnumeratorCodegen(
                 context.ClassScope,
                 context.Method,
                 context.NamedMethods))
         .DebugStack()
         .DeclareVar<EventBean[]>(
             "eventsPerStreamBuf",
             NewArrayByLength(typeof(EventBean), Constant(forge.StreamNum + 1)))
         .WhileLoop(ExprDotMethod(Ref("enumerator"), "MoveNext"))
         .DeclareVar<EventBean>("bean", Cast(typeof(EventBean), ExprDotName(Ref("enumerator"), "Current")))
         .AssignArrayElement("eventsPerStreamBuf", Constant(forge.StreamNum), Ref("bean"))
         .DeclareVar(
             forge.ChildNode.EvaluationType.GetBoxedType(),
             "value",
             LocalMethod(
                 CodegenLegoMethodExpression.CodegenExpression(
                     forge.ChildNode,
                     context.Method,
                     context.ClassScope,
                     true),
                 Ref("eventsPerStreamBuf"),
                 ConstantTrue(),
                 ConstantNull()))
         .ExprDotMethod(Ref("values"), "Add", Ref("value"))
         .BlockEnd()
         .MethodReturn(Ref("values"));
 }
Ejemplo n.º 20
0
 public static void GetEnumerableScalarCodegen(
     AggregationAccessorWindowNoEvalForge forge,
     AggregationStateLinearForge stateForge,
     AggregationAccessorForgeGetCodegenContext context)
 {
     context.Method.Block.DeclareVar<int>("size", stateForge.AggregatorLinear.SizeCodegen())
         .IfCondition(EqualsIdentity(Ref("size"), Constant(0)))
         .BlockReturn(ConstantNull())
         .DeclareVar<IList<object>>("values", NewInstance<List<object>>(Ref("size")))
         .DeclareVar<IEnumerator<EventBean>>(
             "it",
             stateForge.AggregatorLinear.EnumeratorCodegen(
                 context.ClassScope,
                 context.Method,
                 context.NamedMethods))
         .WhileLoop(ExprDotMethod(Ref("it"), "MoveNext"))
         .DeclareVar<EventBean>("bean", Cast(typeof(EventBean), ExprDotName(Ref("it"), "Current")))
         .DeclareVar(forge.ComponentType, "value", Cast(forge.ComponentType, ExprDotUnderlying(Ref("bean"))))
         .ExprDotMethod(Ref("values"), "Add", Ref("value"))
         .BlockEnd()
         .MethodReturn(Ref("values"));
 }
        public static void GetValueCodegen(
            AggregationAccessorWindowWEvalForge forge,
            AggregationStateLinearForge accessStateFactory,
            AggregationAccessorForgeGetCodegenContext context)
        {
            var size = accessStateFactory.AggregatorLinear.SizeCodegen();
            var enumerator = accessStateFactory.AggregatorLinear.EnumeratorCodegen(
                context.ClassScope,
                context.Method,
                context.NamedMethods);
            var childExpr = CodegenLegoMethodExpression.CodegenExpression(
                forge.ChildNode,
                context.Method,
                context.ClassScope,
                false);
            var childExprType = forge.ChildNode.EvaluationType;

            CodegenExpression invokeChild = LocalMethod(childExpr, Ref("eventsPerStreamBuf"), Constant(true), ConstantNull());
            if (forge.ComponentType != childExprType) {
                invokeChild = Unbox(invokeChild);
            }

            context.Method.Block
                .IfCondition(EqualsIdentity(size, Constant(0)))
                .BlockReturn(ConstantNull())
                .DeclareVar(TypeHelper.GetArrayType(forge.ComponentType), "array", NewArrayByLength(forge.ComponentType, size))
                .DeclareVar<int>("count", Constant(0))
                .DeclareVar<IEnumerator<EventBean>>("enumerator", enumerator)
                .DebugStack()
                .DeclareVar<EventBean[]>("eventsPerStreamBuf", NewArrayByLength(typeof(EventBean), Constant(forge.StreamNum + 1)))
                .WhileLoop(ExprDotMethod(Ref("enumerator"), "MoveNext"))
                .DeclareVar<EventBean>("bean", Cast(typeof(EventBean), ExprDotName(Ref("enumerator"), "Current")))
                .AssignArrayElement("eventsPerStreamBuf", Constant(forge.StreamNum), Ref("bean"))
                .AssignArrayElement(Ref("array"), Ref("count"), invokeChild)
                .IncrementRef("count")
                .BlockEnd()
                .MethodReturn(Ref("array"));
        }
Ejemplo n.º 22
0
 public void GetValueCodegen(AggregationAccessorForgeGetCodegenContext context)
 {
     AggregationAccessorFirstLastIndexWEval.GetValueCodegen(this, context);
 }
Ejemplo n.º 23
0
 public void GetEnumerableScalarCodegen(AggregationAccessorForgeGetCodegenContext context)
 {
     MakeBlock("GetEnumerableScalar", context.Column, context.Method, context.ClassScope);
 }
Ejemplo n.º 24
0
 public void GetEnumerableScalarCodegen(AggregationAccessorForgeGetCodegenContext context)
 {
     AggregationAccessorFirstLastIndexWEval.GetEnumerableScalarCodegen(this, context);
 }
Ejemplo n.º 25
0
 public abstract void GetValueCodegen(AggregationAccessorForgeGetCodegenContext context);
Ejemplo n.º 26
0
 public void GetValueCodegen(AggregationAccessorForgeGetCodegenContext context)
 {
     MakeBlock("GetValue", context.Column, context.Method, context.ClassScope);
 }
Ejemplo n.º 27
0
 public void GetEnumerableEventsCodegen(AggregationAccessorForgeGetCodegenContext context)
 {
     var sorted = (AggregatorAccessSorted) context.AccessStateForge.Aggregator;
     context.Method.Block.MethodReturn(sorted.CollectionReadOnlyCodegen());
 }
Ejemplo n.º 28
0
 public void GetEnumerableEventCodegen(AggregationAccessorForgeGetCodegenContext context)
 {
     context.Method.Block.MethodReturn(ConstantNull());
 }