Last change
on this file since 16574 was
16574,
checked in by gkronber, 5 years ago
|
#2520: changed HeuristicLab.MetaOptimization addon to compile with new HL.Persistence
|
File size:
1.1 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using HeuristicLab.Core;
|
---|
6 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
7 | using HeuristicLab.Common;
|
---|
8 | using HEAL.Attic;
|
---|
9 |
|
---|
10 | namespace HeuristicLab.Problems.MetaOptimization {
|
---|
11 | [StorableType("D5AB5F97-8D08-4BE4-AB71-BA670EA26B6D")]
|
---|
12 | public class ConstrainedItemList<T> : ItemList<T> where T : class, IItem {
|
---|
13 | [Storable]
|
---|
14 | private Type type;
|
---|
15 | public Type Type {
|
---|
16 | get { return type; }
|
---|
17 | set {
|
---|
18 | if (type != value) {
|
---|
19 | type = value;
|
---|
20 | this.RemoveAll(x => x.GetType() != type);
|
---|
21 | }
|
---|
22 | }
|
---|
23 | }
|
---|
24 |
|
---|
25 | public ConstrainedItemList() {
|
---|
26 | Type = typeof(T);
|
---|
27 | }
|
---|
28 | [StorableConstructor]
|
---|
29 | protected ConstrainedItemList(StorableConstructorFlag _) : base(_) { }
|
---|
30 | protected ConstrainedItemList(ConstrainedItemList<T> original, Cloner cloner)
|
---|
31 | : base(original, cloner) {
|
---|
32 | this.Type = original.Type;
|
---|
33 | }
|
---|
34 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
35 | return new ConstrainedItemList<T>(this, cloner);
|
---|
36 | }
|
---|
37 | }
|
---|
38 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.