Changeset 3310
- Timestamp:
- 04/12/10 15:35:39 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Data/3.3
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Data/3.3/BoolMatrix.cs
r3308 r3310 29 29 [StorableClass] 30 30 public class BoolMatrix : ValueTypeMatrix<bool>, IStringConvertibleMatrix { 31 public BoolMatrix() : base() { }31 public BoolMatrix() : base() { } 32 32 public BoolMatrix(int rows, int columns) : base(rows, columns) { } 33 public BoolMatrix(int rows, int columns, IEnumerable<string> columnNames) : base(rows, columns, columnNames) { } 34 public BoolMatrix(int rows, int columns, IEnumerable<string> columnNames, IEnumerable<string> rowNames) : base(rows, columns, columnNames, rowNames) { } 33 35 public BoolMatrix(bool[,] elements) : base(elements) { } 36 public BoolMatrix(bool[,] elements, IEnumerable<string> columnNames) : base(elements, columnNames) { } 37 public BoolMatrix(bool[,] elements, IEnumerable<string> columnNames, IEnumerable<string> rowNames) : base(elements, columnNames, rowNames) { } 34 38 35 39 public override IDeepCloneable Clone(Cloner cloner) { 36 40 BoolMatrix clone = new BoolMatrix(matrix); 41 clone.ColumnNames = new List<string>(ColumnNames); 42 clone.RowNames = new List<string>(RowNames); 37 43 cloner.RegisterClonedObject(this, clone); 38 44 return clone; … … 78 84 set { this.ColumnNames = value; } 79 85 } 86 IEnumerable<string> IStringConvertibleMatrix.RowNames { 87 get { return this.RowNames; } 88 set { this.RowNames = value; } 89 } 80 90 bool IStringConvertibleMatrix.Validate(string value, out string errorMessage) { 81 91 return Validate(value, out errorMessage); -
trunk/sources/HeuristicLab.Data/3.3/DoubleMatrix.cs
r3308 r3310 31 31 public DoubleMatrix() : base() { } 32 32 public DoubleMatrix(int rows, int columns) : base(rows, columns) { } 33 public DoubleMatrix(int rows, int columns, IEnumerable<string> columnNames) : base(rows, columns, columnNames) { } 34 public DoubleMatrix(int rows, int columns, IEnumerable<string> columnNames, IEnumerable<string> rowNames) : base(rows, columns, columnNames, rowNames) { } 33 35 public DoubleMatrix(double[,] elements) : base(elements) { } 36 public DoubleMatrix(double[,] elements, IEnumerable<string> columnNames) : base(elements, columnNames) { } 37 public DoubleMatrix(double[,] elements, IEnumerable<string> columnNames, IEnumerable<string> rowNames) : base(elements, columnNames, rowNames) { } 34 38 35 39 public override IDeepCloneable Clone(Cloner cloner) { 36 40 DoubleMatrix clone = new DoubleMatrix(matrix); 41 clone.ColumnNames = new List<string>(ColumnNames); 42 clone.RowNames = new List<string>(RowNames); 37 43 cloner.RegisterClonedObject(this, clone); 38 44 return clone; … … 78 84 set { this.ColumnNames = value; } 79 85 } 86 IEnumerable<string> IStringConvertibleMatrix.RowNames { 87 get { return this.RowNames; } 88 set { this.RowNames = value; } 89 } 80 90 bool IStringConvertibleMatrix.Validate(string value, out string errorMessage) { 81 91 return Validate(value, out errorMessage); -
trunk/sources/HeuristicLab.Data/3.3/IStringConvertibleMatrix.cs
r3308 r3310 30 30 31 31 IEnumerable<string> ColumnNames { get; set; } 32 IEnumerable<string> RowNames { get; set; } 32 33 //bool SortableView { get; } 33 34 -
trunk/sources/HeuristicLab.Data/3.3/IntMatrix.cs
r3308 r3310 31 31 public IntMatrix() : base() { } 32 32 public IntMatrix(int rows, int columns) : base(rows, columns) { } 33 public IntMatrix(int rows, int columns, IEnumerable<string> columnNames) : base(rows, columns, columnNames) { } 34 public IntMatrix(int rows, int columns, IEnumerable<string> columnNames,IEnumerable<string> rowNames) : base(rows, columns, columnNames,rowNames) { } 33 35 public IntMatrix(int[,] elements) : base(elements) { } 36 public IntMatrix(int[,] elements, IEnumerable<string> columnNames) : base(elements,columnNames) { } 37 public IntMatrix(int[,] elements, IEnumerable<string> columnNames, IEnumerable<string> rowNames) : base(elements,columnNames,rowNames) { } 34 38 35 39 public override IDeepCloneable Clone(Cloner cloner) { 36 40 IntMatrix clone = new IntMatrix(matrix); 41 clone.ColumnNames = new List<string>(ColumnNames); 42 clone.RowNames = new List<string>(RowNames); 37 43 cloner.RegisterClonedObject(this, clone); 38 44 return clone; … … 78 84 set { this.ColumnNames = value; } 79 85 } 86 IEnumerable<string> IStringConvertibleMatrix.RowNames { 87 get { return this.RowNames; } 88 set { this.RowNames = value; } 89 } 80 90 bool IStringConvertibleMatrix.Validate(string value, out string errorMessage) { 81 91 return Validate(value, out errorMessage); -
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); -
trunk/sources/HeuristicLab.Data/3.3/ValueTypeMatrix.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 } … … 91 104 matrix = new T[0, 0]; 92 105 columnNames = new List<string>(); 106 rowNames = new List<string>(); 93 107 } 94 108 protected ValueTypeMatrix(int rows, int columns) { 95 109 matrix = new T[rows, columns]; 96 110 columnNames = new List<string>(); 111 rowNames = new List<string>(); 97 112 } 98 113 protected ValueTypeMatrix(int rows, int columns, IEnumerable<string> columnNames) … … 100 115 ColumnNames = columnNames; 101 116 } 117 protected ValueTypeMatrix(int rows, int columns, IEnumerable<string> columnNames,IEnumerable<string> rowNames) 118 : this(rows, columns, columnNames) { 119 RowNames = rowNames; 120 } 102 121 protected ValueTypeMatrix(T[,] elements) { 103 122 if (elements == null) throw new ArgumentNullException(); 104 123 matrix = (T[,])elements.Clone(); 105 124 columnNames = new List<string>(); 125 rowNames = new List<string>(); 106 126 } 107 127 protected ValueTypeMatrix(T[,] elements, IEnumerable<string> columnNames) … … 109 129 ColumnNames = columnNames; 110 130 } 131 protected ValueTypeMatrix(T[,] elements, IEnumerable<string> columnNames, IEnumerable<string> rowNames) 132 : this(elements,columnNames) { 133 RowNames = rowNames; 134 } 111 135 112 136 public override IDeepCloneable Clone(Cloner cloner) { 113 137 ValueTypeMatrix<T> clone = (ValueTypeMatrix<T>)base.Clone(cloner); 114 138 clone.matrix = (T[,])matrix.Clone(); 139 clone.columnNames = new List<string>(columnNames); 140 clone.rowNames = new List<string>(rowNames); 115 141 return clone; 116 142 }
Note: See TracChangeset
for help on using the changeset viewer.