Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/25/10 01:04:14 (14 years ago)
Author:
abeham
Message:

#1090

  • Fixed initialization of operators and made operator list storable
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.3/ArtificialAntProblem.cs

    r4068 r4098  
    4242  [StorableClass]
    4343  public sealed class ArtificialAntProblem : ParameterizedNamedItem, ISingleObjectiveProblem {
     44
    4445    public override Image ItemImage {
    4546      get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Type; }
     
    180181      get { return BestKnownQualityParameter.Value; }
    181182    }
    182     private List<IOperator> operators;
    183183    public IEnumerable<IOperator> Operators {
    184184      get { return operators; }
     
    190190    #endregion
    191191
     192    [Storable]
     193    private List<IOperator> operators;
     194
     195    [StorableConstructor]
     196    private ArtificialAntProblem(bool deserializing) : base() { }
    192197    public ArtificialAntProblem()
    193198      : base() {
     
    212217      ParameterizeSolutionCreator();
    213218      ParameterizeEvaluator();
    214       Initialize();
    215     }
    216 
    217     [StorableConstructor]
    218     private ArtificialAntProblem(bool deserializing) : base() { }
     219      InitializeOperators();
     220      AttachEventHandlers();
     221    }
    219222
    220223    public override IDeepCloneable Clone(Cloner cloner) {
    221224      ArtificialAntProblem clone = (ArtificialAntProblem)base.Clone(cloner);
    222       clone.Initialize();
     225      clone.operators = operators.Select(x => (IOperator)cloner.Clone(x)).ToList();
     226      clone.AttachEventHandlers();
    223227      return clone;
    224228    }
     
    274278    #region Helpers
    275279    [StorableHook(HookType.AfterDeserialization)]
    276     private void Initialize() {
    277       InitializeOperators();
     280    private void AttachEventHandlers() {
     281      // Start BackwardsCompatibility3.3 (remove with 3.4)
     282      if (operators == null) InitializeOperators();
     283      // End BackwardsCompatibility3.3
    278284      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
    279285      SolutionCreator.SymbolicExpressionTreeParameter.ActualNameChanged += new EventHandler(SolutionCreator_SymbolicExpressionTreeParameter_ActualNameChanged);
Note: See TracChangeset for help on using the changeset viewer.