Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/06/10 01:56:04 (13 years ago)
Author:
swagner
Message:

Merged cloning refactoring branch back into trunk (#922)

Location:
trunk/sources
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Selection/3.3/BestSelector.cs

    r4477 r4722  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    3536  public sealed class BestSelector : SingleObjectiveSelector, ISingleObjectiveSelector {
    3637    public BestSelector() : base() { }
     38    [StorableConstructor]
     39    private BestSelector(bool deserializing) : base(deserializing) { }
     40    private BestSelector(BestSelector original, Cloner cloner)
     41      : base(original, cloner) {
     42    }
     43    public override IDeepCloneable Clone(Cloner cloner) {
     44      return new BestSelector(this, cloner);
     45    }
     46
    3747
    3848    protected override IScope[] Select(List<IScope> scopes) {
  • trunk/sources/HeuristicLab.Selection/3.3/ConditionalSelector.cs

    r4477 r4722  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    4243    }
    4344
     45    [StorableConstructor]
     46    protected ConditionalSelector(bool deserializing) : base(deserializing) { }
     47    protected ConditionalSelector(ConditionalSelector original, Cloner cloner)
     48      : base(original, cloner) {
     49    }
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new ConditionalSelector(this, cloner);
     52    }
    4453    public ConditionalSelector()
    4554      : base() {
  • trunk/sources/HeuristicLab.Selection/3.3/GenderSpecificSelector.cs

    r4068 r4722  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    8081
    8182    [StorableConstructor]
    82     private GenderSpecificSelector(bool deserializing) : base() { }
     83    protected GenderSpecificSelector(bool deserializing) : base(deserializing) { }
     84    protected GenderSpecificSelector(GenderSpecificSelector original, Cloner cloner)
     85      : base(original, cloner) {
     86      Initialize();
     87    }
     88
    8389    public GenderSpecificSelector()
    8490      : base() {
     
    120126    }
    121127
     128    public override IDeepCloneable Clone(Cloner cloner) {
     129      return new GenderSpecificSelector(this, cloner);
     130    }
     131
     132    [StorableHook(HookType.AfterDeserialization)]
     133    private void AfterDeserialization() {
     134      Initialize();
     135    }
     136
    122137    /// <summary>
    123138    /// Sets how many sub-scopes male and female selectors should select.
     
    142157
    143158    #region Helpers
    144     [StorableHook(HookType.AfterDeserialization)]
    145159    private void Initialize() {
    146160      FemaleSelectorParameter.ValueChanged += new EventHandler(SelectorParameter_ValueChanged);
  • trunk/sources/HeuristicLab.Selection/3.3/LeftReducer.cs

    r4477 r4722  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Optimization;
     
    3233  [StorableClass]
    3334  public sealed class LeftReducer : Reducer, IReducer {
     35    [StorableConstructor]
     36    private LeftReducer(bool deserializing) : base(deserializing) { }
     37    private LeftReducer(LeftReducer original, Cloner cloner) : base(original, cloner) { }
     38    public override IDeepCloneable Clone(Cloner cloner) {
     39      return new LeftReducer(this, cloner);
     40    }
    3441    public LeftReducer() : base() { }
    3542
  • trunk/sources/HeuristicLab.Selection/3.3/LeftSelector.cs

    r4477 r4722  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    4344      get { return CopySelectedParameter.Value; }
    4445      set { CopySelectedParameter.Value = value; }
     46    }
     47
     48    [StorableConstructor]
     49    private LeftSelector(bool deserializing) : base(deserializing) { }
     50    private LeftSelector(LeftSelector original, Cloner cloner)
     51      : base(original, cloner) {
     52    }
     53    public override IDeepCloneable Clone(Cloner cloner) {
     54      return new LeftSelector(this, cloner);
    4555    }
    4656
  • trunk/sources/HeuristicLab.Selection/3.3/LinearRankSelector.cs

    r4477 r4722  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    3435  [StorableClass]
    3536  public sealed class LinearRankSelector : StochasticSingleObjectiveSelector, ISingleObjectiveSelector {
     37    [StorableConstructor]
     38    private LinearRankSelector(bool deserializing) : base(deserializing) { }
     39    private LinearRankSelector(LinearRankSelector original, Cloner cloner)
     40      : base(original, cloner) {
     41    }
     42    public override IDeepCloneable Clone(Cloner cloner) {
     43      return new LinearRankSelector(this, cloner);
     44    }
    3645    public LinearRankSelector() : base() { }
    3746
  • trunk/sources/HeuristicLab.Selection/3.3/MergingReducer.cs

    r4477 r4722  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Optimization;
     
    3233  [StorableClass]
    3334  public sealed class MergingReducer : Reducer, IReducer {
     35    [StorableConstructor]
     36    private MergingReducer(bool deserializing) : base(deserializing) { }
     37    private MergingReducer(MergingReducer original, Cloner cloner)
     38      : base(original, cloner) {
     39    }
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new MergingReducer(this, cloner);
     42    }
    3443    public MergingReducer() : base() { }
    3544
  • trunk/sources/HeuristicLab.Selection/3.3/OffspringSelector.cs

    r4489 r4722  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    3132  [StorableClass]
    3233  public class OffspringSelector : SingleSuccessorOperator {
    33 
    3434    public ValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter {
    3535      get { return (ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; }
     
    6262    }
    6363
     64    [StorableConstructor]
     65    protected OffspringSelector(bool deserializing) : base(deserializing) { }
     66    protected OffspringSelector(OffspringSelector original, Cloner cloner) : base(original, cloner) { }
     67    public override IDeepCloneable Clone(Cloner cloner) {
     68      return new OffspringSelector(this, cloner);
     69    }
    6470    public OffspringSelector()
    6571      : base() {
  • trunk/sources/HeuristicLab.Selection/3.3/ProportionalSelector.cs

    r4477 r4722  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Data;
     
    4546    }
    4647
     48    [StorableConstructor]
     49    private ProportionalSelector(bool deserializing) : base(deserializing) { }
     50    private ProportionalSelector(ProportionalSelector original, Cloner cloner)
     51      : base(original, cloner) {
     52    }
     53    public override IDeepCloneable Clone(Cloner cloner) {
     54      return new ProportionalSelector(this, cloner);
     55    }
    4756    public ProportionalSelector()
    4857      : base() {
  • trunk/sources/HeuristicLab.Selection/3.3/RandomReplacer.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    4950    [StorableConstructor]
    5051    private RandomReplacer(bool deserializing) : base(deserializing) { }
     52    private RandomReplacer(RandomReplacer original, Cloner cloner)
     53      : base(original, cloner) {
     54    }
     55    public override IDeepCloneable Clone(Cloner cloner) {
     56      return new RandomReplacer(this, cloner);
     57    }
    5158    public RandomReplacer()
    5259      : base() {
  • trunk/sources/HeuristicLab.Selection/3.3/RandomSelector.cs

    r4477 r4722  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    4647    }
    4748
     49    [StorableConstructor]
     50    private RandomSelector(bool deserializing) : base(deserializing) { }
     51    private RandomSelector(RandomSelector original, Cloner cloner)
     52      : base(original, cloner) {
     53    }
     54    public override IDeepCloneable Clone(Cloner cloner) {
     55      return new RandomSelector(this, cloner);
     56    }
    4857    public RandomSelector()
    4958      : base() {
  • trunk/sources/HeuristicLab.Selection/3.3/Reducer.cs

    r4068 r4722  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Operators;
     
    4142    }
    4243
     44    [StorableConstructor]
     45    protected Reducer(bool deserializing) : base(deserializing) { }
     46    protected Reducer(Reducer original, Cloner cloner)
     47      : base(original, cloner) {
     48    }
    4349    protected Reducer()
    4450      : base() {
  • trunk/sources/HeuristicLab.Selection/3.3/Replacer.cs

    r3601 r4722  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    4041
    4142    [StorableConstructor]
    42     protected Replacer(bool deserializing) : base() { }
     43    protected Replacer(bool deserializing) : base(deserializing) { }
     44    protected Replacer(Replacer original, Cloner cloner) : base(original, cloner) { }
     45    public override IDeepCloneable Clone(Cloner cloner) {
     46      return new Replacer(this, cloner);
     47    }
    4348    public Replacer() {
    4449      Parameters.Add(new ValueLookupParameter<ISelector>("ReplacedSelector", "The selection operator to select those scopes that are to be replaced."));
     
    7479      int remaining = ExecutionContext.Scope.SubScopes[0].SubScopes.Count;
    7580      int selected = ExecutionContext.Scope.SubScopes[1].SubScopes.Count;
    76      
     81
    7782      ISelector replacedSelector = ReplacedSelectorParameter.ActualValue;
    7883      ISelector selectedSelector = SelectedSelectorParameter.ActualValue;
    79      
     84
    8085      if (replacedSelector != null) {
    8186        replacedSelector.CopySelected = new BoolValue(false);
  • trunk/sources/HeuristicLab.Selection/3.3/RightChildReducer.cs

    r4489 r4722  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Optimization;
     
    4243  [StorableClass]
    4344  public class RightChildReducer : Reducer, IReducer {
     45    [StorableConstructor]
     46    protected RightChildReducer(bool deserializing) : base(deserializing) { }
     47    protected RightChildReducer(RightChildReducer original, Cloner cloner) : base(original, cloner) { }
     48    public override IDeepCloneable Clone(Cloner cloner) {
     49      return new RightChildReducer(this, cloner);
     50    }
     51    public RightChildReducer() : base() { }
    4452    /// <summary>
    4553    ///  Reduces the sub-scopes, so that the selected sub-scope contains all selected leaves
  • trunk/sources/HeuristicLab.Selection/3.3/RightReducer.cs

    r4477 r4722  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Optimization;
     
    3233  [StorableClass]
    3334  public sealed class RightReducer : Reducer, IReducer {
     35    [StorableConstructor]
     36    private RightReducer(bool deserializing) : base(deserializing) { }
     37    private RightReducer(RightReducer original, Cloner cloner) : base(original, cloner) { }
     38    public override IDeepCloneable Clone(Cloner cloner) {
     39      return new RightReducer(this, cloner);
     40    }
    3441    public RightReducer() : base() { }
    3542
  • trunk/sources/HeuristicLab.Selection/3.3/RightSelector.cs

    r4477 r4722  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    4445      set { CopySelectedParameter.Value = value; }
    4546    }
     47    [StorableConstructor]
     48    private RightSelector(bool deserializing) : base(deserializing) { }
     49    private RightSelector(RightSelector original, Cloner cloner) : base(original, cloner) { }
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new RightSelector(this, cloner);
     52    }
     53
    4654    public RightSelector()
    4755      : base() {
  • trunk/sources/HeuristicLab.Selection/3.3/Selector.cs

    r4068 r4722  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Operators;
     
    4344      get { return CurrentScopeParameter.ActualValue; }
    4445    }
     46
     47    [StorableConstructor]
     48    protected Selector(bool deserializing) : base(deserializing) { }
     49    protected Selector(Selector original, Cloner cloner) : base(original, cloner) { }
    4550
    4651    protected Selector()
  • trunk/sources/HeuristicLab.Selection/3.3/SingleObjectiveSelector.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    5051    }
    5152
     53    [StorableConstructor]
     54    protected SingleObjectiveSelector(bool deserializing) : base(deserializing) { }
     55    protected SingleObjectiveSelector(SingleObjectiveSelector original, Cloner cloner) : base(original, cloner) { }
     56
    5257    protected SingleObjectiveSelector()
    5358      : base() {
  • trunk/sources/HeuristicLab.Selection/3.3/StochasticSelector.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Optimization;
     
    3637    }
    3738
     39    [StorableConstructor]
     40    protected StochasticSelector(bool deserializing) : base(deserializing) { }
     41    protected StochasticSelector(StochasticSelector original, Cloner cloner) : base(original, cloner) { }
    3842    protected StochasticSelector()
    3943      : base() {
  • trunk/sources/HeuristicLab.Selection/3.3/StochasticSingleObjectiveSelector.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Optimization;
     
    3536      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
    3637    }
    37 
     38    [StorableConstructor]
     39    protected StochasticSingleObjectiveSelector(bool deserializing) : base(deserializing) { }
     40    protected StochasticSingleObjectiveSelector(StochasticSingleObjectiveSelector original, Cloner cloner) : base(original, cloner) { }
    3841    protected StochasticSingleObjectiveSelector()
    3942      : base() {
  • trunk/sources/HeuristicLab.Selection/3.3/TournamentSelector.cs

    r4477 r4722  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    3738    public ValueLookupParameter<IntValue> GroupSizeParameter {
    3839      get { return (ValueLookupParameter<IntValue>)Parameters["GroupSize"]; }
     40    }
     41
     42    [StorableConstructor]
     43    private TournamentSelector(bool deserializing) : base(deserializing) { }
     44    private TournamentSelector(TournamentSelector original, Cloner cloner) : base(original, cloner) { }
     45    public override IDeepCloneable Clone(Cloner cloner) {
     46      return new TournamentSelector(this, cloner);
    3947    }
    4048
  • trunk/sources/HeuristicLab.Selection/3.3/WorstReplacer.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    4647    [StorableConstructor]
    4748    private WorstReplacer(bool deserializing) : base(deserializing) { }
     49    private WorstReplacer(WorstReplacer original, Cloner cloner) : base(original, cloner) { }
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new WorstReplacer(this, cloner);
     52    }
    4853    public WorstReplacer()
    4954      : base() {
  • trunk/sources/HeuristicLab.Selection/3.3/WorstSelector.cs

    r4477 r4722  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    3435  [StorableClass]
    3536  public sealed class WorstSelector : SingleObjectiveSelector, ISingleObjectiveSelector {
     37    [StorableConstructor]
     38    private WorstSelector(bool deserializing) : base(deserializing) { }
     39    private WorstSelector(WorstSelector original, Cloner cloner) : base(original, cloner) { }
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new WorstSelector(this, cloner);
     42    }
    3643    public WorstSelector() : base() { }
    3744
Note: See TracChangeset for help on using the changeset viewer.