Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/08/10 03:43:36 (14 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on parameters and operators
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Operators/3.3/ParallelProcessor.cs

    r1530 r2757  
    2323using System.Collections.Generic;
    2424using System.Text;
     25using System.Xml;
     26using HeuristicLab.Collections;
    2527using HeuristicLab.Core;
    2628using HeuristicLab.Data;
     29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2730
    2831namespace HeuristicLab.Operators {
    2932  /// <summary>
    30   /// Performs <c>n</c> operators on the given scope; operations can be executed in parallel.
     33  /// Operator which executes multiple operators in parallel.
    3134  /// </summary>
    32   public class ParallelProcessor : OperatorBase {
    33     /// <inheritdoc select="summary"/>
    34     public override string Description {
    35       get { return @"TODO\r\nOperator description still missing ..."; }
     35  [Item("ParallelProcessor", "An operator which executes multiple operators in parallel.")]
     36  [Creatable("Test")]
     37  [EmptyStorableClass]
     38  public sealed class ParallelProcessor : MultipleSuccessorsOperator {
     39    public ParallelProcessor()
     40      : base() {
    3641    }
    3742
    38     /// <summary>
    39     /// Applies <c>n</c> operators on the given <paramref name="scope"/>.
    40     /// </summary>
    41     /// <param name="scope">The scope to apply the operators on.</param>
    42     /// <returns>A new <see cref="CompositeOperation"/> with the <c>n</c> operators applied
    43     /// to the given <paramref name="scope"/> with the <c>ExecuteInParallel</c> set to <c>true</c>.</returns>
    44     public override IOperation Apply(IScope scope) {
    45       CompositeOperation next = new CompositeOperation();
    46       next.ExecuteInParallel = true;
    47       for (int i = 0; i < SubOperators.Count; i++)
    48         next.AddOperation(new AtomicOperation(SubOperators[i], scope));
     43    public override IExecutionContext Apply() {
     44      ExecutionContextCollection next = new ExecutionContextCollection();
     45      for (int i = 0; i < Successors.Count; i++) {
     46        if (Successors[i] != null)
     47          next.Add(new ExecutionContext(ExecutionContext.Parent, Successors[i], ExecutionContext.Scope));
     48      }
     49      next.Parallel = true;
    4950      return next;
    5051    }
Note: See TracChangeset for help on using the changeset viewer.