Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/23/10 01:31:17 (15 years ago)
Author:
swagner
Message:

Unified *SequentialSubScopesProcessor and *ParallelSubScopesProcessor (#943).

File:
1 moved

Legend:

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

    r3186 r3193  
    2121
    2222using HeuristicLab.Core;
     23using HeuristicLab.Data;
    2324using HeuristicLab.Parameters;
    2425using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    2627namespace HeuristicLab.Operators {
    2728  /// <summary>
    28   /// An operator which applies a specified operator sequentially on all sub-scopes of the current scope.
     29  /// An operator which applies a specified operator on all sub-scopes of the current scope.
    2930  /// </summary>
    30   [Item("UniformSequentialSubScopesProcessor", "An operator which applies a specified operator sequentially on all sub-scopes of the current scope.")]
     31  [Item("UniformSubScopesProcessor", "An operator which applies a specified operator on all sub-scopes of the current scope.")]
    3132  [StorableClass]
    32   public sealed class UniformSequentialSubScopesProcessor : SingleSuccessorOperator {
     33  public sealed class UniformSubScopesProcessor : SingleSuccessorOperator {
    3334    private OperatorParameter OperatorParameter {
    3435      get { return (OperatorParameter)Parameters["Operator"]; }
    3536    }
     37    public ValueLookupParameter<BoolValue> ParallelParameter {
     38      get { return (ValueLookupParameter<BoolValue>)Parameters["Parallel"]; }
     39    }
     40
    3641    public IOperator Operator {
    3742      get { return OperatorParameter.Value; }
    3843      set { OperatorParameter.Value = value; }
    3944    }
     45    public BoolValue Parallel {
     46      get { return ParallelParameter.Value; }
     47      set { ParallelParameter.Value = value; }
     48    }
    4049
    41     public UniformSequentialSubScopesProcessor()
     50    public UniformSubScopesProcessor()
    4251      : base() {
    43       Parameters.Add(new OperatorParameter("Operator", "The operator which should be applied sequentially on all sub-scopes of the current scope."));
     52      Parameters.Add(new OperatorParameter("Operator", "The operator which should be applied on all sub-scopes of the current scope."));
     53      Parameters.Add(new ValueLookupParameter<BoolValue>("Parallel", "True if the operator should be applied in parallel on all sub-scopes, otherwise false.", new BoolValue(false)));
    4454    }
    4555
    4656    public override IOperation Apply() {
     57      BoolValue parallel = ParallelParameter.ActualValue;
    4758      OperationCollection next = new OperationCollection(base.Apply());
    4859      if (Operator != null) {
    4960        OperationCollection inner = new OperationCollection();
     61        inner.Parallel = parallel == null ? false : parallel.Value;
    5062        for (int i = 0; i < ExecutionContext.Scope.SubScopes.Count; i++)
    5163          inner.Add(ExecutionContext.CreateOperation(Operator, ExecutionContext.Scope.SubScopes[i]));
Note: See TracChangeset for help on using the changeset viewer.