Free cookie consent management tool by TermsFeed Policy Generator

source: addons/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/ConstrainedItemList.cs @ 17282

Last change on this file since 17282 was 16996, checked in by gkronber, 6 years ago

#2520 Update plugin dependencies and references for HL.MetaOptimization for new persistence

File size: 982 bytes
RevLine 
[5110]1using System;
2using HeuristicLab.Core;
3using HeuristicLab.Common;
[16574]4using HEAL.Attic;
[5110]5
6namespace HeuristicLab.Problems.MetaOptimization {
[16574]7  [StorableType("D5AB5F97-8D08-4BE4-AB71-BA670EA26B6D")]
[5110]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]
[16574]25    protected ConstrainedItemList(StorableConstructorFlag _) : base(_) { }
[5110]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.