コード例 #1
0
        private static void BuildPipeline(Pipe parent, IList <Pipe> pipes)
        {
            for (int i = 0; i < pipes.Count; i++)
            {
                var p = pipes[i];

                if (parent.InPort == p.InPort && parent.OutPort == p.OutPort ||
                    parent.InPort == p.OutPort && parent.OutPort == p.InPort)
                {
                    return;
                }

                if (p.InPort == parent.OutPort || p.OutPort == parent.OutPort)
                {
                    var nPipes = new List <Pipe>(pipes);
                    nPipes.RemoveAt(i);

                    var np = new Pipe(p);
                    if (p.InPort != parent.OutPort)
                    {
                        np.SwapPorts();
                    }
                    parent.AddChild(np);

                    BuildPipeline(np, nPipes);
                }
            }
        }