示例#1
0
        private TrackCollection CreateChildrenFromParents(TrackCollection parent1, TrackCollection parent2)
        {
            var children = new TrackCollection();

            for (var k = 0; k < (parent1.Count) / 2; k++)
            {
                children.Add(parent1[k]);
            }

            for (var i = (parent1.Count) / 2; i < parent1.Count; i++)
            {
                if (children.Contains(parent2[i]))
                {
                    foreach (var t in parent1)
                    {
                        if ((!children.Contains(t)) && (!parent2.GetRange((parent1.Count) / 2, (parent1.Count) / 2).Contains(t)))
                        {
                            children.Add(t);
                        }
                    }
                }
                else
                {
                    children.Add(parent2[i]);
                }
            }
            return(children);
        }