- Timestamp:
- 12/02/08 21:30:34 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactorBranch/HeuristicLab.Scheduling.JSSP/Schedule.cs
r2 r888 41 41 public Schedule() : this(0, 100) { } 42 42 43 public Schedule(Schedule original) : this(original, new Dictionary<Guid, object>()) { } 44 protected Schedule(Schedule original, IDictionary<Guid, object> clonedObjects) 45 : base(original, clonedObjects) { 46 this.schedule = new ScheduleTree[original.Machines]; 47 for (int i = 0; i < original.Machines; i++) { 48 this.schedule[i] = (ScheduleTree)Auxiliary.Clone(original.schedule[i], clonedObjects); 49 } 50 } 51 43 52 public int Machines { 44 53 get { return schedule.Length; } … … 64 73 } 65 74 66 75 #region IStorable Members 67 76 68 77 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) { … … 87 96 88 97 public override object Clone(IDictionary<Guid, object> clonedObjects) { 89 int timespan = 0; 90 if ((schedule != null) && (schedule.Length > 0)) { 91 timespan = schedule[0].Timespan; 92 } 93 Schedule clone = new Schedule(this.Machines, timespan); 94 clonedObjects.Add(Guid, clone); 95 clone.schedule = new ScheduleTree[this.Machines]; 96 for(int i = 0; i < this.Machines; i++) { 97 clone.schedule[i] = (ScheduleTree)Auxiliary.Clone(schedule[i], clonedObjects); 98 } 99 return clone; 98 return new Schedule(this, clonedObjects); 100 99 } 101 100
Note: See TracChangeset
for help on using the changeset viewer.