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(); }
public override bool OnData(object data) { var op = (CollectionOp <T>)data; switch (op.OpType) { case CollectionOpTypes.Add: if (EqualityComparer <T> .Default.Equals(value, default(T))) { value = op.Value; SendToOutput(op); } else { if (Children.Count == 0) { AddChild(Factory.CreateCollectionBlock <T>(outputConnection.Destination), new Filter <CollectionOp <T> >(null)); } return(true); } break; case CollectionOpTypes.Find: if (op.FindFunction(value)) { op.Value = value; SendToOutput(op); } else { return(true); } break; case CollectionOpTypes.Remove: if (op.FindFunction == null) { if (op.Value.Equals(value)) { op.Value = value; value = default(T); SendToOutput(op); } } else if (op.FindFunction(value)) { op.Value = value; value = default(T); SendToOutput(op); } else { return(true); } break; case CollectionOpTypes.Update: throw new NotImplementedException(); break; case CollectionOpTypes.Enumerate: if (value != null) { op.EnumCollection.Add(value); } if (Children.Count == 0) { SendToOutput(op); } else { return(true); } break; } return(false); }