Changeset 2834 for trunk/sources/HeuristicLab.Core/3.3/ExecutionContext.cs
- Timestamp:
- 02/19/10 06:19:16 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/3.3/ExecutionContext.cs
r2796 r2834 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Text; 23 using HeuristicLab.Collections; 25 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 25 27 26 namespace HeuristicLab.Core { 28 public class ExecutionContext : DeepCloneable, IExecution Sequence{27 public class ExecutionContext : DeepCloneable, IExecutionContext, IAtomicOperation { 29 28 [Storable] 30 private ExecutionContext parent; 31 public ExecutionContext Parent { 29 private IParameterizedItem parameterizedItem; 30 31 [Storable] 32 private IExecutionContext parent; 33 public IExecutionContext Parent { 32 34 get { return parent; } 33 35 } 34 36 35 [Storable] 36 private IOperator op; 37 public IObservableKeyedCollection<string, IParameter> Parameters { 38 get { return parameterizedItem.Parameters; } 39 } 40 37 41 public IOperator Operator { 38 get { return op; }42 get { return parameterizedItem as IOperator; } 39 43 } 40 44 … … 45 49 } 46 50 47 [Storable]48 private IProblem problem;49 public IProblem Problem {50 get { return problem; }51 }52 53 51 private ExecutionContext() { 54 52 parent = null; 55 op= null;53 parameterizedItem = null; 56 54 scope = null; 57 problem = null;58 55 } 59 public ExecutionContext( ExecutionContext parent, IOperator op, IScope scope, IProblem problem) {60 if (( op == null) || (scope == null) || (problem== null)) throw new ArgumentNullException();56 public ExecutionContext(IExecutionContext parent, IParameterizedItem parameterizedItem, IScope scope) { 57 if ((parameterizedItem == null) || (scope == null)) throw new ArgumentNullException(); 61 58 this.parent = parent; 62 this. op = op;59 this.parameterizedItem = parameterizedItem; 63 60 this.scope = scope; 64 this.problem = problem;65 61 } 66 62 … … 68 64 ExecutionContext clone = new ExecutionContext(); 69 65 cloner.RegisterClonedObject(this, clone); 70 clone.parent = ( ExecutionContext)cloner.Clone(parent);71 clone. op = (IOperator)cloner.Clone(op);66 clone.parent = (IExecutionContext)cloner.Clone(parent); 67 clone.parameterizedItem = (IParameterizedItem)cloner.Clone(parameterizedItem); 72 68 clone.scope = (IScope)cloner.Clone(scope); 73 clone.problem = (IProblem)cloner.Clone(problem);74 69 return clone; 75 70 } 76 71 77 public ExecutionContext CreateContext(IOperator op) {78 return new ExecutionContext(parent, op, scope , problem);72 public IAtomicOperation CreateOperation(IOperator op) { 73 return new ExecutionContext(parent, op, scope); 79 74 } 80 public ExecutionContext CreateContext(IOperator op, IScope scope) {81 return new ExecutionContext(parent, op, scope , problem);75 public IAtomicOperation CreateOperation(IOperator op, IScope scope) { 76 return new ExecutionContext(parent, op, scope); 82 77 } 83 public ExecutionContext CreateChildContext(IOperator op) {84 return new ExecutionContext(this, op, scope , problem);78 public IAtomicOperation CreateChildOperation(IOperator op) { 79 return new ExecutionContext(this, op, scope); 85 80 } 86 public ExecutionContext CreateChildContext(IOperator op, IScope scope) {87 return new ExecutionContext(this, op, scope , problem);81 public IAtomicOperation CreateChildOperation(IOperator op, IScope scope) { 82 return new ExecutionContext(this, op, scope); 88 83 } 89 84 }
Note: See TracChangeset
for help on using the changeset viewer.