Changeset 9433
- Timestamp:
- 05/03/13 11:37:56 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Data/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Data/3.3/StringArray.cs
r7259 r9433 34 34 [StorableClass] 35 35 public class StringArray : Item, IEnumerable<string>, IStringConvertibleArray { 36 private const int maximumToStringLength = 100; 37 36 38 public static new Image StaticItemImage { 37 39 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } … … 106 108 107 109 public override string ToString() { 110 if (array.Length == 0) return "[]"; 111 108 112 StringBuilder sb = new StringBuilder(); 109 113 sb.Append("["); 110 if (array.Length > 0) { 111 sb.Append(array[0]); 112 for (int i = 1; i < array.Length; i++) 113 sb.Append(";").Append(array[i]); 114 sb.Append(array[0]); 115 for (int i = 1; i < array.Length; i++) { 116 sb.Append(";").Append(array[i]); 117 if (sb.Length > maximumToStringLength) { 118 sb.Append("..."); 119 break; 120 } 114 121 } 115 122 sb.Append("]"); … … 150 157 if (ItemChanged != null) 151 158 ItemChanged(this, new EventArgs<int>(index)); 152 OnToStringChanged(); 159 if (index < maximumToStringLength) 160 OnToStringChanged(); 153 161 } 154 162 public event EventHandler Reset; -
trunk/sources/HeuristicLab.Data/3.3/StringMatrix.cs
r7259 r9433 34 34 [StorableClass] 35 35 public class StringMatrix : Item, IEnumerable<string>, IStringConvertibleMatrix { 36 private const int maximumToStringLength = 100; 37 36 38 public static new Image StaticItemImage { 37 39 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } … … 208 210 209 211 public override string ToString() { 212 if (matrix.Length == 0) return "[]"; 213 210 214 StringBuilder sb = new StringBuilder(); 211 215 sb.Append("["); 212 if (matrix.Length > 0) { 213 for (int i = 0; i < Rows; i++) { 214 sb.Append("[").Append(matrix[i, 0]); 215 for (int j = 1; j < Columns; j++) 216 sb.Append(";").Append(matrix[i, j]); 217 sb.Append("]"); 216 for (int i = 0; i < Rows; i++) { 217 sb.Append("[").Append(matrix[i, 0]); 218 for (int j = 1; j < Columns; j++) 219 sb.Append(";").Append(matrix[i, j]); 220 sb.Append("]"); 221 222 if (sb.Length > maximumToStringLength) { 223 sb.Append("[...]"); 224 break; 218 225 } 219 226 } 220 227 sb.Append("]"); 228 221 229 return sb.ToString(); 222 230 } … … 286 294 if (ItemChanged != null) 287 295 ItemChanged(this, new EventArgs<int, int>(rowIndex, columnIndex)); 288 OnToStringChanged(); 296 297 //approximation to avoid firing of unnecessary ToStringChangedEvents 298 //columnIndex is not used, because always full rows are returned in the ToString method 299 if (rowIndex * Columns < maximumToStringLength) 300 OnToStringChanged(); 289 301 } 290 302 public event EventHandler Reset;
Note: See TracChangeset
for help on using the changeset viewer.