Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/29/10 16:58:29 (14 years ago)
Author:
mkommend
Message:

Refactored Optimization (ticket #922).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Optimization/3.3/Experiment.cs

    r4551 r4665  
    128128      stopPending = false;
    129129    }
    130 
    131130    [StorableHook(HookType.AfterDeserialization)]
     131    private void AfterDeserialization() {
     132      Initialize();
     133    }
     134    protected Experiment(Experiment original, Cloner cloner)
     135      : base(original, cloner) {
     136      executionState = original.executionState;
     137      executionTime = original.executionTime;
     138      optimizers = cloner.Clone(original.optimizers);
     139      runs = cloner.Clone(original.runs);
     140      stopPending = original.stopPending;
     141      Initialize();
     142    }
     143    public override IDeepCloneable Clone(Cloner cloner) {
     144      if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));
     145      return new Experiment(this, cloner);
     146    }
     147
    132148    private void Initialize() {
    133149      RegisterOptimizersEvents();
     
    135151        RegisterOptimizerEvents(optimizer);
    136152      if (runs != null) RegisterRunsEvents();
    137     }
    138 
    139     public override IDeepCloneable Clone(Cloner cloner) {
    140       if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));
    141       Experiment clone = (Experiment)base.Clone(cloner);
    142       clone.executionState = executionState;
    143       clone.executionTime = executionTime;
    144       clone.optimizers = (OptimizerList)cloner.Clone(optimizers);
    145       clone.runs = (RunCollection)cloner.Clone(runs);
    146       clone.stopPending = stopPending;
    147       clone.Initialize();
    148       return clone;
    149153    }
    150154
Note: See TracChangeset for help on using the changeset viewer.