Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/05/13 16:37:17 (12 years ago)
Author:
sforsten
Message:

#2018:

  • added new methods to the interface IStringConvertibleMatrix as well as two structs. Also the event ItemChanged has been changed to ItemsChanged
  • class ValueTypeMatrix now implements IStringConvertibleMatrix instead of the classes which inherit from it
  • small changes have been applied to a lot of classes to correctly implement the changed interface IStringConvertibleMatrix
  • solution file, Build.cmd and PreBuildEvent.cmd have been added
Location:
branches/ImprovingStringConvertibleMatrix
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ImprovingStringConvertibleMatrix

    • Property svn:ignore set to
      *.suo
  • branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/ValueTypeMatrix.cs

    r7259 r9286  
    3333  [Item("ValueTypeMatrix", "An abstract base class for representing matrices of value types.")]
    3434  [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 {
    3636    public static new Image StaticItemImage {
    3737      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     
    127127        if (!value.Equals(matrix[rowIndex, columnIndex])) {
    128128          matrix[rowIndex, columnIndex] = value;
    129           OnItemChanged(rowIndex, columnIndex);
     129          OnItemsChanged(new List<Position>(1) { new Position(rowIndex, columnIndex) });
    130130        }
    131131      }
     
    247247        handler(this, EventArgs.Empty);
    248248    }
    249     public event EventHandler<EventArgs<int, int>> ItemChanged;
    250     protected virtual void OnItemChanged(int rowIndex, int columnIndex) {
    251       if (ItemChanged != null)
    252         ItemChanged(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));
    253253      OnToStringChanged();
    254254    }
     
    260260    }
    261261    #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
    262296  }
    263297}
Note: See TracChangeset for help on using the changeset viewer.