Free cookie consent management tool by TermsFeed Policy Generator

source: branches/ParameterConfigurationEncoding/HeuristicLab.Encodings.ParameterConfigurationEncoding/3.3/ConstrainedItemList.cs @ 8517

Last change on this file since 8517 was 8517, checked in by jkarder, 12 years ago

#1853:

  • created branch for ParameterConfigurationEncoding
  • added CreateExperimentDialog that uses the extracted encoding
File size: 1015 bytes
Line 
1using System;
2using HeuristicLab.Common;
3using HeuristicLab.Core;
4using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
5
6namespace HeuristicLab.Encodings.ParameterConfigurationEncoding {
7  [StorableClass]
8  public class ConstrainedItemList<T> : ItemList<T> where T : class, IItem {
9    [Storable]
10    private Type type;
11    public Type Type {
12      get { return type; }
13      set {
14        if (type != value) {
15          type = value;
16          this.RemoveAll(x => x.GetType() != type);
17        }
18      }
19    }
20
21    public ConstrainedItemList() {
22      Type = typeof(T);
23    }
24    [StorableConstructor]
25    protected ConstrainedItemList(bool deserializing) : base(deserializing) { }
26    protected ConstrainedItemList(ConstrainedItemList<T> original, Cloner cloner)
27      : base(original, cloner) {
28      this.Type = original.Type;
29    }
30    public override IDeepCloneable Clone(Cloner cloner) {
31      return new ConstrainedItemList<T>(this, cloner);
32    }
33  }
34}
Note: See TracBrowser for help on using the repository browser.