Changeset 4683 for branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/PathTSPTour.cs
- Timestamp:
- 10/29/10 19:53:44 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/PathTSPTour.cs
r4477 r4683 79 79 } 80 80 81 [StorableConstructor] 82 private PathTSPTour(bool deserializing) : base(deserializing) { } 83 private PathTSPTour(PathTSPTour original, Cloner cloner) 84 : base(original, cloner) { 85 this.coordinates = cloner.Clone(original.coordinates); 86 this.permutation = cloner.Clone(original.permutation); 87 this.quality = cloner.Clone(original.quality); 88 Initialize(); 89 } 81 90 public PathTSPTour() : base() { } 82 91 public PathTSPTour(DoubleMatrix coordinates) … … 98 107 Initialize(); 99 108 } 100 [StorableConstructor] 101 private PathTSPTour(bool deserializing) : base(deserializing) { } 109 110 public override IDeepCloneable Clone(Cloner cloner) { 111 return new PathTSPTour(this, cloner); 112 } 102 113 103 114 [StorableHook(HookType.AfterDeserialization)] 115 private void AfterDeserialization() { 116 Initialize(); 117 } 118 104 119 private void Initialize() { 105 120 if (coordinates != null) RegisterCoordinatesEvents(); 106 121 if (permutation != null) RegisterPermutationEvents(); 107 122 if (quality != null) RegisterQualityEvents(); 108 }109 110 public override IDeepCloneable Clone(Cloner cloner) {111 PathTSPTour clone = new PathTSPTour();112 cloner.RegisterClonedObject(this, clone);113 clone.coordinates = (DoubleMatrix)cloner.Clone(coordinates);114 clone.permutation = (Permutation)cloner.Clone(permutation);115 clone.quality = (DoubleValue)cloner.Clone(quality);116 clone.Initialize();117 return clone;118 123 } 119 124
Note: See TracChangeset
for help on using the changeset viewer.