- Timestamp:
- 03/23/10 01:31:17 (15 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Operators/3.3/UniformSubScopesProcessor.cs
r3186 r3193 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Data; 23 24 using HeuristicLab.Parameters; 24 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 26 27 namespace HeuristicLab.Operators { 27 28 /// <summary> 28 /// An operator which applies a specified operator sequentiallyon all sub-scopes of the current scope.29 /// An operator which applies a specified operator on all sub-scopes of the current scope. 29 30 /// </summary> 30 [Item("UniformS equentialSubScopesProcessor", "An operator which applies a specified operator sequentiallyon 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.")] 31 32 [StorableClass] 32 public sealed class UniformS equentialSubScopesProcessor : SingleSuccessorOperator {33 public sealed class UniformSubScopesProcessor : SingleSuccessorOperator { 33 34 private OperatorParameter OperatorParameter { 34 35 get { return (OperatorParameter)Parameters["Operator"]; } 35 36 } 37 public ValueLookupParameter<BoolValue> ParallelParameter { 38 get { return (ValueLookupParameter<BoolValue>)Parameters["Parallel"]; } 39 } 40 36 41 public IOperator Operator { 37 42 get { return OperatorParameter.Value; } 38 43 set { OperatorParameter.Value = value; } 39 44 } 45 public BoolValue Parallel { 46 get { return ParallelParameter.Value; } 47 set { ParallelParameter.Value = value; } 48 } 40 49 41 public UniformS equentialSubScopesProcessor()50 public UniformSubScopesProcessor() 42 51 : 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))); 44 54 } 45 55 46 56 public override IOperation Apply() { 57 BoolValue parallel = ParallelParameter.ActualValue; 47 58 OperationCollection next = new OperationCollection(base.Apply()); 48 59 if (Operator != null) { 49 60 OperationCollection inner = new OperationCollection(); 61 inner.Parallel = parallel == null ? false : parallel.Value; 50 62 for (int i = 0; i < ExecutionContext.Scope.SubScopes.Count; i++) 51 63 inner.Add(ExecutionContext.CreateOperation(Operator, ExecutionContext.Scope.SubScopes[i]));
Note: See TracChangeset
for help on using the changeset viewer.