Changeset 3317 for trunk/sources/HeuristicLab.Collections
- Timestamp:
- 04/13/10 06:41:56 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Collections/3.3
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Collections/3.3/IObservableArray.cs
r2832 r3317 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.ComponentModel; … … 25 26 namespace HeuristicLab.Collections { 26 27 public interface IObservableArray<T> : IList<T>, INotifyObservableArrayItemsChanged<T>, INotifyPropertyChanged { 28 bool ReadOnlyView { get; set; } 27 29 int Length { get; } 30 31 event EventHandler ReadOnlyViewChanged; 28 32 } 29 33 } -
trunk/sources/HeuristicLab.Collections/3.3/IObservableCollection.cs
r2832 r3317 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.ComponentModel; 24 25 25 26 namespace HeuristicLab.Collections { 26 public interface IObservableCollection<T> : ICollection<T>, INotifyObservableCollectionItemsChanged<T>, INotifyPropertyChanged { } 27 public interface IObservableCollection<T> : ICollection<T>, INotifyObservableCollectionItemsChanged<T>, INotifyPropertyChanged { 28 bool ReadOnlyView { get; set; } 29 30 event EventHandler ReadOnlyViewChanged; 31 } 27 32 } -
trunk/sources/HeuristicLab.Collections/3.3/ObservableArray.cs
r3286 r3317 35 35 36 36 #region Properties 37 [Storable] 38 private bool readOnlyView; 39 public bool ReadOnlyView { 40 get { return readOnlyView; } 41 set { 42 if (readOnlyView != value) { 43 readOnlyView = value; 44 OnReadOnlyViewChanged(); 45 OnPropertyChanged("ReadOnlyView"); 46 } 47 } 48 } 49 37 50 public int Length { 38 51 get { return array.Length; } … … 63 76 public ObservableArray() { 64 77 array = new T[0]; 78 readOnlyView = array.IsReadOnly; 65 79 } 66 80 public ObservableArray(int length) { 67 81 array = new T[length]; 82 readOnlyView = array.IsReadOnly; 68 83 } 69 84 public ObservableArray(T[] array) { 70 85 this.array = (T[])array.Clone(); 86 readOnlyView = array.IsReadOnly; 71 87 } 72 88 public ObservableArray(IEnumerable<T> collection) { 73 89 array = collection.ToArray(); 90 readOnlyView = array.IsReadOnly; 74 91 } 75 92 #endregion … … 281 298 #region Events 282 299 [field: NonSerialized] 300 public event EventHandler ReadOnlyViewChanged; 301 protected virtual void OnReadOnlyViewChanged() { 302 EventHandler handler = ReadOnlyViewChanged; 303 if (handler != null) handler(this, EventArgs.Empty); 304 } 305 306 [field: NonSerialized] 283 307 public event CollectionItemsChangedEventHandler<IndexedItem<T>> ItemsReplaced; 284 308 protected virtual void OnItemsReplaced(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 285 if (ItemsReplaced != null)286 ItemsReplaced(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems));309 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = ItemsReplaced; 310 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems)); 287 311 } 288 312 … … 290 314 public event CollectionItemsChangedEventHandler<IndexedItem<T>> ItemsMoved; 291 315 protected virtual void OnItemsMoved(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 292 if (ItemsMoved != null)293 ItemsMoved(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems));316 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = ItemsMoved; 317 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems)); 294 318 } 295 319 … … 297 321 public event CollectionItemsChangedEventHandler<IndexedItem<T>> CollectionReset; 298 322 protected virtual void OnCollectionReset(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 299 if (CollectionReset != null)300 CollectionReset(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems));323 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = CollectionReset; 324 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems)); 301 325 } 302 326 … … 304 328 public event PropertyChangedEventHandler PropertyChanged; 305 329 protected virtual void OnPropertyChanged(string propertyName) { 306 if (PropertyChanged != null)307 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));330 PropertyChangedEventHandler handler = PropertyChanged; 331 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); 308 332 } 309 333 #endregion -
trunk/sources/HeuristicLab.Collections/3.3/ObservableCollection.cs
r3286 r3317 34 34 35 35 #region Properties 36 [Storable] 37 private bool readOnlyView; 38 public bool ReadOnlyView { 39 get { return readOnlyView; } 40 set { 41 if (readOnlyView != value) { 42 readOnlyView = value; 43 OnReadOnlyViewChanged(); 44 OnPropertyChanged("ReadOnlyView"); 45 } 46 } 47 } 48 36 49 public int Capacity { 37 50 get { return list.Capacity; } … … 54 67 public ObservableCollection() { 55 68 list = new List<T>(); 69 readOnlyView = ((ICollection<T>)list).IsReadOnly; 56 70 } 57 71 public ObservableCollection(int capacity) { 58 72 list = new List<T>(capacity); 73 readOnlyView = ((ICollection<T>)list).IsReadOnly; 59 74 } 60 75 public ObservableCollection(IEnumerable<T> collection) { 61 76 list = new List<T>(collection); 77 readOnlyView = ((ICollection<T>)list).IsReadOnly; 62 78 } 63 79 #endregion … … 189 205 #region Events 190 206 [field: NonSerialized] 207 public event EventHandler ReadOnlyViewChanged; 208 protected virtual void OnReadOnlyViewChanged() { 209 EventHandler handler = ReadOnlyViewChanged; 210 if (handler != null) handler(this, EventArgs.Empty); 211 } 212 213 [field: NonSerialized] 191 214 public event CollectionItemsChangedEventHandler<T> ItemsAdded; 192 215 protected virtual void OnItemsAdded(IEnumerable<T> items) { 193 if (ItemsAdded != null)194 ItemsAdded(this, new CollectionItemsChangedEventArgs<T>(items));216 CollectionItemsChangedEventHandler<T> handler = ItemsAdded; 217 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items)); 195 218 } 196 219 … … 198 221 public event CollectionItemsChangedEventHandler<T> ItemsRemoved; 199 222 protected virtual void OnItemsRemoved(IEnumerable<T> items) { 200 if (ItemsRemoved != null)201 ItemsRemoved(this, new CollectionItemsChangedEventArgs<T>(items));223 CollectionItemsChangedEventHandler<T> handler = ItemsRemoved; 224 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items)); 202 225 } 203 226 … … 205 228 public event CollectionItemsChangedEventHandler<T> CollectionReset; 206 229 protected virtual void OnCollectionReset(IEnumerable<T> items, IEnumerable<T> oldItems) { 207 if (CollectionReset != null)208 CollectionReset(this, new CollectionItemsChangedEventArgs<T>(items, oldItems));230 CollectionItemsChangedEventHandler<T> handler = CollectionReset; 231 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items, oldItems)); 209 232 } 210 233 … … 212 235 public event PropertyChangedEventHandler PropertyChanged; 213 236 protected virtual void OnPropertyChanged(string propertyName) { 214 if (PropertyChanged != null)215 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));237 PropertyChangedEventHandler handler = PropertyChanged; 238 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); 216 239 } 217 240 #endregion -
trunk/sources/HeuristicLab.Collections/3.3/ObservableDictionary.cs
r3017 r3317 35 35 36 36 #region Properties 37 [Storable] 38 private bool readOnlyView; 39 public bool ReadOnlyView { 40 get { return readOnlyView; } 41 set { 42 if (readOnlyView != value) { 43 readOnlyView = value; 44 OnReadOnlyViewChanged(); 45 OnPropertyChanged("ReadOnlyView"); 46 } 47 } 48 } 49 37 50 public ICollection<TKey> Keys { 38 51 get { return dict.Keys; } … … 71 84 public ObservableDictionary() { 72 85 dict = new Dictionary<TKey, TValue>(); 86 readOnlyView = ((ICollection<KeyValuePair<TKey, TValue>>)dict).IsReadOnly; 73 87 } 74 88 public ObservableDictionary(int capacity) { 75 89 dict = new Dictionary<TKey, TValue>(capacity); 90 readOnlyView = ((ICollection<KeyValuePair<TKey, TValue>>)dict).IsReadOnly; 76 91 } 77 92 public ObservableDictionary(IEqualityComparer<TKey> comparer) { 78 93 dict = new Dictionary<TKey, TValue>(comparer); 94 readOnlyView = ((ICollection<KeyValuePair<TKey, TValue>>)dict).IsReadOnly; 79 95 } 80 96 public ObservableDictionary(IDictionary<TKey, TValue> dictionary) { 81 97 dict = new Dictionary<TKey, TValue>(dictionary); 98 readOnlyView = ((ICollection<KeyValuePair<TKey, TValue>>)dict).IsReadOnly; 82 99 } 83 100 public ObservableDictionary(int capacity, IEqualityComparer<TKey> comparer) { 84 101 dict = new Dictionary<TKey, TValue>(capacity, comparer); 102 readOnlyView = ((ICollection<KeyValuePair<TKey, TValue>>)dict).IsReadOnly; 85 103 } 86 104 public ObservableDictionary(IDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey> comparer) { 87 105 dict = new Dictionary<TKey, TValue>(dictionary, comparer); 106 readOnlyView = ((ICollection<KeyValuePair<TKey, TValue>>)dict).IsReadOnly; 88 107 } 89 108 #endregion … … 181 200 #region Events 182 201 [field: NonSerialized] 202 public event EventHandler ReadOnlyViewChanged; 203 protected virtual void OnReadOnlyViewChanged() { 204 EventHandler handler = ReadOnlyViewChanged; 205 if (handler != null) handler(this, EventArgs.Empty); 206 } 207 208 [field: NonSerialized] 183 209 public event CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> ItemsAdded; 184 210 protected virtual void OnItemsAdded(IEnumerable<KeyValuePair<TKey, TValue>> items) { 185 if (ItemsAdded != null)186 ItemsAdded(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items));211 CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> handler = ItemsAdded; 212 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items)); 187 213 } 188 214 … … 190 216 public event CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> ItemsRemoved; 191 217 protected virtual void OnItemsRemoved(IEnumerable<KeyValuePair<TKey, TValue>> items) { 192 if (ItemsRemoved != null)193 ItemsRemoved(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items));218 CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> handler = ItemsRemoved; 219 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items)); 194 220 } 195 221 … … 197 223 public event CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> ItemsReplaced; 198 224 protected virtual void OnItemsReplaced(IEnumerable<KeyValuePair<TKey, TValue>> items, IEnumerable<KeyValuePair<TKey, TValue>> oldItems) { 199 if (ItemsReplaced != null)200 ItemsReplaced(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items, oldItems));225 CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> handler = ItemsReplaced; 226 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items, oldItems)); 201 227 } 202 228 … … 204 230 public event CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> CollectionReset; 205 231 protected virtual void OnCollectionReset(IEnumerable<KeyValuePair<TKey, TValue>> items, IEnumerable<KeyValuePair<TKey, TValue>> oldItems) { 206 if (CollectionReset != null)207 CollectionReset(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items, oldItems));232 CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> handler = CollectionReset; 233 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items, oldItems)); 208 234 } 209 235 … … 211 237 public event PropertyChangedEventHandler PropertyChanged; 212 238 protected virtual void OnPropertyChanged(string propertyName) { 213 if (PropertyChanged != null)214 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));239 PropertyChangedEventHandler handler = PropertyChanged; 240 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); 215 241 } 216 242 #endregion -
trunk/sources/HeuristicLab.Collections/3.3/ObservableKeyedCollection.cs
r3286 r3317 35 35 36 36 #region Properties 37 [Storable] 38 private bool readOnlyView; 39 public bool ReadOnlyView { 40 get { return readOnlyView; } 41 set { 42 if (readOnlyView != value) { 43 readOnlyView = value; 44 OnReadOnlyViewChanged(); 45 OnPropertyChanged("ReadOnlyView"); 46 } 47 } 48 } 49 37 50 public int Count { 38 51 get { return dict.Count; } … … 55 68 protected ObservableKeyedCollection() { 56 69 dict = new Dictionary<TKey, TItem>(); 70 readOnlyView = ((ICollection<KeyValuePair<TKey, TItem>>)dict).IsReadOnly; 57 71 } 58 72 protected ObservableKeyedCollection(int capacity) { 59 73 dict = new Dictionary<TKey, TItem>(capacity); 74 readOnlyView = ((ICollection<KeyValuePair<TKey, TItem>>)dict).IsReadOnly; 60 75 } 61 76 protected ObservableKeyedCollection(IEqualityComparer<TKey> comparer) { 62 77 dict = new Dictionary<TKey, TItem>(comparer); 78 readOnlyView = ((ICollection<KeyValuePair<TKey, TItem>>)dict).IsReadOnly; 63 79 } 64 80 protected ObservableKeyedCollection(IEnumerable<TItem> collection) { … … 67 83 foreach (TItem item in collection) 68 84 dict.Add(GetKeyForItem(item), item); 85 readOnlyView = ((ICollection<KeyValuePair<TKey, TItem>>)dict).IsReadOnly; 69 86 } 70 87 protected ObservableKeyedCollection(int capacity, IEqualityComparer<TKey> comparer) { 71 88 dict = new Dictionary<TKey, TItem>(capacity, comparer); 89 readOnlyView = ((ICollection<KeyValuePair<TKey, TItem>>)dict).IsReadOnly; 72 90 } 73 91 protected ObservableKeyedCollection(IEnumerable<TItem> collection, IEqualityComparer<TKey> comparer) { … … 76 94 foreach (TItem item in collection) 77 95 dict.Add(GetKeyForItem(item), item); 96 readOnlyView = ((ICollection<KeyValuePair<TKey, TItem>>)dict).IsReadOnly; 78 97 } 79 98 #endregion … … 250 269 #region Events 251 270 [field: NonSerialized] 271 public event EventHandler ReadOnlyViewChanged; 272 protected virtual void OnReadOnlyViewChanged() { 273 EventHandler handler = ReadOnlyViewChanged; 274 if (handler != null) handler(this, EventArgs.Empty); 275 } 276 277 [field: NonSerialized] 252 278 public event CollectionItemsChangedEventHandler<TItem> ItemsAdded; 253 279 protected virtual void OnItemsAdded(IEnumerable<TItem> items) { 254 if (ItemsAdded != null)255 ItemsAdded(this, new CollectionItemsChangedEventArgs<TItem>(items));280 CollectionItemsChangedEventHandler<TItem> handler = ItemsAdded; 281 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<TItem>(items)); 256 282 } 257 283 … … 259 285 public event CollectionItemsChangedEventHandler<TItem> ItemsRemoved; 260 286 protected virtual void OnItemsRemoved(IEnumerable<TItem> items) { 261 if (ItemsRemoved != null)262 ItemsRemoved(this, new CollectionItemsChangedEventArgs<TItem>(items));287 CollectionItemsChangedEventHandler<TItem> handler = ItemsRemoved; 288 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<TItem>(items)); 263 289 } 264 290 … … 266 292 public event CollectionItemsChangedEventHandler<TItem> ItemsReplaced; 267 293 protected virtual void OnItemsReplaced(IEnumerable<TItem> items, IEnumerable<TItem> oldItems) { 268 if (ItemsReplaced != null)269 ItemsReplaced(this, new CollectionItemsChangedEventArgs<TItem>(items, oldItems));294 CollectionItemsChangedEventHandler<TItem> handler = ItemsReplaced; 295 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<TItem>(items, oldItems)); 270 296 } 271 297 … … 273 299 public event CollectionItemsChangedEventHandler<TItem> CollectionReset; 274 300 protected virtual void OnCollectionReset(IEnumerable<TItem> items, IEnumerable<TItem> oldItems) { 275 if (CollectionReset != null)276 CollectionReset(this, new CollectionItemsChangedEventArgs<TItem>(items, oldItems));301 CollectionItemsChangedEventHandler<TItem> handler = CollectionReset; 302 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<TItem>(items, oldItems)); 277 303 } 278 304 … … 280 306 public event PropertyChangedEventHandler PropertyChanged; 281 307 protected virtual void OnPropertyChanged(string propertyName) { 282 if (PropertyChanged != null)283 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));308 PropertyChangedEventHandler handler = PropertyChanged; 309 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); 284 310 } 285 311 #endregion -
trunk/sources/HeuristicLab.Collections/3.3/ObservableList.cs
r3286 r3317 34 34 35 35 #region Properties 36 [Storable] 37 private bool readOnlyView; 38 public bool ReadOnlyView { 39 get { return readOnlyView; } 40 set { 41 if (readOnlyView != value) { 42 readOnlyView = value; 43 OnReadOnlyViewChanged(); 44 OnPropertyChanged("ReadOnlyView"); 45 } 46 } 47 } 48 36 49 public int Capacity { 37 50 get { return list.Capacity; } … … 68 81 public ObservableList() { 69 82 list = new List<T>(); 83 readOnlyView = ((ICollection<T>)list).IsReadOnly; 70 84 } 71 85 public ObservableList(int capacity) { 72 86 list = new List<T>(capacity); 87 readOnlyView = ((ICollection<T>)list).IsReadOnly; 73 88 } 74 89 public ObservableList(IEnumerable<T> collection) { 75 90 list = new List<T>(collection); 91 readOnlyView = ((ICollection<T>)list).IsReadOnly; 76 92 } 77 93 #endregion … … 375 391 #region Events 376 392 [field: NonSerialized] 393 public event EventHandler ReadOnlyViewChanged; 394 protected virtual void OnReadOnlyViewChanged() { 395 EventHandler handler = ReadOnlyViewChanged; 396 if (handler != null) handler(this, EventArgs.Empty); 397 } 398 399 [field: NonSerialized] 377 400 public event CollectionItemsChangedEventHandler<IndexedItem<T>> ItemsAdded; 378 401 protected virtual void OnItemsAdded(IEnumerable<IndexedItem<T>> items) { 379 if (ItemsAdded != null)380 ItemsAdded(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items));402 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = ItemsAdded; 403 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items)); 381 404 } 382 405 … … 388 411 } 389 412 private void OnItemsAdded(IEnumerable<T> items) { 390 if (itemsAdded != null)391 itemsAdded(this, new CollectionItemsChangedEventArgs<T>(items));413 CollectionItemsChangedEventHandler<T> handler = itemsAdded; 414 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items)); 392 415 } 393 416 … … 395 418 public event CollectionItemsChangedEventHandler<IndexedItem<T>> ItemsRemoved; 396 419 protected virtual void OnItemsRemoved(IEnumerable<IndexedItem<T>> items) { 397 if (ItemsRemoved != null)398 ItemsRemoved(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items));420 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = ItemsRemoved; 421 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items)); 399 422 } 400 423 … … 406 429 } 407 430 private void OnItemsRemoved(IEnumerable<T> items) { 408 if (itemsRemoved != null)409 itemsRemoved(this, new CollectionItemsChangedEventArgs<T>(items));431 CollectionItemsChangedEventHandler<T> handler = itemsRemoved; 432 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items)); 410 433 } 411 434 … … 413 436 public event CollectionItemsChangedEventHandler<IndexedItem<T>> ItemsReplaced; 414 437 protected virtual void OnItemsReplaced(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 415 if (ItemsReplaced != null)416 ItemsReplaced(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems));438 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = ItemsReplaced; 439 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems)); 417 440 } 418 441 … … 420 443 public event CollectionItemsChangedEventHandler<IndexedItem<T>> ItemsMoved; 421 444 protected virtual void OnItemsMoved(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 422 if (ItemsMoved != null)423 ItemsMoved(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems));445 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = ItemsMoved; 446 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems)); 424 447 } 425 448 … … 427 450 public event CollectionItemsChangedEventHandler<IndexedItem<T>> CollectionReset; 428 451 protected virtual void OnCollectionReset(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 429 if (CollectionReset != null)430 CollectionReset(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems));452 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = CollectionReset; 453 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems)); 431 454 } 432 455 … … 438 461 } 439 462 private void OnCollectionReset(IEnumerable<T> items, IEnumerable<T> oldItems) { 440 if (collectionReset != null)441 collectionReset(this, new CollectionItemsChangedEventArgs<T>(items, oldItems));463 CollectionItemsChangedEventHandler<T> handler = collectionReset; 464 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items, oldItems)); 442 465 } 443 466 … … 445 468 public event PropertyChangedEventHandler PropertyChanged; 446 469 protected virtual void OnPropertyChanged(string propertyName) { 447 if (PropertyChanged != null)448 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));470 PropertyChangedEventHandler handler = PropertyChanged; 471 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); 449 472 } 450 473 #endregion -
trunk/sources/HeuristicLab.Collections/3.3/ObservableSet.cs
r3286 r3317 35 35 36 36 #region Properties 37 [Storable] 38 private bool readOnlyView; 39 public bool ReadOnlyView { 40 get { return readOnlyView; } 41 set { 42 if (readOnlyView != value) { 43 readOnlyView = value; 44 OnReadOnlyViewChanged(); 45 OnPropertyChanged("ReadOnlyView"); 46 } 47 } 48 } 49 37 50 public IEqualityComparer<T> Comparer { 38 51 get { return set.Comparer; } … … 49 62 public ObservableSet() { 50 63 set = new HashSet<T>(); 64 readOnlyView = ((ICollection<T>)set).IsReadOnly; 51 65 } 52 66 public ObservableSet(IEnumerable<T> collection) { 53 67 set = new HashSet<T>(collection); 68 readOnlyView = ((ICollection<T>)set).IsReadOnly; 54 69 } 55 70 public ObservableSet(IEqualityComparer<T> comparer) { 56 71 set = new HashSet<T>(comparer); 72 readOnlyView = ((ICollection<T>)set).IsReadOnly; 57 73 } 58 74 public ObservableSet(IEnumerable<T> collection, IEqualityComparer<T> comparer) { 59 75 set = new HashSet<T>(collection, comparer); 76 readOnlyView = ((ICollection<T>)set).IsReadOnly; 60 77 } 61 78 #endregion … … 227 244 #region Events 228 245 [field: NonSerialized] 246 public event EventHandler ReadOnlyViewChanged; 247 protected virtual void OnReadOnlyViewChanged() { 248 EventHandler handler = ReadOnlyViewChanged; 249 if (handler != null) handler(this, EventArgs.Empty); 250 } 251 252 [field: NonSerialized] 229 253 public event CollectionItemsChangedEventHandler<T> ItemsAdded; 230 254 protected virtual void OnItemsAdded(IEnumerable<T> items) { 231 if (ItemsAdded != null)232 ItemsAdded(this, new CollectionItemsChangedEventArgs<T>(items));255 CollectionItemsChangedEventHandler<T> handler = ItemsAdded; 256 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items)); 233 257 } 234 258 … … 236 260 public event CollectionItemsChangedEventHandler<T> ItemsRemoved; 237 261 protected virtual void OnItemsRemoved(IEnumerable<T> items) { 238 if (ItemsRemoved != null)239 ItemsRemoved(this, new CollectionItemsChangedEventArgs<T>(items));262 CollectionItemsChangedEventHandler<T> handler = ItemsRemoved; 263 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items)); 240 264 } 241 265 … … 243 267 public event CollectionItemsChangedEventHandler<T> CollectionReset; 244 268 protected virtual void OnCollectionReset(IEnumerable<T> items, IEnumerable<T> oldItems) { 245 if (CollectionReset != null)246 CollectionReset(this, new CollectionItemsChangedEventArgs<T>(items, oldItems));269 CollectionItemsChangedEventHandler<T> handler = CollectionReset; 270 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items, oldItems)); 247 271 } 248 272 … … 250 274 public event PropertyChangedEventHandler PropertyChanged; 251 275 protected virtual void OnPropertyChanged(string propertyName) { 252 if (PropertyChanged != null)253 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));276 PropertyChangedEventHandler handler = PropertyChanged; 277 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); 254 278 } 255 279 #endregion -
trunk/sources/HeuristicLab.Collections/3.3/ReadOnlyObservableArray.cs
r3019 r3317 34 34 35 35 #region Properties 36 public bool ReadOnlyView { 37 get { return true; } 38 set { throw new NotSupportedException(); } 39 } 40 36 41 public int Length { 37 42 get { return array.Length; } … … 117 122 } 118 123 124 event EventHandler IObservableArray<T>.ReadOnlyViewChanged { 125 add { } 126 remove { } 127 } 128 119 129 [field: NonSerialized] 120 130 public event CollectionItemsChangedEventHandler<IndexedItem<T>> ItemsReplaced; 121 131 protected virtual void OnItemsReplaced(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 122 if (ItemsReplaced != null)123 ItemsReplaced(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems));132 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = ItemsReplaced; 133 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems)); 124 134 } 125 135 … … 127 137 public event CollectionItemsChangedEventHandler<IndexedItem<T>> ItemsMoved; 128 138 protected virtual void OnItemsMoved(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 129 if (ItemsMoved != null)130 ItemsMoved(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems));139 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = ItemsMoved; 140 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems)); 131 141 } 132 142 … … 134 144 public event CollectionItemsChangedEventHandler<IndexedItem<T>> CollectionReset; 135 145 protected virtual void OnCollectionReset(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 136 if (CollectionReset != null)137 CollectionReset(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems));146 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = CollectionReset; 147 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems)); 138 148 } 139 149 … … 141 151 public event PropertyChangedEventHandler PropertyChanged; 142 152 protected virtual void OnPropertyChanged(string propertyName) { 143 if (PropertyChanged != null)144 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));153 PropertyChangedEventHandler handler = PropertyChanged; 154 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); 145 155 } 146 156 -
trunk/sources/HeuristicLab.Collections/3.3/ReadOnlyObservableCollection.cs
r3019 r3317 34 34 35 35 #region Properties 36 public bool ReadOnlyView { 37 get { return true; } 38 set { throw new NotSupportedException(); } 39 } 40 36 41 public int Count { 37 42 get { return collection.Count; } … … 95 100 } 96 101 102 event EventHandler IObservableCollection<T>.ReadOnlyViewChanged { 103 add { } 104 remove { } 105 } 106 97 107 [field: NonSerialized] 98 108 public event CollectionItemsChangedEventHandler<T> ItemsAdded; 99 109 protected virtual void OnItemsAdded(IEnumerable<T> items) { 100 if (ItemsAdded != null)101 ItemsAdded(this, new CollectionItemsChangedEventArgs<T>(items));110 CollectionItemsChangedEventHandler<T> handler = ItemsAdded; 111 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items)); 102 112 } 103 113 … … 105 115 public event CollectionItemsChangedEventHandler<T> ItemsRemoved; 106 116 protected virtual void OnItemsRemoved(IEnumerable<T> items) { 107 if (ItemsRemoved != null)108 ItemsRemoved(this, new CollectionItemsChangedEventArgs<T>(items));117 CollectionItemsChangedEventHandler<T> handler = ItemsRemoved; 118 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items)); 109 119 } 110 120 … … 112 122 public event CollectionItemsChangedEventHandler<T> CollectionReset; 113 123 protected virtual void OnCollectionReset(IEnumerable<T> items, IEnumerable<T> oldItems) { 114 if (CollectionReset != null)115 CollectionReset(this, new CollectionItemsChangedEventArgs<T>(items, oldItems));124 CollectionItemsChangedEventHandler<T> handler = CollectionReset; 125 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items, oldItems)); 116 126 } 117 127 … … 119 129 public event PropertyChangedEventHandler PropertyChanged; 120 130 protected virtual void OnPropertyChanged(string propertyName) { 121 if (PropertyChanged != null)122 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));131 PropertyChangedEventHandler handler = PropertyChanged; 132 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); 123 133 } 124 134 -
trunk/sources/HeuristicLab.Collections/3.3/ReadOnlyObservableDictionary.cs
r3019 r3317 34 34 35 35 #region Properties 36 public bool ReadOnlyView { 37 get { return true; } 38 set { throw new NotSupportedException(); } 39 } 40 36 41 public ICollection<TKey> Keys { 37 42 get { return dict.Keys; } … … 123 128 } 124 129 130 event EventHandler IObservableCollection<KeyValuePair<TKey, TValue>>.ReadOnlyViewChanged { 131 add { } 132 remove { } 133 } 134 125 135 [field: NonSerialized] 126 136 public event CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> ItemsAdded; 127 137 protected virtual void OnItemsAdded(IEnumerable<KeyValuePair<TKey, TValue>> items) { 128 if (ItemsAdded != null)129 ItemsAdded(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items));138 CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> handler = ItemsAdded; 139 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items)); 130 140 } 131 141 … … 133 143 public event CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> ItemsRemoved; 134 144 protected virtual void OnItemsRemoved(IEnumerable<KeyValuePair<TKey, TValue>> items) { 135 if (ItemsRemoved != null)136 ItemsRemoved(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items));145 CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> handler = ItemsRemoved; 146 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items)); 137 147 } 138 148 … … 140 150 public event CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> ItemsReplaced; 141 151 protected virtual void OnItemsReplaced(IEnumerable<KeyValuePair<TKey, TValue>> items, IEnumerable<KeyValuePair<TKey, TValue>> oldItems) { 142 if (ItemsReplaced != null)143 ItemsReplaced(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items, oldItems));152 CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> handler = ItemsReplaced; 153 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items, oldItems)); 144 154 } 145 155 … … 147 157 public event CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> CollectionReset; 148 158 protected virtual void OnCollectionReset(IEnumerable<KeyValuePair<TKey, TValue>> items, IEnumerable<KeyValuePair<TKey, TValue>> oldItems) { 149 if (CollectionReset != null)150 CollectionReset(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items, oldItems));159 CollectionItemsChangedEventHandler<KeyValuePair<TKey, TValue>> handler = CollectionReset; 160 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<KeyValuePair<TKey, TValue>>(items, oldItems)); 151 161 } 152 162 … … 154 164 public event PropertyChangedEventHandler PropertyChanged; 155 165 protected virtual void OnPropertyChanged(string propertyName) { 156 if (PropertyChanged != null)157 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));166 PropertyChangedEventHandler handler = PropertyChanged; 167 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); 158 168 } 159 169 -
trunk/sources/HeuristicLab.Collections/3.3/ReadOnlyObservableKeyedCollection.cs
r3019 r3317 34 34 35 35 #region Properties 36 public bool ReadOnlyView { 37 get { return true; } 38 set { throw new NotSupportedException(); } 39 } 40 36 41 public int Count { 37 42 get { return collection.Count; } … … 112 117 } 113 118 119 event EventHandler IObservableCollection<TItem>.ReadOnlyViewChanged { 120 add { } 121 remove { } 122 } 123 114 124 [field: NonSerialized] 115 125 public event CollectionItemsChangedEventHandler<TItem> ItemsAdded; 116 126 protected virtual void OnItemsAdded(IEnumerable<TItem> items) { 117 if (ItemsAdded != null)118 ItemsAdded(this, new CollectionItemsChangedEventArgs<TItem>(items));127 CollectionItemsChangedEventHandler<TItem> handler = ItemsAdded; 128 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<TItem>(items)); 119 129 } 120 130 … … 122 132 public event CollectionItemsChangedEventHandler<TItem> ItemsRemoved; 123 133 protected virtual void OnItemsRemoved(IEnumerable<TItem> items) { 124 if (ItemsRemoved != null)125 ItemsRemoved(this, new CollectionItemsChangedEventArgs<TItem>(items));134 CollectionItemsChangedEventHandler<TItem> handler = ItemsRemoved; 135 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<TItem>(items)); 126 136 } 127 137 … … 129 139 public event CollectionItemsChangedEventHandler<TItem> ItemsReplaced; 130 140 protected virtual void OnItemsReplaced(IEnumerable<TItem> items, IEnumerable<TItem> oldItems) { 131 if (ItemsReplaced != null)132 ItemsReplaced(this, new CollectionItemsChangedEventArgs<TItem>(items, oldItems));141 CollectionItemsChangedEventHandler<TItem> handler = ItemsReplaced; 142 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<TItem>(items, oldItems)); 133 143 } 134 144 … … 136 146 public event CollectionItemsChangedEventHandler<TItem> CollectionReset; 137 147 protected virtual void OnCollectionReset(IEnumerable<TItem> items, IEnumerable<TItem> oldItems) { 138 if (CollectionReset != null)139 CollectionReset(this, new CollectionItemsChangedEventArgs<TItem>(items, oldItems));148 CollectionItemsChangedEventHandler<TItem> handler = CollectionReset; 149 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<TItem>(items, oldItems)); 140 150 } 141 151 … … 143 153 public event PropertyChangedEventHandler PropertyChanged; 144 154 protected virtual void OnPropertyChanged(string propertyName) { 145 if (PropertyChanged != null)146 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));155 PropertyChangedEventHandler handler = PropertyChanged; 156 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); 147 157 } 148 158 -
trunk/sources/HeuristicLab.Collections/3.3/ReadOnlyObservableList.cs
r3019 r3317 34 34 35 35 #region Properties 36 public bool ReadOnlyView { 37 get { return true; } 38 set { throw new NotSupportedException(); } 39 } 40 36 41 public int Count { 37 42 get { return ((ICollection<T>)list).Count; } … … 119 124 } 120 125 126 event EventHandler IObservableCollection<T>.ReadOnlyViewChanged { 127 add { } 128 remove { } 129 } 130 121 131 [field: NonSerialized] 122 132 public event CollectionItemsChangedEventHandler<IndexedItem<T>> ItemsAdded; 123 133 protected virtual void OnItemsAdded(IEnumerable<IndexedItem<T>> items) { 124 if (ItemsAdded != null)125 ItemsAdded(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items));134 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = ItemsAdded; 135 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items)); 126 136 } 127 137 … … 133 143 } 134 144 private void OnItemsAdded(IEnumerable<T> items) { 135 if (itemsAdded != null)136 itemsAdded(this, new CollectionItemsChangedEventArgs<T>(items));145 CollectionItemsChangedEventHandler<T> handler = itemsAdded; 146 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items)); 137 147 } 138 148 … … 140 150 public event CollectionItemsChangedEventHandler<IndexedItem<T>> ItemsRemoved; 141 151 protected virtual void OnItemsRemoved(IEnumerable<IndexedItem<T>> items) { 142 if (ItemsRemoved != null)143 ItemsRemoved(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items));152 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = ItemsRemoved; 153 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items)); 144 154 } 145 155 … … 151 161 } 152 162 private void OnItemsRemoved(IEnumerable<T> items) { 153 if (itemsRemoved != null)154 itemsRemoved(this, new CollectionItemsChangedEventArgs<T>(items));163 CollectionItemsChangedEventHandler<T> handler = itemsRemoved; 164 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items)); 155 165 } 156 166 … … 158 168 public event CollectionItemsChangedEventHandler<IndexedItem<T>> ItemsReplaced; 159 169 protected virtual void OnItemsReplaced(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 160 if (ItemsReplaced != null)161 ItemsReplaced(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems));170 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = ItemsReplaced; 171 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems)); 162 172 } 163 173 … … 165 175 public event CollectionItemsChangedEventHandler<IndexedItem<T>> ItemsMoved; 166 176 protected virtual void OnItemsMoved(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 167 if (ItemsMoved != null)168 ItemsMoved(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems));177 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = ItemsMoved; 178 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems)); 169 179 } 170 180 … … 172 182 public event CollectionItemsChangedEventHandler<IndexedItem<T>> CollectionReset; 173 183 protected virtual void OnCollectionReset(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) { 174 if (CollectionReset != null)175 CollectionReset(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems));184 CollectionItemsChangedEventHandler<IndexedItem<T>> handler = CollectionReset; 185 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<IndexedItem<T>>(items, oldItems)); 176 186 } 177 187 … … 183 193 } 184 194 private void OnCollectionReset(IEnumerable<T> items, IEnumerable<T> oldItems) { 185 if (collectionReset != null)186 collectionReset(this, new CollectionItemsChangedEventArgs<T>(items, oldItems));195 CollectionItemsChangedEventHandler<T> handler = collectionReset; 196 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items, oldItems)); 187 197 } 188 198 … … 190 200 public event PropertyChangedEventHandler PropertyChanged; 191 201 protected virtual void OnPropertyChanged(string propertyName) { 192 if (PropertyChanged != null)193 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));202 PropertyChangedEventHandler handler = PropertyChanged; 203 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); 194 204 } 195 205 -
trunk/sources/HeuristicLab.Collections/3.3/ReadOnlyObservableSet.cs
r3019 r3317 34 34 35 35 #region Properties 36 public bool ReadOnlyView { 37 get { return true; } 38 set { throw new NotSupportedException(); } 39 } 40 36 41 public int Count { 37 42 get { return set.Count; } … … 136 141 } 137 142 143 event EventHandler IObservableCollection<T>.ReadOnlyViewChanged { 144 add { } 145 remove { } 146 } 147 138 148 [field: NonSerialized] 139 149 public event CollectionItemsChangedEventHandler<T> ItemsAdded; 140 150 protected virtual void OnItemsAdded(IEnumerable<T> items) { 141 if (ItemsAdded != null)142 ItemsAdded(this, new CollectionItemsChangedEventArgs<T>(items));151 CollectionItemsChangedEventHandler<T> handler = ItemsAdded; 152 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items)); 143 153 } 144 154 … … 146 156 public event CollectionItemsChangedEventHandler<T> ItemsRemoved; 147 157 protected virtual void OnItemsRemoved(IEnumerable<T> items) { 148 if (ItemsRemoved != null)149 ItemsRemoved(this, new CollectionItemsChangedEventArgs<T>(items));158 CollectionItemsChangedEventHandler<T> handler = ItemsRemoved; 159 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items)); 150 160 } 151 161 … … 153 163 public event CollectionItemsChangedEventHandler<T> CollectionReset; 154 164 protected virtual void OnCollectionReset(IEnumerable<T> items, IEnumerable<T> oldItems) { 155 if (CollectionReset != null)156 CollectionReset(this, new CollectionItemsChangedEventArgs<T>(items, oldItems));165 CollectionItemsChangedEventHandler<T> handler = CollectionReset; 166 if (handler != null) handler(this, new CollectionItemsChangedEventArgs<T>(items, oldItems)); 157 167 } 158 168 … … 160 170 public event PropertyChangedEventHandler PropertyChanged; 161 171 protected virtual void OnPropertyChanged(string propertyName) { 162 if (PropertyChanged != null)163 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));172 PropertyChangedEventHandler handler = PropertyChanged; 173 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); 164 174 } 165 175
Note: See TracChangeset
for help on using the changeset viewer.