using System; using System.Collections.Generic; using System.Linq; using System.Text; using HeuristicLab.Core; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; using HeuristicLab.Common; namespace HeuristicLab.Problems.MetaOptimization { [StorableClass] 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(bool deserializing) : base(deserializing) { } protected ConstrainedItemList(ConstrainedItemList original, Cloner cloner) : base(original, cloner) { this.Type = original.Type; } public override IDeepCloneable Clone(Cloner cloner) { return new ConstrainedItemList(this, cloner); } } }