Changeset 12080
- Timestamp:
- 02/26/15 12:44:13 (10 years ago)
- Location:
- branches/ALPS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerUniformSubScopesProcessor.cs
r12039 r12080 34 34 [Item("LayerUniformSubScopesProcessor", "")] 35 35 [StorableClass] 36 public class LayerUniformSubScopesProcessor : UniformSubScopesProcessor { 36 public class LayerUniformSubScopesProcessor : SingleSuccessorOperator { 37 private OperatorParameter OperatorParameter { 38 get { return (OperatorParameter)Parameters["Operator"]; } 39 } 40 public ValueLookupParameter<BoolValue> ParallelParameter { 41 get { return (ValueLookupParameter<BoolValue>)Parameters["Parallel"]; } 42 } 37 43 38 44 private ILookupParameter<IntArray> PopulationSizeParameter { 39 45 get { return (ILookupParameter<IntArray>)Parameters["PopulationSize"]; } 46 } 47 48 public IOperator Operator { 49 get { return OperatorParameter.Value; } 50 set { OperatorParameter.Value = value; } 51 } 52 public BoolValue Parallel { 53 get { return ParallelParameter.Value; } 54 set { ParallelParameter.Value = value; } 40 55 } 41 56 … … 47 62 public LayerUniformSubScopesProcessor() 48 63 : base() { 64 Parameters.Add(new OperatorParameter("Operator", "The operator which should be applied on all sub-scopes of the current scope.")); 65 Parameters.Add(new ValueLookupParameter<BoolValue>("Parallel", "True if the operator should be applied in parallel on all sub-scopes, otherwise false.", new BoolValue(false))); 66 49 67 Parameters.Add(new LookupParameter<IntArray>("PopulationSize")); 50 68 } … … 55 73 56 74 public override IOperation Apply() { 57 OperationCollection next = new OperationCollection(Successor != null ? ExecutionContext.CreateOperation(Successor) : null); // base.base.Apply not possible75 var next = new OperationCollection(Successor != null ? ExecutionContext.CreateOperation(Successor) : null); 58 76 if (Operator != null) { 59 List<IScope> scopes = GetScopesOnLevel(ExecutionContext.Scope, Depth.Value).ToList(); 60 OperationCollection inner = new OperationCollection(); 61 inner.Parallel = Parallel == null ? false : Parallel.Value; 77 var scopes = ExecutionContext.Scope.SubScopes; 78 var inner = new OperationCollection() { 79 Parallel = Parallel == null ? false : Parallel.Value 80 }; 62 81 for (int i = 0; i < scopes.Count; i++) { 63 82 var layerParameters = new LayerIntermediateParameter { -
branches/ALPS/HeuristicLab.Operators/3.3/UniformSubScopesProcessor.cs
r12035 r12080 34 34 [Item("UniformSubScopesProcessor", "An operator which applies a specified operator on all sub-scopes at the given depth of the current scope.")] 35 35 [StorableClass] 36 public class UniformSubScopesProcessor : SingleSuccessorOperator {36 public sealed class UniformSubScopesProcessor : SingleSuccessorOperator { 37 37 private OperatorParameter OperatorParameter { 38 38 get { return (OperatorParameter)Parameters["Operator"]; } … … 59 59 60 60 [StorableConstructor] 61 pr otectedUniformSubScopesProcessor(bool deserializing) : base(deserializing) { }62 pr otectedUniformSubScopesProcessor(UniformSubScopesProcessor original, Cloner cloner)61 private UniformSubScopesProcessor(bool deserializing) : base(deserializing) { } 62 private UniformSubScopesProcessor(UniformSubScopesProcessor original, Cloner cloner) 63 63 : base(original, cloner) { 64 64 } … … 88 88 } 89 89 90 pr otectedIEnumerable<IScope> GetScopesOnLevel(IScope scope, int d) {90 private IEnumerable<IScope> GetScopesOnLevel(IScope scope, int d) { 91 91 if (d == 0) yield return scope; 92 92 else {
Note: See TracChangeset
for help on using the changeset viewer.