private CodegenMethod IsExistsPropertyCodegen( CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { var block = codegenMethodScope.MakeChild(typeof(bool), GetType(), codegenClassScope) .AddParam(typeof(IDictionary<string, object>), "map") .Block .DeclareVar<object>("value", ExprDotMethod(Ref("map"), "Get", Constant(propertyMap))) .IfRefNullReturnFalse("value") .IfRefNotTypeReturnConst("value", typeof(IDictionary<string, object>), false); if (_nestedGetter is MapEventPropertyGetter eventPropertyGetter) { return block.MethodReturn( eventPropertyGetter.UnderlyingExistsCodegen( Cast(typeof(IDictionary<string, object>), Ref("value")), codegenMethodScope, codegenClassScope)); } return block.MethodReturn(ConstantFalse()); }
public CodegenExpression EvaluateCodegenUninstrumented( Type requiredType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenExpressionRef refEps = exprSymbol.GetAddEPS(codegenMethodScope); CodegenExpression refIsNewData = exprSymbol.GetAddIsNewData(codegenMethodScope); CodegenExpressionRef refExprEvalCtx = exprSymbol.GetAddExprEvalCtx(codegenMethodScope); CodegenExpressionInstanceField eventToPublic = TableDeployTimeResolver.MakeTableEventToPublicField(_tableMetadata, codegenClassScope, this.GetType()); return StaticMethod( typeof(ExprEvalStreamInsertTable), "ConvertToTableEvent", Constant(_streamNum), eventToPublic, refEps, refIsNewData, refExprEvalCtx); }
public CodegenExpression EvaluateCodegenUninstrumented( Type requiredType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { var methodNode = codegenMethodScope.MakeChild( EvaluationType, typeof(ExprContextPropertyNodeImpl), codegenClassScope); var refExprEvalCtx = exprSymbol.GetAddExprEvalCtx(methodNode); var block = methodNode.Block .DeclareVar<EventBean>("props", ExprDotName(refExprEvalCtx, "ContextProperties")) .IfRefNullReturnNull("props"); block.MethodReturn( CodegenLegoCast.CastSafeFromObjectType( Type, getter.EventBeanGetCodegen(Ref("props"), methodNode, codegenClassScope))); return LocalMethod(methodNode); }
public static CodegenExpression Codegen( DTLocalDateTimeIntervalForge forge, CodegenExpression inner, Type innerType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { var methodNode = codegenMethodScope .MakeChild(typeof(bool?), typeof(DTLocalDateTimeIntervalEval), codegenClassScope) .AddParam(typeof(DateTime), "target"); methodNode.Block .DeclareVar<long>( "time", StaticMethod(typeof(DatetimeLongCoercerDateTime), "CoerceToMillis", Ref("target"))) .MethodReturn( forge.intervalForge.Codegen(Ref("time"), Ref("time"), methodNode, exprSymbol, codegenClassScope)); return LocalMethod(methodNode, inner); }
public CodegenExpression EvaluateEventGetEventBeanCodegen( CodegenMethodScope parent, ExprEnumerationGivenEventSymbol symbols, CodegenClassScope codegenClassScope) { var methodNode = parent.MakeChild( typeof(EventBean), typeof(PropertyDotEventSingleForge), codegenClassScope); methodNode.Block .IfNullReturnNull(symbols.GetAddEvent(methodNode)) .MethodReturn( Cast( typeof(EventBean), getter.EventBeanFragmentCodegen( symbols.GetAddEvent(methodNode), methodNode, codegenClassScope))); return LocalMethod(methodNode); }
internal static CodegenMethod GetBeanPropInternalExistsCode( CodegenMethodScope codegenMethodScope, PropertyInfo property, CodegenClassScope codegenClassScope) { return codegenMethodScope .MakeChild(typeof(bool), typeof(ArrayMethodPropertyGetter), codegenClassScope) .AddParam(property.DeclaringType, "obj") .AddParam(typeof(int), "index") .Block .DeclareVar(property.PropertyType, "array", ExprDotName(Ref("obj"), property.Name)) .IfRefNullReturnFalse("array") .IfConditionReturnConst( Relational( ArrayLength(Ref("array")), LE, Ref("index")), false) .MethodReturn(ConstantTrue()); }
public CodegenExpression Make( CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { var method = parent.MakeChild(typeof(InfraOnMergeHelper), GetType(), classScope); method.Block .DeclareVar<InfraOnMergeActionIns>( "insertUnmatched", insertUnmatched == null ? ConstantNull() : insertUnmatched.Make(method, symbols, classScope)) .DeclareVar<IList<InfraOnMergeMatch>>("matched", MakeList(matched, method, symbols, classScope)) .DeclareVar<IList<InfraOnMergeMatch>>("unmatched", MakeList(unmatched, method, symbols, classScope)) .MethodReturn( NewInstance<InfraOnMergeHelper>( Ref("insertUnmatched"), Ref("matched"), Ref("unmatched"), Constant(requiresTableWriteLock))); return LocalMethod(method); }
public override CodegenExpression EvaluateCodegenUninstrumented( Type requiredType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { if (IndexedGetter != null) { return ExprDotNodeForgePropertyExprEvalIndexed.Codegen( this, codegenMethodScope, exprSymbol, codegenClassScope); } return ExprDotNodeForgePropertyExprEvalMapped.Codegen( this, codegenMethodScope, exprSymbol, codegenClassScope); }
public CodegenExpression CodegenDateTime( CodegenExpression inner, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenExpression timeZoneField = codegenClassScope.AddOrGetDefaultFieldSharable(RuntimeSettingsTimeZoneField.INSTANCE); var method = codegenMethodScope .MakeChild(typeof(DateTimeOffset), typeof(ReformatToDateTimeOffsetForge), codegenClassScope) .AddParam(typeof(DateTime), "input") .Block .DeclareVar <DateTimeEx>( "dateTimeEx", StaticMethod(typeof(DateTimeEx), "GetInstance", timeZoneField)) .ExprDotMethod(Ref("dateTimeEx"), "Set", Ref("input")) .MethodReturn(GetProperty(Ref("dateTimeEx"), "DateTime")); return(LocalMethodBuild(method).Pass(inner).Call()); }
public static CodegenExpression MakeActions( IList<InfraOnMergeActionForge> actions, CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { var method = parent.MakeChild( typeof(IList<InfraOnMergeAction>), typeof(InfraOnMergeActionForge), classScope); method.Block.DeclareVar<IList<InfraOnMergeAction>>( "list", NewInstance<List<InfraOnMergeAction>>(Constant(actions.Count))); foreach (var item in actions) { method.Block.ExprDotMethod(Ref("list"), "Add", item.Make(method, symbols, classScope)); } method.Block.MethodReturn(Ref("list")); return LocalMethod(method); }
public CodegenExpression CodegenLong( CodegenExpression inner, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope classScope) { var formatField = CodegenFormatFieldInit(classScope); var blockMethod = codegenMethodScope.MakeChild(typeof(string), typeof(ReformatFormatForge), classScope) .AddParam(typeof(long), "ts") .Block; var syncBlock = blockMethod.LockOn(formatField); if (_timeAbacus.OneSecond == 1000L) { syncBlock.BlockReturn(ExprDotMethod(formatField, "Format", Ref("ts"))); } else { syncBlock.BlockReturn(ExprDotMethod(formatField, "Format", _timeAbacus.ToDateCodegen(Ref("ts")))); } return LocalMethodBuild(blockMethod.MethodEnd()).Pass(inner).Call(); }
private CodegenMethod GetBeanPropInternalCodegen( CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { return codegenMethodScope .MakeChild(BeanPropType, GetType(), codegenClassScope) .AddParam(TargetType, "@object") .AddParam(typeof(int), "index") .Block //.DeclareVar(_field.FieldType, "value", ExprDotName(Ref("@object"), _field.Name)) .DeclareVar<Array>("value", ExprDotName(Ref("@object"), _field.Name)) .MethodReturn( Cast( BeanPropType, StaticMethod( typeof(CollectionUtil), "ArrayValueAtIndex", Cast<Array>(Ref("value")), Ref("index")))); }
private static CodegenExpression MakeOpBuildOrder( ISet<int> operatorBuildOrder, CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { var method = parent.MakeChild( typeof(LinkedHashSet<int>), typeof(DataflowDescForge), classScope); method.Block.DeclareVar<LinkedHashSet<int>>( "order", NewInstance<LinkedHashSet<int>>()); foreach (var entry in operatorBuildOrder) { method.Block.ExprDotMethod(Ref("order"), "Add", Constant(entry)); } method.Block.MethodReturn(Ref("order")); return LocalMethod(method); }
private CodegenMethod HandleNestedValueExistsCodegen( CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { CodegenBlock block = codegenMethodScope .MakeChild(typeof(bool), GetType(), codegenClassScope) .AddParam(typeof(object), "value") .Block .IfRefNotTypeReturnConst("value", typeof(IDictionary<string, object>), false); if (_nestedGetter is MapEventPropertyGetter eventPropertyGetter) { return block .MethodReturn( eventPropertyGetter.UnderlyingExistsCodegen( Cast<IDictionary<string, object>>(Ref("value")), codegenMethodScope, codegenClassScope)); } return block.MethodReturn(ConstantFalse()); }
public CodegenExpression Make( CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { var method = parent.MakeChild(typeof(ContainedEventEvalExprNode), GetType(), classScope); method.Block .DeclareVar<ExprEvaluator>( "eval", ExprNodeUtilityCodegen.CodegenEvaluator(evaluator, method, GetType(), classScope)) .DeclareVar<EventType>( "type", EventTypeUtility.ResolveTypeCodegen(eventType, symbols.GetAddInitSvc(method))) .MethodReturn( NewInstance<ContainedEventEvalExprNode>( Ref("eval"), Ref("type"), symbols.GetAddInitSvc(method))); return LocalMethod(method); }
public CodegenExpression EventBeanGetCodegen( CodegenExpression beanExpression, CodegenMethodScope parent, CodegenClassScope classScope) { CodegenMethod method = parent.MakeChild(typeof(object), this.GetType(), classScope) .AddParam(typeof(EventBean), "eventBean"); CodegenMethod methodExpr = CodegenLegoMethodExpression.CodegenExpression(eval.Forge, method, classScope, true); method.Block .DeclareVar<EventBean[]>("events", NewArrayWithInit(typeof(EventBean), Ref("eventBean"))) .DeclareVar<object>("code", LocalMethod(methodExpr, Ref("events"), ConstantTrue(), ConstantNull())) .MethodReturn( StaticMethod( typeof(ContextControllerHashedGetterHashSingleForge), "ObjectToNativeHash", Ref("code"), Constant(granularity))); return LocalMethod(method, beanExpression); }
internal static CodegenMethod GetBeanPropInternalCode( CodegenMethodScope codegenMethodScope, PropertyInfo property, CodegenClassScope codegenClassScope) { return codegenMethodScope .MakeChild(property.PropertyType.GetElementType().GetBoxedType(), typeof(ArrayMethodPropertyGetter), codegenClassScope) .AddParam(property.DeclaringType, "obj") .AddParam(typeof(int), "index") .Block .DeclareVar(property.PropertyType, "array", ExprDotName(Ref("obj"), property.Name)) .IfRefNullReturnNull("array") .IfConditionReturnConst( Relational( ArrayLength(Ref("array")), LE, Ref("index")), null) .MethodReturn(ArrayAtIndex(Ref("array"), Ref("index"))); }
public CodegenExpression Make( CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { return(new SAIFFInitializeBuilder(typeof(FileSourceFactory), GetType(), "factory", parent, symbols, classScope) .Exprnode("file", file) .Exprnode("hasHeaderLine", hasHeaderLine) .Exprnode("hasTitleLine", hasTitleLine) .Exprnode("numLoops", numLoops) .Constant("propertyNames", propertyNames) .Exprnode("format", format) .Exprnode("propertyNameLine", propertyNameLine) .Exprnode("propertyNameFile", propertyNameFile) .Exprnode("dateFormat", dateFormat) .Map("adapterInputSource", adapterInputSource) .Eventtype("outputEventType", _outputEventType) .Eventtypes("outputPortTypes", _outputPortTypes) .Build()); }
public CodegenExpression EvaluateCodegenUninstrumented( Type requiredType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { if (ConstantValue == null) { return ConstantNull(); } if (ConstantValue.GetType().IsEnum) { return EnumValue(ConstantValue.GetType(), ConstantValue.ToString()); } if (enumValue != null) { return PublicConstValue(enumValue.EnumClass, enumValue.EnumField.Name); } return Constant(ConstantValue); }
public CodegenExpression EvaluateCodegenUninstrumented( Type requiredType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { if (ForgeRenderable.IsAll) { return ExprEqualsAllAnyNodeForgeEvalAllWColl.Codegen( this, codegenMethodScope, exprSymbol, codegenClassScope); } return ExprEqualsAllAnyNodeForgeEvalAnyWColl.Codegen( this, codegenMethodScope, exprSymbol, codegenClassScope); }
public CodegenMethod InitializeCodegen( CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.MakeChild( typeof(StatementAgentInstanceFactoryCreateSchema), this.GetType(), classScope); method.Block .DeclareVar<StatementAgentInstanceFactoryCreateSchema>( "saiff", NewInstance(typeof(StatementAgentInstanceFactoryCreateSchema))) .SetProperty( Ref("saiff"), "EventType", EventTypeUtility.ResolveTypeCodegen(eventType, symbols.GetAddInitSvc(method))) .MethodReturn(Ref("saiff")); return method; }
public CodegenExpression Make( CodegenMethodScope parent, CodegenClassScope classScope) { var method = parent.MakeChild(typeof(ModuleDependenciesRuntime), GetType(), classScope); method.Block .DeclareVar<ModuleDependenciesRuntime>("md", NewInstance(typeof(ModuleDependenciesRuntime))) .SetProperty(Ref("md"), "PathEventTypes", NameAndModule.MakeArray(pathEventTypes)) .SetProperty(Ref("md"), "PathNamedWindows", NameAndModule.MakeArray(pathNamedWindows)) .SetProperty(Ref("md"), "PathTables", NameAndModule.MakeArray(pathTables)) .SetProperty(Ref("md"), "PathVariables", NameAndModule.MakeArray(pathVariables)) .SetProperty(Ref("md"), "PathContexts", NameAndModule.MakeArray(pathContexts)) .SetProperty(Ref("md"), "PathExpressions", NameAndModule.MakeArray(pathExpressions)) .SetProperty(Ref("md"), "PathIndexes", ModuleIndexMeta.MakeArray(pathIndexes)) .SetProperty(Ref("md"), "PathScripts", NameParamNumAndModule.MakeArray(pathScripts)) .SetProperty(Ref("md"), "PublicEventTypes", Constant(publicEventTypes.ToArray())) .SetProperty(Ref("md"), "PublicVariables", Constant(publicVariables.ToArray())) .MethodReturn(Ref("md")); return LocalMethod(method); }
public CodegenExpression Make( CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { return new SAIFFInitializeBuilder( OP_PACKAGE_NAME + ".logsink.LogSinkFactory", this.GetType(), "log", parent, symbols, classScope) .Exprnode("title", title) .Exprnode("layout", layout) .Exprnode("format", format) .Exprnode("log", log) .Exprnode("linefeed", linefeed) .EventtypesMayNull("eventTypes", eventTypes) .Build(); }
private CodegenMethod GetFragmentCodegen( CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { return codegenMethodScope.MakeChild(typeof(object), GetType(), codegenClassScope) .AddParam(typeof(GenericRecord), "record") .Block .DeclareVar<GenericRecord>( "value", CodegenExpressionBuilder.LocalMethod( NavigateMethodCodegen(codegenMethodScope, codegenClassScope), CodegenExpressionBuilder.Ref("record"))) .IfRefNullReturnNull("value") .MethodReturn( _nested[_nested.Length - 1] .UnderlyingFragmentCodegen( CodegenExpressionBuilder.Ref("value"), codegenMethodScope, codegenClassScope)); }
public CodegenExpression EvaluateGetEventBeanCodegen( CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { var methodNode = codegenMethodScope.MakeChild( typeof(EventBean), typeof(PropertyDotEventSingleForge), codegenClassScope); var refEPS = exprSymbol.GetAddEPS(methodNode); methodNode.Block .DeclareVar<EventBean>("@event", ArrayAtIndex(refEPS, Constant(streamId))) .IfRefNullReturnNull("@event") .MethodReturn( Cast( typeof(EventBean), getter.EventBeanFragmentCodegen(Ref("@event"), methodNode, codegenClassScope))); return LocalMethod(methodNode); }
private CodegenMethod GetFragmentCodegen( CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { var mSvc = codegenClassScope.AddOrGetDefaultFieldSharable(EventBeanTypedEventFactoryCodegenField.INSTANCE); var mType = codegenClassScope.AddDefaultFieldUnshared( true, typeof(EventType), EventTypeUtility.ResolveTypeCodegen(fragmentEventType, EPStatementInitServicesConstants.REF)); return codegenMethodScope.MakeChild(typeof(object), GetType(), codegenClassScope) .AddParam(typeof(object[]), "oa") .Block .DeclareVar<object>( "value", UnderlyingGetCodegen(Ref("oa"), codegenMethodScope, codegenClassScope)) .IfInstanceOf("value", typeof(EventBean[])) .BlockReturn(Ref("value")) .MethodReturn( StaticMethod(typeof(BaseNestableEventUtil), "GetBNFragmentArray", Ref("value"), mType, mSvc)); }
private CodegenMethod GetCodegen( CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { var cache = codegenClassScope.AddOrGetDefaultFieldSharable( new VariantPropertyGetterCacheCodegenField(variantEventType)); var method = codegenMethodScope.MakeChild(typeof(object), GetType(), codegenClassScope) .AddParam(typeof(EventBean), "eventBean"); method.Block .DeclareVar<object>( "value", StaticMethod( typeof(VariantEventPropertyGetterAny), "VariantGet", Ref("eventBean"), cache, Constant(propertyName))) .MethodReturn(caster.Codegen(Ref("value"), typeof(object), method, codegenClassScope)); return method; }
private CodegenExpression MakeNames( CodegenMethodScope parent, CodegenClassScope classScope) { if (SubstitutionParamsNames == null) { return ConstantNull(); } var method = parent.MakeChild(typeof(IDictionary<string, int>), GetType(), classScope); method.Block.DeclareVar<IDictionary<string, int>>( "names", NewInstance( typeof(Dictionary<string, int>))); foreach (var entry in SubstitutionParamsNames) { method.Block.ExprDotMethod(Ref("names"), "Put", Constant(entry.Key), Constant(entry.Value)); } method.Block.MethodReturn(Ref("names")); return LocalMethod(method); }
public CodegenExpression Make( CodegenMethodScope parent, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) { CodegenMethod method = parent.MakeChild( typeof(MethodTargetStrategyStaticMethod), this.GetType(), classScope); method.Block .DeclareVar<MethodTargetStrategyStaticMethod>( "target", NewInstance(typeof(MethodTargetStrategyStaticMethod))) .SetProperty(Ref("target"), "Clazz", Constant(clazz)) .SetProperty(Ref("target"), "MethodName", Constant(reflectionMethod.Name)) .SetProperty(Ref("target"), "MethodParameters", Constant(reflectionMethod.GetParameterTypes())) .Expression(ExprDotMethodChain(symbols.GetAddInitSvc(method)).Add("AddReadyCallback", Ref("target"))) .MethodReturn(Ref("target")); return LocalMethod(method); }
public CodegenExpression MakeEvaluator( CodegenMethodScope parent, CodegenClassScope classScope) { var method = parent.MakeChild(typeof(TimePeriodComputeConstGivenCalAddEval), GetType(), classScope); method.Block .DeclareVar<TimePeriodComputeConstGivenCalAddEval>( "eval", NewInstance(typeof(TimePeriodComputeConstGivenCalAddEval))) .SetProperty(Ref("eval"), "Adders", TimePeriodAdderUtil.MakeArray(adders, parent, classScope)) .SetProperty(Ref("eval"), "Added", Constant(added)) .SetProperty(Ref("eval"), "TimeAbacus", classScope.AddOrGetDefaultFieldSharable(TimeAbacusField.INSTANCE)) .SetProperty(Ref("eval"), "IndexMicroseconds", Constant(indexMicroseconds)) .SetProperty( Ref("eval"), "TimeZone", classScope.AddOrGetDefaultFieldSharable(RuntimeSettingsTimeZoneField.INSTANCE)) .MethodReturn(Ref("eval")); return LocalMethod(method); }