예제 #1
0
        public ConservativeUnaryStatefulOperator(int index, Stage <T> collection, bool immutableInput, Expression <Func <S, K> > k, Expression <Func <S, V> > v, bool ignored = true)
            : base(index, collection, null)
        {
            key   = k.Compile();
            value = v.Compile();

            keyExpression   = k;
            valueExpression = v;

            this.inputImmutable = immutableInput;

            internTable = new LatticeInternTable <T>();
            keyIndices  = new Dictionary <K, UnaryKeyIndices>();
            inputTrace  = createInputTrace();
            outputTrace = createOutputTrace();
        }
예제 #2
0
        public UnaryStatefulIntKeyedOperator(int index, Stage <T> collection, bool immutableInput, Expression <Func <S, int> > k, Expression <Func <S, V> > v, bool maintainOutputTrace = true)
            : base(index, collection, null)
        {
            key   = k.Compile();
            value = v.Compile();

            keyExpression   = k;
            valueExpression = v;

            MaintainOutputTrace = maintainOutputTrace;

            if (immutableInput)
            {
                this.inputImmutable = true;
            }

            internTable = new LatticeInternTable <T>();
            keyIndices  = new UnaryKeyIndices[65536][];
            inputTrace  = createInputTrace();
            outputTrace = createOutputTrace();

            //this.Input = new Naiad.Frameworks.RecvFiberBank<Weighted<S>, T>(this, collection.Input);

            //if (inputImmutable)
            //    collection.Input.Register(new ActionReceiver<Weighted<S>, T>(this, x => { this.OnInput(x.s, x.t); this.ScheduleAt(x.t); }));

#if false
            if (this.inputImmutable)
            {
                this.input = new ActionReceiver <Weighted <S>, T>(this, x => { this.OnInput(x.s, x.t); this.ScheduleAt(x.t); });
            }
            else
            {
                this.RecvInput = new Naiad.Frameworks.RecvFiberBank <Weighted <S>, T>(this);
                this.input     = this.RecvInput;
            }
#endif
        }