Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/03/10 17:36:39 (14 years ago)
Author:
gkronber
Message:

Fixed compilation warnings in CheckedItemCollection and CheckedItemList. #992 (CheckedItemList and CheckedItemCollection is necessary)

Location:
trunk/sources/HeuristicLab.Core/3.3/Collections
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/Collections/CheckedItemCollection.cs

    r3575 r3594  
    3030
    3131namespace HeuristicLab.Core {
     32  /// <summary>
     33  /// Represents a collection of checked items.
     34  /// </summary>
     35  /// <typeparam name="T">The element type (base type IItem)</typeparam>
    3236  [StorableClass]
    3337  [Item("CheckedItemCollection<T>", "Represents a collection of items that can be checked or unchecked.")]
     
    3741
    3842    /// <summary>
    39     /// gets an enumerable of checked items
     43    /// Gets an enumerable of checked items
    4044    /// </summary>
    4145    public IEnumerable<T> CheckedItems {
     
    4347    }
    4448
     49    /// <summary>
     50    /// Instantiates a new CheckedItemCollection.
     51    /// </summary>
    4552    public CheckedItemCollection()
    4653      : base() {
    4754      checkedState = new Dictionary<T, bool>();
    4855    }
     56    /// <summary>
     57    /// Instantiates a new CheckedItemCollection with a predefined capacity.
     58    /// </summary>
     59    /// <param name="capacity">Initial capacity.</param>
    4960    public CheckedItemCollection(int capacity)
    5061      : base(capacity) {
    5162      checkedState = new Dictionary<T, bool>(capacity);
    5263    }
     64    /// <summary>
     65    /// Instantiates a new CheckedItemCollection containing the elements of <paramref name="collection"/>.
     66    /// </summary>
     67    /// <param name="collection">Initial element collection.</param>
    5368    public CheckedItemCollection(IEnumerable<T> collection)
    5469      : base(collection) {
     
    5873          checkedState.Add(item, true);
    5974    }
     75    /// <summary>
     76    /// Instantiates an empty CheckedItemCollection for deserialization.
     77    /// </summary>
     78    /// <param name="deserializing"></param>
    6079    [StorableConstructor]
    6180    protected CheckedItemCollection(bool deserializing) : base(deserializing) { }
    6281
     82    /// <summary>
     83    /// Gets the checked state of <paramref name="item"/>.
     84    /// </summary>
     85    /// <param name="item">The element to get the checked state for.</param>
     86    /// <returns>Checked state of <paramref name="item"/></returns>
    6387    public bool ItemChecked(T item) {
    6488      return checkedState[item];
    6589    }
    6690
     91    /// <summary>
     92    /// Sets the checked state <paramref name="checkedState"/> of <paramref name="item"/>.
     93    /// </summary>
     94    /// <param name="item">The element to set the checked state for.</param>
     95    /// <param name="checkedState">The new checked state of the item</param>
    6796    public void SetItemCheckedState(T item, bool checkedState) {
    6897      if (!this.checkedState.ContainsKey(item)) throw new ArgumentException();
     
    73102    }
    74103
     104    /// <summary>
     105    /// Adds a new <paramref name="item"/> with the given <paramref name="checkedState"/>.
     106    /// </summary>
     107    /// <param name="item">The item to add.</param>
     108    /// <param name="checkedState">The checked state of the item to add.</param>
    75109    public void Add(T item, bool checkedState) {
    76110      Add(item);
     
    78112    }
    79113
     114    /// <summary>
     115    /// Raised when the collection of items is reset.
     116    /// </summary>
     117    /// <param name="items">Empty</param>
     118    /// <param name="oldItems">The elements in the collection before the reset.</param>
    80119    protected override void OnCollectionReset(IEnumerable<T> items, IEnumerable<T> oldItems) {
    81120      foreach (var oldItem in oldItems)
     
    87126    }
    88127
     128    /// <summary>
     129    /// Raised when new items are added to the collection.
     130    /// </summary>
     131    /// <param name="items">The elements that are added to the collection.</param>
    89132    protected override void OnItemsAdded(IEnumerable<T> items) {
    90133      foreach (var item in items)
     
    94137    }
    95138
     139    /// <summary>
     140    /// Raised when items are removed from the collection.
     141    /// </summary>
     142    /// <param name="items">The items that are removed.</param>
    96143    protected override void OnItemsRemoved(IEnumerable<T> items) {
    97144      foreach (var item in items) {
     
    101148    }
    102149
     150    /// <summary>
     151    /// Raised when the checked state of items is changed.
     152    /// </summary>
     153    /// <param name="items">The item whose check state is changed.</param>
    103154    protected virtual void OnCheckedItemsChanged(IEnumerable<T> items) {
    104155      RaiseCheckedItemsChanged(new CollectionItemsChangedEventArgs<T>(items));
    105156    }
    106157
     158    /// <summary>
     159    /// Raised after the checked state of items has been changed.
     160    /// </summary>
    107161    public event CollectionItemsChangedEventHandler<T> CheckedItemsChanged;
    108162    private void RaiseCheckedItemsChanged(CollectionItemsChangedEventArgs<T> e) {
     
    111165    }
    112166
    113     public object Clone() {
    114       return Clone(new Cloner());
    115     }
    116     public virtual IDeepCloneable Clone(Cloner cloner) {
     167    /// <summary>
     168    /// Creates a deep clone of the CheckedItemCollection.
     169    /// </summary>
     170    /// <param name="cloner"></param>
     171    /// <returns>A clone of the CheckedItemCollection</returns>
     172    public override IDeepCloneable Clone(Cloner cloner) {
    117173      CheckedItemCollection<T> clone = (CheckedItemCollection<T>)Activator.CreateInstance(this.GetType());
    118174      cloner.RegisterClonedObject(this, clone);
  • trunk/sources/HeuristicLab.Core/3.3/Collections/CheckedItemList.cs

    r3575 r3594  
    3333
    3434namespace HeuristicLab.Core {
     35  /// <summary>
     36  /// Represents a list of checked items.
     37  /// </summary>
     38  /// <typeparam name="T">The element type (base type is IItem)</typeparam>
    3539  [StorableClass]
    3640  [Item("CheckedItemList<T>", "Represents a list of items that can be checked or unchecked.")]
     
    3943    private Dictionary<T, bool> checkedState;
    4044
     45    /// <summary>
     46    /// Gets an enumerable of checked items.
     47    /// </summary>
    4148    public IEnumerable<IndexedItem<T>> CheckedItems {
    4249      get {
     
    4653      }
    4754    }
     55    /// <summary>
     56    /// Instantiates an empty CheckedItemList.
     57    /// </summary>
    4858    public CheckedItemList()
    4959      : base() {
    5060      checkedState = new Dictionary<T, bool>();
    5161    }
     62    /// <summary>
     63    /// Instantiates an empty CheckedItemList with a given initial <paramref name="capacity"/>.
     64    /// </summary>
     65    /// <param name="capacity">The initial capacity.</param>
    5266    public CheckedItemList(int capacity)
    5367      : base(capacity) {
    5468      checkedState = new Dictionary<T, bool>();
    5569    }
     70    /// <summary>
     71    /// Instantiates an CheckedItemList initially filled with the elements of <paramref name="collection"/>.
     72    /// </summary>
     73    /// <param name="collection">Collection of elements.</param>
    5674    public CheckedItemList(IEnumerable<T> collection)
    5775      : base(collection) {
     
    6280      }
    6381    }
     82    /// <summary>
     83    /// Instantiates a new CheckedItemList for deserialization.
     84    /// </summary>
     85    /// <param name="deserializing"></param>
    6486    [StorableConstructor]
    6587    protected CheckedItemList(bool deserializing) : base(deserializing) { }
    6688
     89    /// <summary>
     90    /// Gets the checked state of <paramref name="item"/>.
     91    /// </summary>
     92    /// <param name="item">The element to get the checked state for.</param>
     93    /// <returns>The checked state of <paramref name="item"/></returns>
    6794    public bool ItemChecked(T item) {
    6895      return checkedState[item];
    6996    }
    7097
     98    /// <summary>
     99    /// Gets the checked state of item with <paramref name="index"/>.
     100    /// </summary>
     101    /// <param name="itemIndex">The index of the element to get the checked state for.</param>
     102    /// <returns>The checked state of the element at <paramref name="itemIndex"/>.</returns>
    71103    public bool ItemChecked(int itemIndex) {
    72104      return ItemChecked(this[itemIndex]);
    73105    }
    74106
     107    /// <summary>
     108    /// Sets the checked state of <paramref name="item"/> to <paramref name="checkedState"/>.
     109    /// </summary>
     110    /// <param name="item">The item to set the checked state for.</param>
     111    /// <param name="checkedState">The new checked state of <paramref name="item"/></param>
    75112    public void SetItemCheckedState(T item, bool checkedState) {
    76113      if (!this.checkedState.ContainsKey(item)) throw new ArgumentException();
     
    81118    }
    82119
     120    /// <summary>
     121    /// Sets the checked state of the element with <paramref name="itemIndex"/> to <paramref name="checkedState"/>.
     122    /// </summary>
     123    /// <param name="itemIndex">The index of the item to set the checked state for.</param>
     124    /// <param name="checkedState">The new checked state of the item.</param>
    83125    public void SetItemCheckedState(int itemIndex, bool checkedState) {
    84126      SetItemCheckedState(this[itemIndex], checkedState);
    85127    }
    86128
     129    /// <summary>
     130    /// Adds a new <paramref name="item"/> with <paramref name="checkedState"/> to the list.
     131    /// </summary>
     132    /// <param name="item">The item to add to the list.</param>
     133    /// <param name="checkedState">The checked state of the item added to the list.</param>
    87134    public void Add(T item, bool checkedState) {
    88135      Add(item);
     
    90137    }
    91138
     139    /// <summary>
     140    /// Inserts a new <paramref name="item"/> at <paramref name="index"/> with <paramref name="checkedState"/> into the list.
     141    /// </summary>
     142    /// <param name="index">The insertion index of the new element.</param>
     143    /// <param name="item">The element that is inserted into the list.</param>
     144    /// <param name="checkedState">The checked state of the inserted element.</param>
    92145    public void Insert(int index, T item, bool checkedState) {
    93146      Insert(index, item);
     
    95148    }
    96149
     150    /// <summary>
     151    /// Raised after the list has been reset.
     152    /// </summary>
     153    /// <param name="items">Empty</param>
     154    /// <param name="oldItems">The elements of the list before it has been reset.</param>
    97155    protected override void OnCollectionReset(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) {
    98156      foreach (var oldIndexedItem in oldItems) {
     
    106164    }
    107165
     166    /// <summary>
     167    /// Raised when new items are added to the list.
     168    /// </summary>
     169    /// <param name="items">The items that are added.</param>
    108170    protected override void OnItemsAdded(IEnumerable<IndexedItem<T>> items) {
    109171      foreach (var indexedItem in items)
     
    113175    }
    114176
     177    /// <summary>
     178    /// Raised when items are removed from the list.
     179    /// </summary>
     180    /// <param name="items">Items that are removed.</param>
    115181    protected override void OnItemsRemoved(IEnumerable<IndexedItem<T>> items) {
    116182      foreach (var indexedItem in items)
     
    119185    }
    120186
     187    /// <summary>
     188    /// Raised when items are replaced.
     189    /// </summary>
     190    /// <param name="items">The items which replace <paramref name="oldItems"/></param>
     191    /// <param name="oldItems">The items that are replaced by <paramref name="items"/></param>
    121192    protected override void OnItemsReplaced(IEnumerable<IndexedItem<T>> items, IEnumerable<IndexedItem<T>> oldItems) {
    122193      foreach (var oldIndexedItem in oldItems)
     
    128199    }
    129200
     201    /// <summary>
     202    /// Raised after the checked state of items has been changed.
     203    /// </summary>
     204    /// <param name="items">The items whose check state has been changed.</param>
    130205    protected virtual void OnCheckedItemsChanged(IEnumerable<IndexedItem<T>> items) {
    131206      RaiseCheckedItemsChanged(new CollectionItemsChangedEventArgs<IndexedItem<T>>(items));
    132207    }
    133208
     209    /// <summary>
     210    /// Raised after the checked state of items has been changed.
     211    /// </summary>
    134212    public event CollectionItemsChangedEventHandler<IndexedItem<T>> CheckedItemsChanged;
    135213    private void RaiseCheckedItemsChanged(CollectionItemsChangedEventArgs<IndexedItem<T>> e) {
     
    138216    }
    139217
    140     public object Clone() {
    141       return Clone(new Cloner());
    142     }
    143     public virtual IDeepCloneable Clone(Cloner cloner) {
     218    /// <summary>
     219    /// Creates a new deep clone of the CheckedItemList.
     220    /// </summary>
     221    /// <param name="cloner"></param>
     222    /// <returns>A deep clone of the CheckedItemList</returns>
     223    public override IDeepCloneable Clone(Cloner cloner) {
    144224      CheckedItemList<T> clone = (CheckedItemList<T>)Activator.CreateInstance(this.GetType());
    145225      cloner.RegisterClonedObject(this, clone);
Note: See TracChangeset for help on using the changeset viewer.