Changeset 2773 for trunk/sources/HeuristicLab.Operators
- Timestamp:
- 02/10/10 03:39:02 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Operators/3.3
- Files:
-
- 3 added
- 3 deleted
- 17 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Operators/3.3/CombinedOperator.cs
r2757 r2773 68 68 } 69 69 70 public override IExecution ContextApply() {70 public override IExecutionSequence Apply() { 71 71 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply()); 72 72 if (operatorGraph.InitialOperator != null) -
trunk/sources/HeuristicLab.Operators/3.3/Comparator.cs
r2757 r2773 61 61 } 62 62 63 public override IExecution ContextApply() {63 public override IExecutionSequence Apply() { 64 64 IItem left = LeftSideParameter.ActualValue; 65 65 IItem right = RightSideParameter.ActualValue; -
trunk/sources/HeuristicLab.Operators/3.3/ConditionalBranch.cs
r2757 r2773 62 62 } 63 63 64 public override IExecution ContextApply() {64 public override IExecutionSequence Apply() { 65 65 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply()); 66 66 if (ConditionParameter.ActualValue.Value) { -
trunk/sources/HeuristicLab.Operators/3.3/DoubleCounter.cs
r2757 r2773 30 30 namespace HeuristicLab.Operators { 31 31 /// <summary> 32 /// Operator which increments a double variable.32 /// An operator which increments a double variable. 33 33 /// </summary> 34 34 [Item("DoubleCounter", "An operator which increments a double variable.")] … … 53 53 } 54 54 55 public override IExecution ContextApply() {55 public override IExecutionSequence Apply() { 56 56 if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new DoubleData(); 57 57 ValueParameter.ActualValue.Value += IncrementParameter.ActualValue.Value; -
trunk/sources/HeuristicLab.Operators/3.3/HeuristicLab.Operators-3.3.csproj
r2757 r2773 89 89 <Compile Include="ConditionalBranch.cs" /> 90 90 <Compile Include="Comparator.cs" /> 91 <Compile Include="Assigner.cs" /> 92 <Compile Include="MultipleCallsOperator.cs" /> 93 <Compile Include="ParallelSubScopesProcessor.cs" /> 94 <Compile Include="Placeholder.cs" /> 95 <Compile Include="SingleCallOperator.cs" /> 96 <Compile Include="IntCounter.cs" /> 91 97 <Compile Include="ScopeCleaner.cs" /> 98 <Compile Include="SequentialSubScopesProcessor.cs" /> 99 <Compile Include="StochasticBranch.cs" /> 92 100 <Compile Include="SubScopesRemover.cs" /> 93 101 <Compile Include="SubScopesSorter.cs" /> 94 102 <Compile Include="DoubleCounter.cs" /> 95 <Compile Include="ParallelProcessor.cs" />96 103 <Compile Include="UniformParallelSubScopesProcessor.cs" /> 97 104 <Compile Include="UniformSequentialSubScopesProcessor.cs" /> 98 <Compile Include="ValueCollector.cs" />99 <Compile Include="MultipleSuccessorsOperator.cs" />100 <Compile Include="Counter.cs" />101 105 <Compile Include="EmptyOperator.cs"> 102 106 <SubType>Code</SubType> … … 105 109 <Compile Include="Operator.cs" /> 106 110 <Compile Include="Properties\AssemblyInfo.cs" /> 107 <Compile Include="SequentialProcessor.cs" />108 111 <Compile Include="SingleSuccessorOperator.cs" /> 109 112 <Compile Include="SubScopesCreater.cs" /> 113 <Compile Include="ValuesCollector.cs" /> 110 114 <Compile Include="VariableInjector.cs"> 111 115 <SubType>Code</SubType> -
trunk/sources/HeuristicLab.Operators/3.3/IntCounter.cs
r2772 r2773 30 30 namespace HeuristicLab.Operators { 31 31 /// <summary> 32 /// Operator which increments an integer variable.32 /// An operator which increments an integer variable. 33 33 /// </summary> 34 [Item(" Counter", "An operator which increments an integer variable.")]34 [Item("IntCounter", "An operator which increments an integer variable.")] 35 35 [EmptyStorableClass] 36 36 [Creatable("Test")] 37 public sealed class Counter : SingleSuccessorOperator {37 public sealed class IntCounter : SingleSuccessorOperator { 38 38 public LookupParameter<IntData> ValueParameter { 39 39 get { return (LookupParameter<IntData>)Parameters["Value"]; } … … 47 47 } 48 48 49 public Counter()49 public IntCounter() 50 50 : base() { 51 51 Parameters.Add(new LookupParameter<IntData>("Value", "The value which should be incremented.")); … … 53 53 } 54 54 55 public override IExecution ContextApply() {55 public override IExecutionSequence Apply() { 56 56 if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new IntData(); 57 57 ValueParameter.ActualValue.Value += IncrementParameter.ActualValue.Value; -
trunk/sources/HeuristicLab.Operators/3.3/Operator.cs
r2757 r2773 130 130 131 131 /// <inheritdoc/> 132 public virtual IExecution ContextExecute(ExecutionContext context) {132 public virtual IExecutionSequence Execute(ExecutionContext context) { 133 133 try { 134 134 Canceled = false; … … 136 136 foreach (IParameter param in Parameters) 137 137 param.ExecutionContext = context; 138 IExecution Contextnext = Apply();138 IExecutionSequence next = Apply(); 139 139 OnExecuted(); 140 140 return next; … … 156 156 /// <param name="scope">The scope where to execute the operator</param> 157 157 /// <returns><c>null</c>.</returns> 158 public abstract IExecution ContextApply();158 public abstract IExecutionSequence Apply(); 159 159 160 160 protected virtual void OnExecutionContextChanged() { } -
trunk/sources/HeuristicLab.Operators/3.3/ParallelSubScopesProcessor.cs
r1530 r2773 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 24 25 using System.Text; 26 using System.Xml; 27 using HeuristicLab.Collections; 25 28 using HeuristicLab.Core; 26 using HeuristicLab.Data; 29 using HeuristicLab.Parameters; 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 31 28 32 namespace HeuristicLab.Operators { 29 33 /// <summary> 30 /// Performs <c>n</c> operators on <c>n</c> subscopes, operations can be executed in parallel.34 /// An operator which contains multiple operators of which each is applied in parallel on one sub-scope of the current scope. The first operator is applied on the first sub-scope, the second on the second, and so on. 31 35 /// </summary> 32 public class ParallelSubScopesProcessor : OperatorBase { 33 /// <inheritdoc select="summary"/> 34 public override string Description { 35 get { return @"TODO\r\nOperator description still missing ..."; } 36 [Item("ParallelSubScopesProcessor", "An operator which contains multiple operators of which each is applied in parallel on one sub-scope of the current scope. The first operator is applied on the first sub-scope, the second on the second, and so on.")] 37 [Creatable("Test")] 38 public sealed class ParallelSubScopesProcessor : MultipleCallsOperator { 39 public ParallelSubScopesProcessor() 40 : base() { 36 41 } 37 42 38 /// <summary> 39 /// Applies <c>n</c> operators on all the <c>n</c> sub scopes of the given <paramref name="scope"/>. 40 /// </summary> 41 /// <param name="scope">The scope on whose sub scopes the operators are applied.</param> 42 /// <returns>A new <see cref="CompositeOperation"/> with the <c>i</c>th operator applied 43 /// on the <c>i</c>th sub scope, the <c>ExecuteInParallel</c> flag 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 < scope.SubScopes.Count; i++) 48 next.AddOperation(new AtomicOperation(SubOperators[i], scope.SubScopes[i])); 43 public override IExecutionSequence Apply() { 44 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply()); 45 if (Operators.Count > 0) { 46 ExecutionContextCollection inner = new ExecutionContextCollection(); 47 inner.Parallel = true; 48 for (int i = 0; (i < ExecutionContext.Scope.SubScopes.Count) && (i < Operators.Count); i++) 49 inner.Add(new ExecutionContext(ExecutionContext.Parent, Operators[i], ExecutionContext.Scope.SubScopes[i])); 50 next.Insert(0, inner); 51 } 49 52 return next; 50 53 } -
trunk/sources/HeuristicLab.Operators/3.3/Placeholder.cs
r2772 r2773 23 23 using System.Collections.Generic; 24 24 using System.Text; 25 using System.Xml; 25 26 using HeuristicLab.Core; 26 using HeuristicLab.Data; 27 using HeuristicLab.Parameters; 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 29 28 30 namespace HeuristicLab.Operators { 29 31 /// <summary> 30 /// Retrieves an operator from a specified scope and returns a successor operation with this operation 31 /// and scope. 32 /// An operator which acts as a placeholder for another operator retrieved from the scope or a parent execution context. 32 33 /// </summary> 33 public class OperatorExtractor : OperatorBase {34 /// <inheritdoc select="summary"/>35 public override string Description {36 get { return @"An operator extractor retrievs an operator from the scope it is applied on and returns a successor operation containing this operator and the current scope. Lookup for the operator is done recursively.37 38 Operator extractors can be used to get those operators again that have been injected by combined operators."; }34 [Item("Placeholder", "An operator which acts as a placeholder for another operator retrieved from the scope or a parent execution context.")] 35 [Creatable("Test")] 36 [EmptyStorableClass] 37 public sealed class Placeholder : SingleSuccessorOperator { 38 public LookupParameter<IOperator> OperatorParameter { 39 get { return (LookupParameter<IOperator>)Parameters["Operator"]; } 39 40 } 40 41 41 /// <summary> 42 /// Initializes a new instance of <see cref="OperatorExtractor"/> with 43 /// one variable info (<c>Operator</c>). 44 /// </summary> 45 public OperatorExtractor() 42 public Placeholder() 46 43 : base() { 47 AddVariableInfo(new VariableInfo("Operator", "Extracted operator", typeof(IOperator), VariableKind.In));44 Parameters.Add(new LookupParameter<IOperator>("Operator", "The operator which is retrieved from the scope or a parent execution context and applied on the current scope.")); 48 45 } 49 46 50 /// <summary> 51 /// Gets an operator from the specified <paramref name="scope"/> and returns an 52 /// <see cref="AtomicOperation"/> containing this operator and scope. 53 /// </summary> 54 /// <param name="scope">The scope where to apply the operator on.</param> 55 /// <returns>A new <see cref="AtomicOperation"/> containing the operator and the given 56 /// <paramref name="scope"/>.</returns> 57 public override IOperation Apply(IScope scope) { 58 IOperator op = GetVariableValue<IOperator>("Operator", scope, true, true); 59 return new AtomicOperation(op, scope); 47 public override IExecutionSequence Apply() { 48 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply()); 49 IOperator op = OperatorParameter.ActualValue; 50 if (op != null) 51 next.Insert(0, new ExecutionContext(ExecutionContext.Parent, op, ExecutionContext.Scope)); 52 return next; 60 53 } 61 54 } -
trunk/sources/HeuristicLab.Operators/3.3/ScopeCleaner.cs
r2757 r2773 47 47 } 48 48 49 public override IExecution ContextApply() {49 public override IExecutionSequence Apply() { 50 50 CurrentScope.Variables.Clear(); 51 51 CurrentScope.SubScopes.Clear(); -
trunk/sources/HeuristicLab.Operators/3.3/SequentialSubScopesProcessor.cs
r1530 r2773 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 24 25 using System.Text; 26 using System.Xml; 27 using HeuristicLab.Collections; 25 28 using HeuristicLab.Core; 26 using HeuristicLab.Data; 29 using HeuristicLab.Parameters; 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 31 28 32 namespace HeuristicLab.Operators { 29 33 /// <summary> 30 /// Performs <c>n</c> operators on <c>n</c> subscopes, operations must be executed sequentially.34 /// An operator which contains multiple operators of which each is applied sequentially on one sub-scope of the current scope. The first operator is applied on the first sub-scope, the second on the second, and so on. 31 35 /// </summary> 32 public class SequentialSubScopesProcessor : OperatorBase { 33 /// <inheritdoc select="summary"/> 34 public override string Description { 35 get { return @"TODO\r\nOperator description still missing ..."; } 36 [Item("SequentialSubScopesProcessor", "An operator which contains multiple operators of which each is applied sequentially on one sub-scope of the current scope. The first operator is applied on the first sub-scope, the second on the second, and so on.")] 37 [Creatable("Test")] 38 public sealed class SequentialSubScopesProcessor : MultipleCallsOperator { 39 public SequentialSubScopesProcessor() 40 : base() { 36 41 } 37 42 38 /// <summary> 39 /// Applies <c>n</c> operators on all the <c>n</c> sub scopes of the given <paramref name="scope"/>. 40 /// </summary> 41 /// <param name="scope">The scope on whose sub scopes the operators are applied.</param> 42 /// <returns>A new <see cref="CompositeOperation"/> with the <c>i</c>th operator applied 43 /// on the <c>i</c>th sub scope.</returns> 44 public override IOperation Apply(IScope scope) { 45 CompositeOperation next = new CompositeOperation(); 46 for (int i = 0; i < scope.SubScopes.Count; i++) 47 next.AddOperation(new AtomicOperation(SubOperators[i], scope.SubScopes[i])); 43 public override IExecutionSequence Apply() { 44 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply()); 45 if (Operators.Count > 0) { 46 ExecutionContextCollection inner = new ExecutionContextCollection(); 47 for (int i = 0; (i < ExecutionContext.Scope.SubScopes.Count) && (i < Operators.Count); i++) 48 inner.Add(new ExecutionContext(ExecutionContext.Parent, Operators[i], ExecutionContext.Scope.SubScopes[i])); 49 next.Insert(0, inner); 50 } 48 51 return next; 49 52 } -
trunk/sources/HeuristicLab.Operators/3.3/SingleSuccessorOperator.cs
r2757 r2773 49 49 } 50 50 51 public override IExecution ContextApply() {51 public override IExecutionSequence Apply() { 52 52 if (Successor != null) 53 53 return new ExecutionContext(ExecutionContext.Parent, Successor, ExecutionContext.Scope); -
trunk/sources/HeuristicLab.Operators/3.3/StochasticBranch.cs
r1530 r2773 23 23 using System.Collections.Generic; 24 24 using System.Text; 25 using System.Xml; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Data; 28 using HeuristicLab.Parameters; 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 30 28 31 namespace HeuristicLab.Operators { 29 32 /// <summary> 30 /// Branch of (one or) two operators that have different probabilities to get executed.33 /// A branch of two operators which are executed with a specified probability. 31 34 /// </summary> 32 public class StochasticBranch : OperatorBase { 33 /// <inheritdoc select="summary"/> 34 public override string Description { 35 get { return @"TODO\r\nOperator description still missing ..."; } 35 [Item("StochasticBranch", "A branch of two operators which are executed with a specified probability.")] 36 [Creatable("Test")] 37 [EmptyStorableClass] 38 public class StochasticBranch : SingleSuccessorOperator { 39 public LookupParameter<IRandom> RandomParameter { 40 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 41 } 42 public ValueLookupParameter<DoubleData> ProbabilityParameter { 43 get { return (ValueLookupParameter<DoubleData>)Parameters["Probability"]; } 44 } 45 protected OperatorParameter FirstBranchParameter { 46 get { return (OperatorParameter)Parameters["FirstBranch"]; } 47 } 48 protected OperatorParameter SecondBranchParameter { 49 get { return (OperatorParameter)Parameters["SecondBranch"]; } 50 } 51 public IOperator FirstBranch { 52 get { return FirstBranchParameter.Value; } 53 set { FirstBranchParameter.Value = value; } 54 } 55 public IOperator SecondBranch { 56 get { return SecondBranchParameter.Value; } 57 set { SecondBranchParameter.Value = value; } 36 58 } 37 59 38 /// <summary>39 /// Initializes a new instance of <see cref="StochasticBranch"/> with two variable infos40 /// (<c>Random</c> and <c>Probability</c>).41 /// </summary>42 60 public StochasticBranch() 43 61 : base() { 44 AddVariableInfo(new VariableInfo("Random", "Pseudo random number generator", typeof(IRandom), VariableKind.In)); 45 AddVariableInfo(new VariableInfo("Probability", "Probability to choose first branch", typeof(DoubleData), VariableKind.In)); 62 Parameters.Add(new LookupParameter<IRandom>("Random", "A pseudo random number generator.")); 63 Parameters.Add(new ValueLookupParameter<DoubleData>("Probability", "The probability to execute the first branch.")); 64 Parameters.Add(new OperatorParameter("FirstBranch", "The operator which is executed with the given probability.")); 65 Parameters.Add(new OperatorParameter("SecondBranch", "The operator which is executed if the first branch is not executed.")); 46 66 } 47 67 48 /// <summary> 49 /// Applies the operator of branch one with a specific probability on the given 50 /// <paramref name="scope"/>, or - if existent - with another probability operator of branch two. 51 /// </summary> 52 /// <param name="scope">The scope to apply the operators on.</param> 53 /// <returns>A new <see cref="AtomicOperation"/> with either operator 1 or operator 2 applied 54 /// to the given <paramref name="scope"/> or <c>null</c>.</returns> 55 public override IOperation Apply(IScope scope) { 56 IRandom random = GetVariableValue<IRandom>("Random", scope, true); 57 DoubleData probability = GetVariableValue<DoubleData>("Probability", scope, true); 58 59 bool result = random.NextDouble() < probability.Data; 60 if ((result) && (SubOperators.Count > 0) && (SubOperators[0] != null)) 61 return new AtomicOperation(SubOperators[0], scope); 62 else if ((!result) && (SubOperators.Count > 1) && (SubOperators[1] != null)) 63 return new AtomicOperation(SubOperators[1], scope); 64 return null; 68 public override IExecutionSequence Apply() { 69 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply()); 70 if (RandomParameter.ActualValue.NextDouble() < ProbabilityParameter.ActualValue.Value) { 71 if (FirstBranch != null) next.Insert(0, new ExecutionContext(ExecutionContext.Parent, FirstBranch, ExecutionContext.Scope)); 72 } else { 73 if (SecondBranch != null) next.Insert(0, new ExecutionContext(ExecutionContext.Parent, SecondBranch, ExecutionContext.Scope)); 74 } 75 return next; 65 76 } 66 77 } -
trunk/sources/HeuristicLab.Operators/3.3/SubScopesCreater.cs
r2757 r2773 52 52 } 53 53 54 public override IExecution ContextApply() {54 public override IExecutionSequence Apply() { 55 55 int n = NumberOfSubScopesParameter.ActualValue.Value; 56 56 for (int i = 0; i < n; i++) -
trunk/sources/HeuristicLab.Operators/3.3/SubScopesRemover.cs
r2757 r2773 52 52 } 53 53 54 public override IExecution ContextApply() {54 public override IExecutionSequence Apply() { 55 55 IntData index = SubScopeIndexParameter.ActualValue; 56 56 if (index != null) -
trunk/sources/HeuristicLab.Operators/3.3/SubScopesSorter.cs
r2757 r2773 59 59 } 60 60 61 public override IExecution ContextApply() {61 public override IExecutionSequence Apply() { 62 62 descending = DescendingParameter.ActualValue.Value; 63 63 actualName = LookupParameter<DoubleData>.TranslateName(ValueParameter.Name, ExecutionContext); -
trunk/sources/HeuristicLab.Operators/3.3/UniformParallelSubScopesProcessor.cs
r2757 r2773 35 35 [Creatable("Test")] 36 36 [EmptyStorableClass] 37 public sealed class UniformParallelSubScopesProcessor : SingleSuccessorOperator { 38 private OperatorParameter OperatorParameter { 39 get { return (OperatorParameter)Parameters["Operator"]; } 40 } 41 public IOperator Operator { 42 get { return OperatorParameter.Value; } 43 set { OperatorParameter.Value = value; } 44 } 45 37 public sealed class UniformParallelSubScopesProcessor : SingleCallOperator { 46 38 public UniformParallelSubScopesProcessor() 47 39 : base() { 40 Parameters.Remove("Operator"); 48 41 Parameters.Add(new OperatorParameter("Operator", "The operator which should be applied on all sub-scopes of the current scope in parallel.")); 49 42 } 50 43 51 public override IExecution ContextApply() {44 public override IExecutionSequence Apply() { 52 45 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply()); 53 46 if (Operator != null) { -
trunk/sources/HeuristicLab.Operators/3.3/UniformSequentialSubScopesProcessor.cs
r2757 r2773 35 35 [Creatable("Test")] 36 36 [EmptyStorableClass] 37 public sealed class UniformSequentialSubScopesProcessor : SingleSuccessorOperator { 38 private OperatorParameter OperatorParameter { 39 get { return (OperatorParameter)Parameters["Operator"]; } 40 } 41 public IOperator Operator { 42 get { return OperatorParameter.Value; } 43 set { OperatorParameter.Value = value; } 44 } 45 37 public sealed class UniformSequentialSubScopesProcessor : SingleCallOperator { 46 38 public UniformSequentialSubScopesProcessor() 47 39 : base() { 40 Parameters.Remove("Operator"); 48 41 Parameters.Add(new OperatorParameter("Operator", "The operator which should be applied sequentially on all sub-scopes of the current scope.")); 49 42 } 50 43 51 public override IExecution ContextApply() {44 public override IExecutionSequence Apply() { 52 45 ExecutionContextCollection next = new ExecutionContextCollection(base.Apply()); 53 46 if (Operator != null) { -
trunk/sources/HeuristicLab.Operators/3.3/ValuesCollector.cs
r2772 r2773 24 24 using System.Text; 25 25 using System.Xml; 26 using HeuristicLab.Collections; 26 27 using HeuristicLab.Core; 27 28 using HeuristicLab.Parameters; … … 32 33 /// An operator which collects the actual values of parameters. 33 34 /// </summary> 34 [Item("ValueCollector", "An operator which collects the actual values of parameters.")] 35 [EmptyStorableClass] 35 [Item("ValuesCollector", "An operator which collects the actual values of parameters.")] 36 36 [Creatable("Test")] 37 public abstract class ValueCollector : SingleSuccessorOperator, IOperator { 38 protected ValueParameter<ParameterCollection> CollectedValuesParameter { 39 get { return (ValueParameter<ParameterCollection>)Parameters["CollectedValues"]; } 40 } 37 public abstract class ValuesCollector : SingleSuccessorOperator, IOperator { 38 private ParameterCollection collectedValues; 39 [Storable] 41 40 public ParameterCollection CollectedValues { 42 get { return CollectedValuesParameter.Value; } 43 set { CollectedValuesParameter.Value = value; } 41 get { return collectedValues; } 42 private set { 43 collectedValues = value; 44 collectedValues.ItemsAdded += new CollectionItemsChangedEventHandler<IParameter>(collectedValues_ItemsAdded); 45 collectedValues.ItemsRemoved += new CollectionItemsChangedEventHandler<IParameter>(collectedValues_ItemsRemoved); 46 collectedValues.CollectionReset += new CollectionItemsChangedEventHandler<IParameter>(collectedValues_CollectionReset); 47 } 44 48 } 45 49 46 public Value Collector()50 public ValuesCollector() 47 51 : base() { 48 Parameters.Add(new ValueParameter<ParameterCollection>("CollectedValues", "The parameters whose actual values are collected.", new ParameterCollection()));52 CollectedValues = new ParameterCollection(); 49 53 } 50 54 51 protected override void OnExecutionContextChanged() { 52 foreach (IParameter param in CollectedValues) 53 param.ExecutionContext = ExecutionContext; 55 public override IDeepCloneable Clone(Cloner cloner) { 56 ValuesCollector clone = (ValuesCollector)base.Clone(cloner); 57 clone.CollectedValues = (ParameterCollection)cloner.Clone(collectedValues); 58 return clone; 59 } 60 61 private void collectedValues_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IParameter> e) { 62 Parameters.AddRange(e.Items); 63 } 64 private void collectedValues_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IParameter> e) { 65 Parameters.RemoveRange(e.Items); 66 } 67 #region NOTE 68 // NOTE: The ItemsReplaced event has not to be handled here as it is only fired when the name (i.e. key) of a parameter 69 // changes. As the same parameter is also contained in the Parameters collection of the operator, the Parameters collection 70 // will react on this name change on its own. 71 #endregion 72 private void collectedValues_CollectionReset(object sender, CollectionItemsChangedEventArgs<IParameter> e) { 73 Parameters.RemoveRange(e.OldItems); 74 Parameters.AddRange(e.Items); 54 75 } 55 76 } -
trunk/sources/HeuristicLab.Operators/3.3/VariableInjector.cs
r2757 r2773 37 37 [Creatable("Test")] 38 38 [EmptyStorableClass] 39 public class VariableInjector : Value Collector {39 public class VariableInjector : ValuesCollector { 40 40 protected ScopeParameter CurrentScopeParameter { 41 41 get { return (ScopeParameter)Parameters["CurrentScope"]; } … … 50 50 } 51 51 52 public override IExecution ContextApply() {52 public override IExecutionSequence Apply() { 53 53 IVariable var; 54 54 foreach (IParameter param in CollectedValues) {
Note: See TracChangeset
for help on using the changeset viewer.