Last change
on this file since 12448 was
5110,
checked in by cneumuel, 14 years ago
|
#1215
- optional parameter values now can be null
- problem type can now be set specifically
- values are constrained to the encoding of the Problem
- moved repetitions parameter to MetaOptimizationProblem
|
File size:
1.0 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 |
|
---|
9 | namespace HeuristicLab.Problems.MetaOptimization {
|
---|
10 | [StorableClass]
|
---|
11 | public class ConstrainedItemList<T> : ItemList<T> where T : class, IItem {
|
---|
12 | [Storable]
|
---|
13 | private Type type;
|
---|
14 | public Type Type {
|
---|
15 | get { return type; }
|
---|
16 | set {
|
---|
17 | if (type != value) {
|
---|
18 | type = value;
|
---|
19 | this.RemoveAll(x => x.GetType() != type);
|
---|
20 | }
|
---|
21 | }
|
---|
22 | }
|
---|
23 |
|
---|
24 | public ConstrainedItemList() {
|
---|
25 | Type = typeof(T);
|
---|
26 | }
|
---|
27 | [StorableConstructor]
|
---|
28 | protected ConstrainedItemList(bool deserializing) : base(deserializing) { }
|
---|
29 | protected ConstrainedItemList(ConstrainedItemList<T> original, Cloner cloner)
|
---|
30 | : base(original, cloner) {
|
---|
31 | this.Type = original.Type;
|
---|
32 | }
|
---|
33 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
34 | return new ConstrainedItemList<T>(this, cloner);
|
---|
35 | }
|
---|
36 | }
|
---|
37 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.