Changeset 6938 for trunk/sources/HeuristicLab.Optimization/3.3/Problems
- Timestamp:
- 10/26/11 23:36:10 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization/3.3/Problems/Problem.cs
r5954 r6938 26 26 using HeuristicLab.Common; 27 27 using HeuristicLab.Core; 28 using HeuristicLab.Parameters; 28 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 30 … … 32 33 [StorableClass] 33 34 public abstract class Problem : ParameterizedNamedItem, IProblem { 35 private static readonly string OperatorsParameterName = "Operators"; 36 37 public IFixedValueParameter<OperatorCollection> OperatorsParameter { 38 get { return (IFixedValueParameter<OperatorCollection>)Parameters[OperatorsParameterName]; } 39 } 40 34 41 public override Image ItemImage { 35 42 get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; } … … 37 44 38 45 [StorableConstructor] 39 protected Problem(bool deserializing) : base(deserializing) { } 46 protected Problem(bool deserializing) 47 : base(deserializing) { 48 operators = new OperatorCollection(); // operators must never be null 49 } 40 50 protected Problem(Problem original, Cloner cloner) 41 51 : base(original, cloner) { … … 47 57 : base() { 48 58 operators = new OperatorCollection(); 59 Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", operators, false)); 60 OperatorsParameter.Hidden = true; 49 61 RegisterEventHandlers(); 50 62 } … … 52 64 [StorableHook(HookType.AfterDeserialization)] 53 65 private void AfterDeserialization() { 66 // BackwardsCompatibility3.3 67 #region Backwards compatible code, remove with 3.4 68 if (!Parameters.ContainsKey(OperatorsParameterName)) { 69 Parameters.Add(new FixedValueParameter<OperatorCollection>(OperatorsParameterName, "The operators that the problem provides to the algorithms.", operators, false)); 70 OperatorsParameter.Hidden = true; 71 } 72 #endregion 54 73 RegisterEventHandlers(); 55 74 }
Note: See TracChangeset
for help on using the changeset viewer.