Changeset 3310 for trunk/sources/HeuristicLab.Data/3.3/StringMatrix.cs
- Timestamp:
- 04/12/10 15:35:39 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Data/3.3/StringMatrix.cs
r3308 r3310 42 42 43 43 [Storable] 44 pr otectedList<string> columnNames;44 private List<string> columnNames; 45 45 public IEnumerable<string> ColumnNames { 46 46 get { return this.columnNames; } … … 49 49 columnNames = new List<string>(); 50 50 else if (value.Count() != Columns) 51 throw new ArgumentException("A column Name must be for each column specified.");51 throw new ArgumentException("A column name must be specified for each column ."); 52 52 else 53 53 columnNames = new List<string>(value); 54 } 55 } 56 [Storable] 57 private List<string> rowNames; 58 public IEnumerable<string> RowNames { 59 get { return this.rowNames; } 60 set { 61 if (value == null || value.Count() == 0) 62 rowNames = new List<string>(); 63 else if (value.Count() != Rows) 64 throw new ArgumentException("A row name must be specified for each row."); 65 else 66 rowNames = new List<string>(value); 54 67 } 55 68 } … … 93 106 matrix = new string[0, 0]; 94 107 columnNames = new List<string>(); 108 rowNames = new List<string>(); 95 109 } 96 110 public StringMatrix(int rows, int columns) { … … 101 115 } 102 116 columnNames = new List<string>(); 117 rowNames = new List<string>(); 103 118 } 104 119 protected StringMatrix(int rows, int columns, IEnumerable<string> columnNames) 105 120 : this(rows, columns) { 106 121 ColumnNames = columnNames; 122 } 123 protected StringMatrix(int rows, int columns, IEnumerable<string> columnNames, IEnumerable<string> rowNames) 124 : this(rows, columns,columnNames) { 125 RowNames = rowNames; 107 126 } 108 127 public StringMatrix(string[,] elements) { … … 114 133 } 115 134 columnNames = new List<string>(); 135 rowNames = new List<string>(); 116 136 } 117 137 protected StringMatrix(string[,] elements, IEnumerable<string> columnNames) 118 138 : this(elements) { 119 139 ColumnNames = columnNames; 140 } 141 protected StringMatrix(string[,] elements, IEnumerable<string> columnNames,IEnumerable<string> rowNames) 142 : this(elements,columnNames) { 143 RowNames = rowNames; 120 144 } 121 145 … … 124 148 cloner.RegisterClonedObject(this, clone); 125 149 clone.matrix = (string[,])matrix.Clone(); 150 clone.columnNames = new List<string>(columnNames); 151 clone.rowNames = new List<string>(rowNames); 126 152 return clone; 127 153 } … … 193 219 set { this.ColumnNames = value; } 194 220 } 221 IEnumerable<string> IStringConvertibleMatrix.RowNames { 222 get { return this.RowNames; } 223 set { this.RowNames = value; } 224 } 195 225 bool IStringConvertibleMatrix.Validate(string value, out string errorMessage) { 196 226 return Validate(value, out errorMessage);
Note: See TracChangeset
for help on using the changeset viewer.