Exemple #1
0
        private T WaitForOp(CollectionOp <T> op)
        {
            bool doneWaiting = false;
            T    val         = default(T);

            var tempoutputBlock = BlockFactory.CreateLambdaBlock <CollectionOp <T> >(x =>
            {
                if (x.OpID == op.OpID)
                {
                    op          = x;
                    val         = x.Value;
                    doneWaiting = true;
                }

                return(true);
            }, "YoloEnumerableOutput");

            outputBlock.AddChild(tempoutputBlock, new Filter <CollectionOp <T> >(null));
            input.Send(op);
            while (!doneWaiting)
            {
            }
            outputBlock.RemoveChild(tempoutputBlock);
            return(val);
        }
Exemple #2
0
        public YoloEnumerable()
        {
            outputBlock = BlockFactory.CreateLambdaBlock <CollectionOp <T> >(x => true, "YoloEnumerableOutput");
            firstBlock  = BlockFactory.CreateCollectionBlock <T>(outputBlock);

            ExprTree.CreateComponent(this, firstBlock);

            ExprTree.CreateIndependentBlock(outputBlock);
            input.Attach(this);
            Yolo.DumpGraph();
        }
Exemple #3
0
        public AbstractBlock Compile()
        {
            var blocks = new Queue <AbstractBlock>();

            ICEPExpression currentExpr = ChildExpression;

            while (currentExpr != null)
            {
                blocks.Enqueue(currentExpr.ThisBlock);
                if (currentExpr.ChildExpression != null)
                {
                    currentExpr = currentExpr.ChildExpression;
                }
                else
                {
                    break;
                }
            }

            AbstractBlock topBlock     = blocks.Dequeue();
            AbstractBlock currentBlock = topBlock;

            foreach (AbstractBlock b in blocks)
            {
                currentBlock.AddChild(b, new Filter <object>(null));
                currentBlock = b;
            }
            _tail = blockFactory.CreateLambdaBlock <object>(o =>
            {
                if (CEPOutputEvent != null)
                {
                    CEPOutputEvent(o);
                }
                return(true);
            }, "tail");

            currentBlock.AddChild <object>(_tail, null);
            return(topBlock);
        }
Exemple #4
0
        public YoloEnumerator(AbstractBlock output, BaseInputAdapter inputer)
        {
            CollectionOp <T> enumOp = new CollectionOp <T>();

            enumOp.OpType = CollectionOpTypes.Enumerate;
            parentOutput  = output;
            outputBlock   = BlockFactory.CreateLambdaBlock <CollectionOp <T> >(x =>
            {
                if (x.OpID == enumOp.OpID)
                {
                    EnumOp = x;
                    output.RemoveChild(outputBlock);
                }

                return(true);
            }, "YoloEnumerableOutput");
            output.AddChild(outputBlock, new Filter <CollectionOp <T> >(null));
            inputer.Send(enumOp);
        }