Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/08/13 10:10:07 (10 years ago)
Author:
ascheibe
Message:

#1886 some improvements in the RunCollectionModifierExecutable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/RunCollectionModifiers/RunCollectionModifierExecutable.cs

    r10114 r10115  
    6262      get { return (ValueParameter<ItemList<IRunCollectionModifier>>)Parameters["RunCollectionModifiers"]; }
    6363    }
     64    public RunCollection RunCollection {
     65      get { return RunCollectionParameter.Value; }
     66      protected set { RunCollectionParameter.Value = value; }
     67    }
     68    public ValueParameter<RunCollection> RunCollectionParameter {
     69      get { return (ValueParameter<RunCollection>)Parameters["RunCollection"]; }
     70    }
    6471    public ItemList<IRunCollectionModifier> RunCollectionModifiers {
    6572      get { return RunCollectionModifiersParameter.Value; }
    66     }
    67 
    68     [Storable]
    69     protected RunCollection runCollection;
    70     public RunCollection RunCollection {
    71       get { return runCollection; }
    7273    }
    7374
     
    9091    public RunCollectionModifierExecutable() {
    9192      Parameters.Add(new ValueParameter<ItemList<IRunCollectionModifier>>("RunCollectionModifiers", "List of RunCollectionModifiers that are executed. ", new ItemList<IRunCollectionModifier>()));
     93      Parameters.Add(new ValueParameter<RunCollection>("RunCollection", "RunCollection on which the modifiers are applied. ", new RunCollection()));
    9294      executionStack = new Stack<IRunCollectionModifier>();
    93       runCollection = new RunCollection();
    9495      log = new Log();
    9596    }
     
    100101      executionTime = original.executionTime;
    101102      executionState = original.executionState;
    102       runCollection = (RunCollection)original.runCollection.Clone(cloner);
    103103      executionStack = new Stack<IRunCollectionModifier>();
    104104      foreach (var runCollectionModifier in original.executionStack) {
     
    165165      CancellationToken ct = (CancellationToken)state;
    166166      OnStarted();
     167      var runs = RunCollection.ToList();
    167168
    168169      IRunCollectionModifier next;
     
    171172        try {
    172173          ct.ThrowIfCancellationRequested();
    173           next.Modify(runCollection.ToList());
     174          next.Modify(runs);
    174175        }
    175176        catch (Exception ex) {
     
    177178          if (ex is OperationCanceledException) throw ex;
    178179          else throw new Exception("IRunCollectionModifier " + next + "threw an exception.", ex);
     180        }
     181        finally {
     182          RunCollection = new RunCollection(runs);
    179183        }
    180184      }
Note: See TracChangeset for help on using the changeset viewer.