Changeset 1699 for trunk/sources/HeuristicLab.Routing.TSP/3.3/TSPTour.cs
- Timestamp:
- 04/28/09 16:05:09 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Routing.TSP/3.3/TSPTour.cs
r1530 r1699 27 27 using HeuristicLab.Data; 28 28 using HeuristicLab.Permutation; 29 using HeuristicLab.Persistence.Default.Decomposers.Storable; 29 30 30 31 namespace HeuristicLab.Routing.TSP { … … 33 34 /// </summary> 34 35 public class TSPTour : ItemBase, IVisualizationItem { 36 37 [Storable] 35 38 private DoubleMatrixData myCoordinates; 36 39 /// <summary> … … 41 44 set { myCoordinates = value; } 42 45 } 46 47 [Storable] 43 48 private Permutation.Permutation myTour; 44 49 /// <summary> … … 109 114 if (TourChanged != null) 110 115 TourChanged(this, new EventArgs()); 111 } 112 113 #region Persistence Methods 114 /// <summary> 115 /// Saves the current instance as <see cref="XmlNode"/> in the specified <paramref name="document"/>. 116 /// </summary> 117 /// <remarks>Calls <see cref="StorableBase.GetXmlNode"/> of base class <see cref="ItemBase"/>. <br/> 118 /// The coordinates and the tour are saved as a child node with the tag names <c>Coordinates</c> and 119 /// <c>Tour</c>.</remarks> 120 /// <param name="name">The (tag)name of the <see cref="XmlNode"/>.</param> 121 /// <param name="document">The <see cref="XmlDocument"/> where to save the data.</param> 122 /// <param name="persistedObjects">The dictionary of all already persisted objects. 123 /// (Needed to avoid cycles.)</param> 124 /// <returns>The saved <see cref="XmlNode"/>.</returns> 125 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 126 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 127 node.AppendChild(PersistenceManager.Persist("Coordinates", Coordinates, document, persistedObjects)); 128 node.AppendChild(PersistenceManager.Persist("Tour", Tour, document, persistedObjects)); 129 return node; 130 } 131 /// <summary> 132 /// Loads the persisted TSP tour from the specified <paramref name="node"/>. 133 /// </summary> 134 /// <remarks>Calls <see cref="StorableBase.Populate"/> of base class 135 /// <see cref="ItemBase"/>.<br/> 136 /// The coordinates and the tour must be saved as child nodes with the tag names <c>Coordinates</c> 137 /// and <c>Tour</c> (see <see cref="GetXmlNode"/>).</remarks> 138 /// <param name="node">The <see cref="XmlNode"/> where the TSP tour is saved.</param> 139 /// <param name="restoredObjects">A dictionary of all already restored objects. (Needed to avoid cycles.)</param> 140 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 141 base.Populate(node, restoredObjects); 142 myCoordinates = (DoubleMatrixData)PersistenceManager.Restore(node.SelectSingleNode("Coordinates"), restoredObjects); 143 myTour = (Permutation.Permutation)PersistenceManager.Restore(node.SelectSingleNode("Tour"), restoredObjects); 144 } 145 #endregion 116 } 146 117 } 147 118 }
Note: See TracChangeset
for help on using the changeset viewer.