Пример #1
0
        // 复制
        public object Clone()
        {
            ProblemRecord record = new ProblemRecord();

            record.CreateTime   = CreateTime;
            record.Name         = (string)Name.Clone();
            record.CarSpeed     = CarSpeed;
            record.NodeStayTime = NodeStayTime;
            record.Cars         = (CarCollection)Cars.Clone();
            record.Nodes        = (NodeCollection)Nodes.Clone();

            // 复制路径
            for (int i = 0; i < Paths.Count; ++i)
            {
                record.Paths.Add(new ObservableCollection <int>());
                for (int j = 0; j < Paths[i].Count; ++j)
                {
                    record.Paths[i].Add(Paths[i][j]);
                }
            }

            // 复制线条
            for (int i = 0; i < Segments.Count; ++i)
            {
                record.Segments.Add((Segment)Segments[i].Clone());
            }

            return(record);
        }