Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/21/10 16:08:55 (14 years ago)
Author:
mkommend
Message:

Added ColumnsChanged and RowsChanged event in IStringConvertibleMatrix and all implementing classes (ticket #1269).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/RunCollection.cs

    r4888 r5150  
    123123      }
    124124      columnNameCache = null;
     125      OnColumnsChanged();
    125126      OnColumnNamesChanged();
    126127      rowNamesCache = null;
    127128      base.OnCollectionReset(items, oldItems);
     129      OnRowsChanged();
    128130      OnRowNamesChanged();
    129131      OnReset();
     
    131133    }
    132134    protected override void OnItemsAdded(IEnumerable<IRun> items) {
    133       bool columnNamesChanged = false;
     135      bool columnsChanged = false;
    134136      foreach (IRun run in items) {
    135137        foreach (KeyValuePair<string, IItem> parameter in run.Parameters)
    136           columnNamesChanged |= AddParameter(parameter.Key, parameter.Value);
     138          columnsChanged |= AddParameter(parameter.Key, parameter.Value);
    137139        foreach (KeyValuePair<string, IItem> result in run.Results)
    138           columnNamesChanged |= AddResult(result.Key, result.Value);
    139       }
    140       if (columnNamesChanged) columnNameCache = null;
     140          columnsChanged |= AddResult(result.Key, result.Value);
     141      }
     142      if (columnsChanged) columnNameCache = null;
    141143      rowNamesCache = null;
    142144      base.OnItemsAdded(items);
    143145      OnReset();
     146      OnRowsChanged();
    144147      OnRowNamesChanged();
    145       if (columnNamesChanged) OnColumnNamesChanged();
     148      if (columnsChanged) {
     149        OnColumnsChanged();
     150        OnColumnNamesChanged();
     151      }
    146152      UpdateFiltering(false);
    147153    }
    148154    protected override void OnItemsRemoved(IEnumerable<IRun> items) {
    149       bool columnNamesChanged = false;
     155      bool columnsChanged = false;
    150156      foreach (IRun run in items) {
    151157        foreach (string parameterName in run.Parameters.Keys)
    152           columnNamesChanged |= RemoveParameterName(parameterName);
     158          columnsChanged |= RemoveParameterName(parameterName);
    153159        foreach (string resultName in run.Results.Keys)
    154           columnNamesChanged |= RemoveResultName(resultName);
    155       }
    156       if (columnNamesChanged) columnNameCache = null;
     160          columnsChanged |= RemoveResultName(resultName);
     161      }
     162      if (columnsChanged) columnNameCache = null;
    157163      rowNamesCache = null;
    158164      base.OnItemsRemoved(items);
    159165      OnReset();
    160166      OnRowNamesChanged();
    161       if (columnNamesChanged) OnColumnNamesChanged();
     167      if (columnsChanged) {
     168        OnColumnsChanged();
     169        OnColumnNamesChanged();
     170      }
    162171    }
    163172
     
    287296      OnToStringChanged();
    288297    }
     298    public event EventHandler ColumnsChanged;
     299    protected virtual void OnColumnsChanged() {
     300      var handler = ColumnsChanged;
     301      if (handler != null) handler(this, EventArgs.Empty);
     302    }
     303    public event EventHandler RowsChanged;
     304    protected virtual void OnRowsChanged() {
     305      var handler = RowsChanged;
     306      if (handler != null) handler(this, EventArgs.Empty);
     307    }
    289308    public event EventHandler ColumnNamesChanged;
    290309    protected virtual void OnColumnNamesChanged() {
Note: See TracChangeset for help on using the changeset viewer.