Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/26/10 03:51:30 (14 years ago)
Author:
swagner
Message:

Removed property ExecutionContext in Operator (#1333)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ParallelEngine/HeuristicLab.Operators/3.3/Operator.cs

    r4722 r5177  
    2828namespace HeuristicLab.Operators {
    2929  /// <summary>
    30   /// The base class for all operators.
     30  /// Base class for operators.
    3131  /// </summary>
    3232  [Item("Operator", "Base class for operators.")]
     
    4343    }
    4444
    45     [Storable]
    46     private IExecutionContext executionContext;
    47     protected IExecutionContext ExecutionContext {
    48       get { return executionContext; }
    49       private set {
    50         if (value != executionContext) {
    51           executionContext = value;
    52           OnExecutionContextChanged();
    53         }
    54       }
    55     }
    56 
    57     /// <summary>
    58     /// Flag whether the current instance has been canceled.
    59     /// </summary>
    6045    private bool canceled;
    61     /// <inheritdoc/>
    6246    protected bool Canceled {
    6347      get { return canceled; }
     
    7256    [Storable]
    7357    private bool breakpoint;
    74     /// <inheritdoc/>
    75     /// <remarks>Calls <see cref="OnBreakpointChanged"/> in the setter.</remarks>
    7658    public bool Breakpoint {
    7759      get { return breakpoint; }
     
    9173      this.canceled = original.canceled;
    9274      this.breakpoint = original.breakpoint;
    93       this.executionContext = cloner.Clone<IExecutionContext>(original.executionContext);
    9475    }
    95     /// <summary>
    96     /// Initializes a new instance of <see cref="OperatorBase"/> setting the breakpoint flag and
    97     /// the canceled flag to <c>false</c> and the name of the operator to the type name.
    98     /// </summary>
    9976    protected Operator()
    10077      : base() {
     
    123100    }
    124101
    125     /// <inheritdoc/>
    126102    public virtual IOperation Execute(IExecutionContext context) {
    127103      try {
    128104        Canceled = false;
    129         ExecutionContext = context;
    130105        foreach (IParameter param in Parameters)
    131106          param.ExecutionContext = context;
    132         IOperation next = Apply();
     107        IOperation next = Apply(context);
    133108        OnExecuted();
    134109        return next;
     
    137112        foreach (IParameter param in Parameters)
    138113          param.ExecutionContext = null;
    139         ExecutionContext = null;
    140114      }
    141115    }
    142     /// <inheritdoc/>
    143     /// <remarks>Sets property <see cref="Canceled"/> to <c>true</c>.</remarks>
    144116    public void Abort() {
    145117      Canceled = true;
    146118    }
    147     /// <summary>
    148     /// Performs the current operator on the specified <paramref name="scope"/>.
    149     /// </summary>
    150     /// <param name="scope">The scope where to execute the operator</param>
    151     /// <returns><c>null</c>.</returns>
    152     public abstract IOperation Apply();
     119    public abstract IOperation Apply(IExecutionContext context);
    153120
    154     protected virtual void OnExecutionContextChanged() { }
    155121    protected virtual void OnCanceledChanged() { }
    156     /// <inheritdoc/>
    157122    public event EventHandler BreakpointChanged;
    158     /// <summary>
    159     /// Fires a new <c>BreakpointChanged</c> event.
    160     /// </summary>
    161123    protected virtual void OnBreakpointChanged() {
    162124      if (BreakpointChanged != null) {
     
    164126      }
    165127    }
    166     /// <inheritdoc/>
    167128    public event EventHandler Executed;
    168     /// <summary>
    169     /// Fires a new <c>Executed</c> event.
    170     /// </summary>
    171129    protected virtual void OnExecuted() {
    172130      if (Executed != null) {
Note: See TracChangeset for help on using the changeset viewer.