Changeset 1669 for trunk/sources/HeuristicLab.Data/3.3/BoolArrayData.cs
- Timestamp:
- 04/27/09 14:45:44 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Data/3.3/BoolArrayData.cs
r1529 r1669 63 63 return new BoolArrayDataView(this); 64 64 } 65 66 /// <summary>67 /// Saves the current instance as <see cref="XmlNode"/> in the specified <paramref name="document"/>.68 /// </summary>69 /// <remarks>The boolean elements of the array are saved as string in the node's inner text, each element separated by a semicolon.</remarks>70 /// <param name="name">The (tag)name of the <see cref="XmlNode"/>.</param>71 /// <param name="document">The <see cref="XmlDocument"/> where to save the data.</param>72 /// <param name="persistedObjects">A dictionary of all already persisted objects.73 /// (Needed to avoid cycles.)</param>74 /// <returns>The saved <see cref="XmlNode"/>.</returns>75 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {76 XmlNode node = base.GetXmlNode(name, document, persistedObjects);77 node.InnerText = ToString();78 return node;79 }80 /// <summary>81 /// Loads the persisted boolean array from the specified <paramref name="node"/>.82 /// </summary>83 /// <remarks> The elements of the boolean array must be saved in the node's inner84 /// text as a string, each element separated by a semicolon85 /// (see <see cref="GetXmlNode"/>).</remarks>86 /// <param name="node">The <see cref="XmlNode"/> where the instance is saved.</param>87 /// <param name="restoredObjects">A Dictionary of all already restored objects.88 /// (Needed to avoid cycles.)</param>89 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {90 base.Populate(node, restoredObjects);91 string[] tokens = node.InnerText.Split(';');92 bool[] data = new bool[tokens.Length];93 for (int i = 0; i < data.Length; i++)94 data[i] = bool.Parse(tokens[i]);95 Data = data;96 }97 65 } 98 66 }
Note: See TracChangeset
for help on using the changeset viewer.