コード例 #1
0
        public void Ready(
            StatementContext statementContext,
            ModuleIncidentals moduleIncidentals,
            bool recovery)
        {
            FilterSpecActivatables = new List<FilterSpecActivatable>();
            foreach (var item in Items) {
                FilterSpecActivatables.Add(item.FilterSpecActivatable);
            }

            OptionalTermination?.AddFilterSpecActivatable(FilterSpecActivatables);

            // determine whether we have named-partitioning-events
            foreach (var item in Items) {
                if (item.AliasName != null) {
                    HasAsName = true;
                }
            }

            if (!HasAsName && OptionalInit != null) {
                foreach (var filter in OptionalInit) {
                    if (filter.OptionalFilterAsName != null) {
                        HasAsName = true;
                    }
                }
            }
        }
コード例 #2
0
        public CodegenExpression MakeCodegen(
            CodegenMethodScope parent,
            SAIFFInitializeSymbol symbols,
            CodegenClassScope classScope)
        {
            var method = parent.MakeChild(typeof(ContextControllerDetailKeyed), GetType(), classScope);

            method.Block.DeclareVar<ContextControllerDetailKeyedItem[]>(
                "items",
                NewArrayByLength(typeof(ContextControllerDetailKeyedItem), Constant(Items.Count)));
            for (var i = 0; i < Items.Count; i++) {
                method.Block.AssignArrayElement(
                    "items",
                    Constant(i),
                    Items[i].MakeCodegen(method, symbols, classScope));
            }

            method.Block
                .DeclareVar<ContextControllerDetailKeyed>(
                    "detail",
                    NewInstance(typeof(ContextControllerDetailKeyed)))
                .SetProperty(Ref("detail"), "Items", Ref("items"));

            if (OptionalInit != null && !OptionalInit.IsEmpty()) {
                method.Block.DeclareVar<ContextConditionDescriptorFilter[]>(
                    "init",
                    NewArrayByLength(typeof(ContextConditionDescriptorFilter), Constant(OptionalInit.Count)));
                for (var i = 0; i < OptionalInit.Count; i++) {
                    method.Block.AssignArrayElement(
                        "init",
                        Constant(i),
                        Cast(
                            typeof(ContextConditionDescriptorFilter),
                            OptionalInit[i].Make(method, symbols, classScope)));
                }

                method.Block.SetProperty(Ref("detail"), "OptionalInit", Ref("init"));
            }

            if (OptionalTermination != null) {
                method.Block.SetProperty(
                    Ref("detail"),
                    "OptionalTermination",
                    OptionalTermination.Make(method, symbols, classScope));
            }

            method.Block.Expression(
                    ExprDotMethodChain(symbols.GetAddInitSvc(method)).Add("AddReadyCallback", Ref("detail")))
                .MethodReturn(Ref("detail"));
            return LocalMethod(method);
        }