Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/03/11 11:04:02 (13 years ago)
Author:
cneumuel
Message:

#1424

  • created extension method GetObjectGraphObjects for objects
  • created IStatefulItem interface, which means an object has a state which can be initialized and cleared
  • after an algorithm stopped, all objects of the algorithm-objectgraph with the type IStatefulItem are cleared
  • on prepare, all IStatefulItem objects are initialized
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs

    r5954 r6103  
    261261    protected virtual void OnPrepared() {
    262262      ExecutionTime = TimeSpan.Zero;
     263      foreach (IStatefulItem statefulObject in this.GetObjectGraphObjects().OfType<IStatefulItem>()) {
     264        statefulObject.InitializeState();
     265      }
    263266      ExecutionState = ExecutionState.Prepared;
    264267      EventHandler handler = Prepared;
     
    280283    protected virtual void OnStopped() {
    281284      ExecutionState = ExecutionState.Stopped;
     285      foreach (IStatefulItem statefulObject in this.GetObjectGraphObjects().OfType<IStatefulItem>()) {
     286        statefulObject.ClearState();
     287      }
    282288      runsCounter++;
    283289      runs.Add(new Run(string.Format("{0} Run {1}", Name, runsCounter), this));
Note: See TracChangeset for help on using the changeset viewer.