Free cookie consent management tool by TermsFeed Policy Generator

Changeset 89 for trunk/sources


Ignore:
Timestamp:
03/22/08 10:52:14 (17 years ago)
Author:
gkronber
Message:

Moved abstract operator DelegatingOperator from StructureIdentification to Operators. And removed code duplication.
See ticket #55.

Location:
trunk/sources
Files:
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Operators/CombinedOperator.cs

    r82 r89  
    2828
    2929namespace HeuristicLab.Operators {
    30   public class CombinedOperator : OperatorBase {
     30  public class CombinedOperator : DelegatingOperator {
    3131    private string myDescription;
    3232    public override string Description {
     
    6262      clone.myOperatorGraph = (IOperatorGraph)Auxiliary.Clone(OperatorGraph, clonedObjects);
    6363      return clone;
    64     }
    65 
    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(), new NullData()));
    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       }
    9564    }
    9665
  • trunk/sources/HeuristicLab.Operators/DelegatingOperator.cs

    r88 r89  
    11using System;
    22using System.Collections.Generic;
    3 using System.Linq;
    43using System.Text;
    54using HeuristicLab.Core;
    65using HeuristicLab.Data;
    76
    8 namespace HeuristicLab.StructureIdentification {
     7namespace HeuristicLab.Operators {
    98  public abstract class DelegatingOperator : OperatorBase {
    109    public override IOperation Execute(IScope scope) {
    1110      myCanceled = false;
    1211
    13       // copied from CombinedOperator (gkronber 22.3.08)
    1412      if(scope.GetVariable(Guid.ToString()) == null) { // contained operator not yet executed
    1513        // add marker
  • trunk/sources/HeuristicLab.Operators/HeuristicLab.Operators.csproj

    r51 r89  
    6464      <SubType>Code</SubType>
    6565    </Compile>
     66    <Compile Include="DelegatingOperator.cs" />
    6667    <Compile Include="StochasticMultiBranch.cs" />
    6768    <Compile Include="SubScopesMixer.cs" />
  • trunk/sources/HeuristicLab.StructureIdentification/HeuristicLab.StructureIdentification.csproj

    r88 r89  
    4848  </ItemGroup>
    4949  <ItemGroup>
    50     <Compile Include="DelegatingOperator.cs" />
    5150    <Compile Include="Evaluation\CoefficientOfDeterminationEvaluator.cs" />
    5251    <Compile Include="Evaluation\FunctionEvaluator.cs">
Note: See TracChangeset for help on using the changeset viewer.