using System; using HeuristicLab.Core; using HeuristicLab.Common; using HEAL.Attic; namespace HeuristicLab.Problems.MetaOptimization { [StorableType("D5AB5F97-8D08-4BE4-AB71-BA670EA26B6D")] public class ConstrainedItemList : ItemList where T : class, IItem { [Storable] private Type type; public Type Type { get { return type; } set { if (type != value) { type = value; this.RemoveAll(x => x.GetType() != type); } } } public ConstrainedItemList() { Type = typeof(T); } [StorableConstructor] protected ConstrainedItemList(StorableConstructorFlag _) : base(_) { } protected ConstrainedItemList(ConstrainedItemList original, Cloner cloner) : base(original, cloner) { this.Type = original.Type; } public override IDeepCloneable Clone(Cloner cloner) { return new ConstrainedItemList(this, cloner); } } }