Beispiel #1
0
 public TopProcessor(PipelineContext ctx, TopProcessor other, IDataEndpoint epOrnextProcessor)
     : base(other, epOrnextProcessor)
 {
     sorter   = other.sorter;
     reverse  = other.reverse;
     topCount = other.topCount;
     prique   = new FixedPriorityQueue <JObject>(topCount, ComparisonWrappers.Create(sorter, reverse));
 }
Beispiel #2
0
        public override int CallNextPostProcessor(PipelineContext ctx)
        {
            ctx.PostProcessor = this;
            ReportStart(ctx);
            int N = prique.Count;

            switch (sortAfter)
            {
            case _SortAfter.True:
                prique.SortDestructive(sorter);
                break;

            case _SortAfter.Reverse:
                prique.SortDestructive(ComparisonWrappers.Create(sorter, true));
                break;
            }

            for (int i = 0; i < N; i++)
            {
                PassThrough(ctx, prique[i]);
            }
            ReportEnd(ctx);
            return(base.CallNextPostProcessor(ctx));
        }