- Timestamp:
- 12/26/10 03:51:30 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ParallelEngine/HeuristicLab.Operators/3.3/Operator.cs
r4722 r5177 28 28 namespace HeuristicLab.Operators { 29 29 /// <summary> 30 /// The base class for alloperators.30 /// Base class for operators. 31 31 /// </summary> 32 32 [Item("Operator", "Base class for operators.")] … … 43 43 } 44 44 45 [Storable]46 private IExecutionContext executionContext;47 protected IExecutionContext ExecutionContext {48 get { return executionContext; }49 private set {50 if (value != executionContext) {51 executionContext = value;52 OnExecutionContextChanged();53 }54 }55 }56 57 /// <summary>58 /// Flag whether the current instance has been canceled.59 /// </summary>60 45 private bool canceled; 61 /// <inheritdoc/>62 46 protected bool Canceled { 63 47 get { return canceled; } … … 72 56 [Storable] 73 57 private bool breakpoint; 74 /// <inheritdoc/>75 /// <remarks>Calls <see cref="OnBreakpointChanged"/> in the setter.</remarks>76 58 public bool Breakpoint { 77 59 get { return breakpoint; } … … 91 73 this.canceled = original.canceled; 92 74 this.breakpoint = original.breakpoint; 93 this.executionContext = cloner.Clone<IExecutionContext>(original.executionContext);94 75 } 95 /// <summary>96 /// Initializes a new instance of <see cref="OperatorBase"/> setting the breakpoint flag and97 /// the canceled flag to <c>false</c> and the name of the operator to the type name.98 /// </summary>99 76 protected Operator() 100 77 : base() { … … 123 100 } 124 101 125 /// <inheritdoc/>126 102 public virtual IOperation Execute(IExecutionContext context) { 127 103 try { 128 104 Canceled = false; 129 ExecutionContext = context;130 105 foreach (IParameter param in Parameters) 131 106 param.ExecutionContext = context; 132 IOperation next = Apply( );107 IOperation next = Apply(context); 133 108 OnExecuted(); 134 109 return next; … … 137 112 foreach (IParameter param in Parameters) 138 113 param.ExecutionContext = null; 139 ExecutionContext = null;140 114 } 141 115 } 142 /// <inheritdoc/>143 /// <remarks>Sets property <see cref="Canceled"/> to <c>true</c>.</remarks>144 116 public void Abort() { 145 117 Canceled = true; 146 118 } 147 /// <summary> 148 /// Performs the current operator on the specified <paramref name="scope"/>. 149 /// </summary> 150 /// <param name="scope">The scope where to execute the operator</param> 151 /// <returns><c>null</c>.</returns> 152 public abstract IOperation Apply(); 119 public abstract IOperation Apply(IExecutionContext context); 153 120 154 protected virtual void OnExecutionContextChanged() { }155 121 protected virtual void OnCanceledChanged() { } 156 /// <inheritdoc/>157 122 public event EventHandler BreakpointChanged; 158 /// <summary>159 /// Fires a new <c>BreakpointChanged</c> event.160 /// </summary>161 123 protected virtual void OnBreakpointChanged() { 162 124 if (BreakpointChanged != null) { … … 164 126 } 165 127 } 166 /// <inheritdoc/>167 128 public event EventHandler Executed; 168 /// <summary>169 /// Fires a new <c>Executed</c> event.170 /// </summary>171 129 protected virtual void OnExecuted() { 172 130 if (Executed != null) {
Note: See TracChangeset
for help on using the changeset viewer.