Esempio n. 1
0
        public override unsafe void OnNext(StreamMessage <TKey, TPayload> batch)
        {
            var count = batch.Count;

            batch.bitvector = batch.bitvector.MakeWritable(this.pool.bitvectorPool);

            fixed(long *bv = batch.bitvector.col)
            {
                var pay = batch.payload.col;

                for (int i = 0; i < count; i++)
                {
                    if ((bv[i >> 6] & (1L << (i & 0x3f))) == 0)
                    {
                        if (!this.predicateFunc(pay[i]))
                        {
                            bv[i >> 6] |= (1L << (i & 0x3f));
                        }
                    }
                }
            }

            if (!this.isPartitioned && batch.RefreshCount() && (batch.Count == 0))
            {
                batch.Free();
            }
            else
            {
                this.Observer.OnNext(batch);
            }
        }
Esempio n. 2
0
        private void OnRight(StreamMessage <TKey, TRight> batch)
        {
            batch.iter = 0;
            batch.RefreshCount();
            if (batch.Count == 0)
            {
                batch.Free();
                return;
            }

            this.rightQueue.Enqueue(batch);
            ProcessPendingBatches();
        }
Esempio n. 3
0
        public override unsafe void OnNext(StreamMessage <TKey, TPayload> batch)
        {
            if (this.constantDuration == StreamEvent.InfinitySyncTime)
            {
                batch.Free();
                return;
            }

            var count = batch.Count;

            batch.vsync     = batch.vsync.MakeWritable(this.pool.longPool);
            batch.vother    = batch.vother.MakeWritable(this.pool.longPool);
            batch.bitvector = batch.bitvector.MakeWritable(this.pool.bitvectorPool);

            fixed(long *vsync = batch.vsync.col)
            fixed(long *vother = batch.vother.col)
            fixed(long *bv     = batch.bitvector.col)
            {
                for (int i = 0; i < count; i++)
                {
                    if ((bv[i >> 6] & (1L << (i & 0x3f))) == 0)
                    {
                        if (vother[i] == StreamEvent.InfinitySyncTime) // start edge
                        {
                            bv[i >> 6] |= (1L << (i & 0x3f));
                        }
                        else if (vother[i] < vsync[i]) // end edge (converts to interval of length 1)
                        {
                            vother[i] = vsync[i] + 1;
                        }
                        else // interval
                        {
                            vsync[i] = vother[i];
                            vother[i]++;
                        }
                    }
                }
            }
            if (batch.RefreshCount() && !this.isPartitioned && (batch.Count == 0))
            {
                batch.Free();
            }
            else
            {
                this.Observer.OnNext(batch);
            }
        }