public AggregatorAccessSortedImpl(
            bool join,
            AggregationStateSortedForge forge,
            int col,
            CodegenCtor ctor,
            CodegenMemberCol membersColumnized,
            CodegenClassScope classScope,
            ExprNode optionalFilter)
            : base(optionalFilter)
        {
            this.forge = forge;
            sorted     = membersColumnized.AddMember(col, typeof(IOrderedDictionary <object, object>), "sorted");
            size       = membersColumnized.AddMember(col, typeof(int), "size");
            var types = ExprNodeUtilityQuery.GetExprResultTypes(forge.Spec.Criteria);

            comparator = classScope.AddOrGetDefaultFieldSharable(
                new CodegenFieldSharableComparator(
                    COMPARATORHASHABLEMULTIKEYS,
                    types,
                    forge.Spec.IsSortUsingCollator,
                    forge.Spec.SortDescending));
            ctor.Block.AssignRef(sorted, NewInstance <OrderedListDictionary <object, object> >(comparator));

            sortedSerde = classScope.AddOrGetDefaultFieldSharable(
                new ProxyCodegenFieldSharable()
            {
                ProcType = () => { return(typeof(DIOSerdeTreeMapEventsMayDeque)); },

                ProcInitCtorScoped = () => {
                    var type = EventTypeUtility
                               .ResolveTypeCodegen(forge.Spec.StreamEventType, EPStatementInitServicesConstants.REF);
                    var criteriaSerdes = DataInputOutputSerdeForgeExtensions
                                         .CodegenArray(forge.Spec.CriteriaSerdes, classScope.NamespaceScope.InitMethod, classScope, null);
                    return(ExprDotMethodChain(EPStatementInitServicesConstants.REF)
                           .Get(EPStatementInitServicesConstants.EVENTTYPERESOLVER)
                           .Add(EventTypeResolverConstants.GETEVENTSERDEFACTORY)
                           .Add("TreeMapEventsMayDeque", criteriaSerdes, type));
                },
            });

            if (join)
            {
                joinRefs = membersColumnized.AddMember(col, typeof(RefCountedSetAtomicInteger <object>), "refs");
                ctor.Block.AssignRef(joinRefs, NewInstance(typeof(RefCountedSetAtomicInteger <object>)));
                joinRefsSerde = classScope.AddOrGetDefaultFieldSharable(
                    new CodegenSharableSerdeEventTyped(
                        REFCOUNTEDSETATOMICINTEGER, forge.Spec.StreamEventType));
            }
            else
            {
                joinRefs      = null;
                joinRefsSerde = null;
            }
        }
Esempio n. 2
0
        public AggregatorAccessSortedImpl(
            bool join,
            AggregationStateSortedForge forge,
            int col,
            CodegenCtor ctor,
            CodegenMemberCol membersColumnized,
            CodegenClassScope classScope,
            ExprNode optionalFilter)
            : base(optionalFilter)

        {
            this.forge = forge;
            sorted = membersColumnized.AddMember(col, typeof(OrderedDictionary<object,object>), "sorted");
            size = membersColumnized.AddMember(col, typeof(int), "size");
            var types = ExprNodeUtilityQuery.GetExprResultTypes(forge.Spec.Criteria);
            comparator = classScope.AddOrGetDefaultFieldSharable(
                new CodegenFieldSharableComparator(
                    COMPARATORHASHABLEMULTIKEYS,
                    types,
                    forge.Spec.IsSortUsingCollator,
                    forge.Spec.SortDescending));
            ctor.Block.AssignRef(sorted, NewInstance(typeof(OrderedDictionary<object, object>), comparator));

            sortedSerde = classScope.AddOrGetDefaultFieldSharable(
                new ProxyCodegenFieldSharable {
                    ProcType = () => { return typeof(DIOSerdeTreeMapEventsMayDeque); },
                    ProcInitCtorScoped = () => {
                        var type = EventTypeUtility.ResolveTypeCodegen(
                            forge.Spec.StreamEventType,
                            EPStatementInitServicesConstants.REF);
                        return ExprDotMethodChain(EPStatementInitServicesConstants.REF)
                            .Get(EPStatementInitServicesConstants.DATAINPUTOUTPUTSERDEPROVIDER)
                            .Add(
                                "TreeMapEventsMayDeque",
                                Constant(forge.Spec.CriteriaTypes),
                                type);
                    }
                });

            if (join) {
                joinRefs = membersColumnized.AddMember(col, typeof(RefCountedSetAtomicInteger<object>), "refs");
                ctor.Block.AssignRef(joinRefs, NewInstance(typeof(RefCountedSetAtomicInteger<object>)));
                joinRefsSerde = classScope.AddOrGetDefaultFieldSharable(
                    new CodegenSharableSerdeEventTyped(REFCOUNTEDSETATOMICINTEGER, forge.Spec.StreamEventType));
            }
            else {
                joinRefs = null;
                joinRefsSerde = null;
            }
        }