Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/27/09 14:45:44 (15 years ago)
Author:
epitzer
Message:

Migrate HL.Data-3.3 to new persistence library. (#603)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data/3.3/BoolArrayData.cs

    r1529 r1669  
    6363      return new BoolArrayDataView(this);
    6464    }
    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 inner
    84     /// text as a string, each element separated by a semicolon
    85     /// (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     }
    9765  }
    9866}
Note: See TracChangeset for help on using the changeset viewer.