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"))); }
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())); }
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")); }
public static void GetEnumerableEventCodegen( AggregationAccessorFirstWEvalForge forge, AggregationStateLinearForge stateForge, AggregationAccessorForgeGetCodegenContext context) { context.Method.Block.MethodReturn( stateForge.AggregatorLinear.GetFirstValueCodegen(context.ClassScope, context.Method)); }
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 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)); }
public AggregatorAccessLinearNonJoin( AggregationStateLinearForge forge, int col, CodegenCtor rowCtor, CodegenMemberCol membersColumnized, CodegenClassScope classScope, ExprNode optionalFilter) : base(optionalFilter) { this.forge = forge; events = membersColumnized.AddMember(col, typeof(IList<EventBean>), "events"); rowCtor.Block.AssignRef(events, NewInstance(typeof(List<EventBean>))); }
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)); }
public AggregatorAccessLinearJoin( AggregationStateLinearForge forge, int col, CodegenCtor rowCtor, CodegenMemberCol membersColumnized, CodegenClassScope classScope, ExprNode optionalFilter) : base(optionalFilter) { this.forge = forge; refSet = membersColumnized.AddMember(col, typeof(LinkedHashMap<EventBean, object>), "refSet"); array = membersColumnized.AddMember(col, typeof(EventBean[]), "array"); rowCtor.Block.AssignRef(refSet, NewInstance(typeof(LinkedHashMap<EventBean, object>))); }
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"))); }
private static CodegenMethod GetBeanFirstLastIndexCodegen( AggregationAccessorFirstLastIndexWEvalForge forge, int column, CodegenClassScope classScope, AggregationStateLinearForge stateForge, CodegenMethod parent, CodegenNamedMethods namedMethods) { CodegenMethod method = parent.MakeChild( typeof(EventBean), typeof(AggregationAccessorFirstLastIndexWEval), classScope); if (forge.Constant == -1) { Type evalType = forge.IndexNode.EvaluationType; method.Block.DeclareVar( evalType, "indexResult", LocalMethod( CodegenLegoMethodExpression.CodegenExpression( forge.IndexNode, method, classScope, true), ConstantNull(), ConstantTrue(), ConstantNull())); if (evalType.CanBeNull()) { method.Block.IfRefNullReturnNull("indexResult"); } method.Block.DeclareVar<int>( "index", SimpleNumberCoercerFactory.CoercerInt.CodegenInt(Ref("indexResult"), evalType)); } else { method.Block.DeclareVar<int>("index", Constant(forge.Constant)); } CodegenExpression value = forge.IsFirst ? stateForge.AggregatorLinear.GetFirstNthValueCodegen(Ref("index"), method, classScope, namedMethods) : stateForge.AggregatorLinear.GetLastNthValueCodegen(Ref("index"), method, classScope, namedMethods); method.Block.MethodReturn(value); return method; }
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( 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 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")); }
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")); }