Free cookie consent management tool by TermsFeed Policy Generator

Changeset 76


Ignore:
Timestamp:
03/18/08 15:56:41 (17 years ago)
Author:
swagner
Message:

Fixed ticket #68

  • removed aliases again after an operator has been executed
Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/OperatorBase.cs

    r61 r76  
    4141    }
    4242
    43     private bool myCanceled;
     43    protected bool myCanceled;
    4444    public bool Canceled {
    4545      get { return myCanceled; }
     
    372372
    373373      IOperation next = Apply(scope);
     374
     375      foreach (IVariableInfo variableInfo in VariableInfos)
     376        scope.RemoveAlias(variableInfo.FormalName);
     377
    374378      OnExecuted();
    375379      return next;
  • trunk/sources/HeuristicLab.Operators/CombinedOperator.cs

    r61 r76  
    6464    }
    6565
     66    public override IOperation Execute(IScope scope) {
     67      myCanceled = false;
     68
     69      if (scope.GetVariable(Guid.ToString()) == null) { // contained operator not yet executed
     70        // add marker
     71        scope.AddVariable(new Variable(Guid.ToString(), null));
     72
     73        // add aliases
     74        foreach (IVariableInfo variableInfo in VariableInfos)
     75          scope.AddAlias(variableInfo.FormalName, variableInfo.ActualName);
     76
     77        CompositeOperation next = new CompositeOperation();
     78        next.AddOperation(Apply(scope));
     79        // execute combined operator again after contained operators have been executed
     80        next.AddOperation(new AtomicOperation(this, scope));
     81
     82        OnExecuted();
     83        return next;
     84      } else {  // contained operator already executed
     85        // remove marker
     86        scope.RemoveVariable(Guid.ToString());
     87
     88        // remove aliases
     89        foreach (IVariableInfo variableInfo in VariableInfos)
     90          scope.RemoveAlias(variableInfo.FormalName);
     91
     92        OnExecuted();
     93        return null;
     94      }
     95    }
     96
    6697    public override IOperation Apply(IScope scope) {
    6798      if (OperatorGraph.InitialOperator != null) {
Note: See TracChangeset for help on using the changeset viewer.