Changeset 737 for trunk/sources/HeuristicLab.Data/DoubleMatrixData.cs
- Timestamp:
- 11/12/08 13:10:09 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Data/DoubleMatrixData.cs
r344 r737 28 28 29 29 namespace HeuristicLab.Data { 30 /// <summary> 31 /// A two-dimensional matrix consisting of double values. 32 /// </summary> 30 33 public class DoubleMatrixData : ArrayDataBase { 34 /// <summary> 35 /// Gets or sets the double elements of the matrix. 36 /// </summary> 37 /// <remarks>Uses property <see cref="ArrayDataBase.Data"/> of base 38 /// class <see cref="ArrayDataBase"/>. No own data storage present.</remarks> 31 39 public new double[,] Data { 32 40 get { return (double[,])base.Data; } … … 34 42 } 35 43 44 /// <summary> 45 /// Initializes a new instance of the <see cref="DoubleMatrixData"/> class. 46 /// </summary> 36 47 public DoubleMatrixData() { 37 48 Data = new double[1, 1]; 38 49 } 50 /// <summary> 51 /// Initializes a new instance of the <see cref="DoubleMatrixData"/> class. 52 /// <note type="caution"> No CopyConstructor! <paramref name="data"/> is not copied!</note> 53 /// </summary> 54 /// <param name="data">The two-dimensional double matrix the instance should represent.</param> 39 55 public DoubleMatrixData(double[,] data) { 40 56 Data = data; 41 57 } 42 58 59 /// <summary> 60 /// Creates a new instance of the <see cref="DoubleMatrixDataView"/> class. 61 /// </summary> 62 /// <returns>The created instance as <see cref="DoubleMatrixDataView"/>.</returns> 43 63 public override IView CreateView() { 44 64 return new DoubleMatrixDataView(this); 45 65 } 46 66 67 /// <summary> 68 /// Saves the current instance as <see cref="XmlNode"/> in the specified <paramref name="document"/>. 69 /// </summary> 70 /// <remarks>The dimensions of the matrix are saved as attributes (<c>Dimension1</c>,<c>Dimension2</c>), 71 /// formatted according to the local culture info and its number format.<br/> 72 /// The elements of the matrix are saved as string in the node's inner text, 73 /// each element separated by a semicolon, all line by line, formatted according to the 74 /// local number format.</remarks> 75 /// <param name="name">The (tag)name of the <see cref="XmlNode"/>.</param> 76 /// <param name="document">The <see cref="XmlDocument"/> where the data is saved.</param> 77 /// <param name="persistedObjects">A dictionary of all already persisted objects. (Needed to avoid cycles.)</param> 78 /// <returns>The saved <see cref="XmlNode"/>.</returns> 47 79 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) { 48 80 XmlNode node = base.GetXmlNode(name, document, persistedObjects); … … 56 88 return node; 57 89 } 90 /// <summary> 91 /// Loads the persisted matrix from the specified <paramref name="node"/>. 92 /// </summary> 93 /// <remarks>The dimensions of the matrix must be saved as Attributes (<c>Dimension1</c>, <c>Dimension2</c>), 94 /// formatted in the local number format. <br/> 95 /// The elements of the matrix must be saved in the node's inner text as string, 96 /// each element separated by a semicolon, line by line, formatted according to the local 97 /// culture info and its number format (see <see cref="GetXmlNode"/>).</remarks> 98 /// <exception cref="System.FormatException">Thrown when a saved element cannot be parsed as a double value.</exception> 99 /// <param name="node">The <see cref="XmlNode"/> where the instance is saved.</param> 100 /// <param name="restoredObjects">The dictionary of all already restored objects. (Needed to avoid cycles.)</param> 58 101 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 59 102 base.Populate(node, restoredObjects); … … 72 115 } 73 116 117 /// <summary> 118 /// The string representation of the matrix. 119 /// </summary> 120 /// <returns>The elements of the matrix as a string, line by line, each element separated by a 121 /// semicolon and formatted according to local number format.</returns> 74 122 public override string ToString() { 75 123 return ToString(CultureInfo.CurrentCulture.NumberFormat); 76 124 } 77 125 126 /// <summary> 127 /// The string representation of the matrix, considering a specified <paramref name="format"/>. 128 /// </summary> 129 /// <param name="format">The <see cref="NumberFormatInfo"/> the double values are formatted accordingly.</param> 130 /// <returns>The elements of the matrix as a string, line by line, each element separated by a 131 /// semicolon and formatted according to the specified <paramref name="format"/>.</returns> 78 132 private string ToString(NumberFormatInfo format) { 79 133 StringBuilder builder = new StringBuilder();
Note: See TracChangeset
for help on using the changeset viewer.