Changeset 9286 for branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/ValueTypeMatrix.cs
- Timestamp:
- 03/05/13 16:37:17 (12 years ago)
- Location:
- branches/ImprovingStringConvertibleMatrix
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ImprovingStringConvertibleMatrix
-
Property
svn:ignore
set to
*.suo
-
Property
svn:ignore
set to
-
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/ValueTypeMatrix.cs
r7259 r9286 33 33 [Item("ValueTypeMatrix", "An abstract base class for representing matrices of value types.")] 34 34 [StorableClass] 35 public abstract class ValueTypeMatrix<T> : Item, IEnumerable<T> where T : struct {35 public abstract class ValueTypeMatrix<T> : Item, IEnumerable<T>, IStringConvertibleMatrix where T : struct { 36 36 public static new Image StaticItemImage { 37 37 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } … … 127 127 if (!value.Equals(matrix[rowIndex, columnIndex])) { 128 128 matrix[rowIndex, columnIndex] = value; 129 OnItem Changed(rowIndex, columnIndex);129 OnItemsChanged(new List<Position>(1) { new Position(rowIndex, columnIndex) }); 130 130 } 131 131 } … … 247 247 handler(this, EventArgs.Empty); 248 248 } 249 public event EventHandler<EventArgs< int, int>> ItemChanged;250 protected virtual void OnItem Changed(int rowIndex, int columnIndex) {251 if (Item Changed != null)252 Item Changed(this, new EventArgs<int, int>(rowIndex, columnIndex));249 public event EventHandler<EventArgs<IEnumerable<Position>>> ItemsChanged; 250 protected virtual void OnItemsChanged(IEnumerable<Position> positions) { 251 if (ItemsChanged != null) 252 ItemsChanged(this, new EventArgs<IEnumerable<Position>>(positions)); 253 253 OnToStringChanged(); 254 254 } … … 260 260 } 261 261 #endregion 262 263 protected abstract bool Validate(string value, out string errorMessage); 264 protected abstract bool SetValue(string value, int rowIndex, int columnIndex); 265 protected abstract string GetValue(int rowIndex, int columIndex); 266 protected abstract bool SetValue(IEnumerable<RowColumnValue> rowColumnValues); 267 268 #region IStringConvertibleMatrix Members 269 int IStringConvertibleMatrix.Rows { 270 get { return Rows; } 271 set { Rows = value; } 272 } 273 int IStringConvertibleMatrix.Columns { 274 get { return Columns; } 275 set { Columns = value; } 276 } 277 278 bool IStringConvertibleMatrix.Validate(string value, out string errorMessage) { 279 return Validate(value, out errorMessage); 280 } 281 string IStringConvertibleMatrix.GetValue(int rowIndex, int columnIndex) { 282 return GetValue(rowIndex, columnIndex); 283 } 284 bool IStringConvertibleMatrix.SetValue(string value, int rowIndex, int columnIndex) { 285 return SetValue(value, rowIndex, columnIndex); 286 } 287 288 bool IStringConvertibleMatrix.SetValue(RowColumnValue rowColumnValue) { 289 return SetValue(rowColumnValue.Value, rowColumnValue.Position.Row, rowColumnValue.Position.Column); 290 } 291 292 bool IStringConvertibleMatrix.SetValue(IEnumerable<RowColumnValue> rowColumnValues) { 293 return SetValue(rowColumnValues); 294 } 295 #endregion 262 296 } 263 297 }
Note: See TracChangeset
for help on using the changeset viewer.