Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/29/12 09:22:21 (12 years ago)
Author:
jkarder
Message:

#1853:

  • enhanced combinations count calculation
  • restructured code
  • minor code improvements
  • added license information
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/ValueConfigurations/CheckedValueConfigurationCollection.cs

    r8517 r8535  
    2828
    2929namespace HeuristicLab.Encodings.ParameterConfigurationEncoding {
    30   // todo: check that at least 1 elements needs to be selected
    31   // todo: control creatable item types
     30  // TODO: check that at least 1 element needs to be selected
     31  // TODO: control creatable item types
    3232  [StorableClass]
    3333  public class CheckedValueConfigurationList : CheckedItemList<IValueConfiguration>, ICheckedValueConfigurationList {
     
    4444    }
    4545
    46     public CheckedValueConfigurationList(IItemSet<IItem> validValues) {
    47       this.validValues = validValues;
    48       RegisterEvents();
    49     }
    50     public CheckedValueConfigurationList(IEnumerable<IValueConfiguration> collection)
    51       : base(collection) {
    52       validValues = null;
    53       // event wiring not needed
    54     }
    55     public CheckedValueConfigurationList() {
    56       RegisterEvents();
    57     }
     46    #region Constructors and Cloning
    5847    [StorableConstructor]
    5948    protected CheckedValueConfigurationList(bool deserializing)
     
    6756      RegisterEvents();
    6857    }
    69 
     58    public CheckedValueConfigurationList(IItemSet<IItem> validValues)
     59      : base() {
     60      this.validValues = validValues;
     61      RegisterEvents();
     62    }
     63    public CheckedValueConfigurationList(IEnumerable<IValueConfiguration> collection)
     64      : base(collection) {
     65      validValues = null;
     66      // event wiring not needed
     67    }
     68    public CheckedValueConfigurationList()
     69      : base() {
     70      RegisterEvents();
     71    }
    7072    public override IDeepCloneable Clone(Cloner cloner) {
    7173      return new CheckedValueConfigurationList(this, cloner);
     
    7577      RegisterEvents();
    7678    }
     79    #endregion
    7780
    7881    private void RegisterEvents() {
    7982      this.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IValueConfiguration>>(CheckedValueConfigurationList_ItemsAdded);
    80       this.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IValueConfiguration>>(CheckedValueConfigurationList_ItemsRemoved);
    8183    }
    8284
    8385    private void DeregisterEvents() {
    84       this.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<IValueConfiguration>>(CheckedValueConfigurationList_ItemsRemoved);
    8586      this.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<IValueConfiguration>>(CheckedValueConfigurationList_ItemsAdded);
    8687    }
     
    9596      }
    9697    }
    97 
    98     private void CheckedValueConfigurationList_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<IValueConfiguration>> e) {
    99       // auch collectionreset gehört berücksichtigt
    100       // funktioniert so nicht ganz, weil die view das hinzufügen nicht mitkriegt
    101       //if (this.Count < minItemCount) {
    102       //  foreach (var item in e.Items) {
    103       //    if (this.Count >= minItemCount)
    104       //      break;
    105       //    this.Add(item);
    106       //  }
    107       //}
    108     }
    109 
    11098  }
    11199}
Note: See TracChangeset for help on using the changeset viewer.