- Timestamp:
- 02/08/10 03:43:36 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Operators/3.3/ParallelProcessor.cs
r1530 r2757 23 23 using System.Collections.Generic; 24 24 using System.Text; 25 using System.Xml; 26 using HeuristicLab.Collections; 25 27 using HeuristicLab.Core; 26 28 using HeuristicLab.Data; 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 30 28 31 namespace HeuristicLab.Operators { 29 32 /// <summary> 30 /// Performs <c>n</c> operators on the given scope; operations can be executedin parallel.33 /// Operator which executes multiple operators in parallel. 31 34 /// </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() { 36 41 } 37 42 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; 49 50 return next; 50 51 }
Note: See TracChangeset
for help on using the changeset viewer.