- Timestamp:
- 11/26/10 16:38:35 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.DebugEngine/DebugEngine.cs
r4909 r4946 40 40 : base(deserializing) { 41 41 pausePending = stopPending = false; 42 timer = new System.Timers.Timer(100); 43 timer.AutoReset = true; 44 timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); 45 } 42 InitializeTimer(); 43 } 44 46 45 protected DebugEngine(DebugEngine original, Cloner cloner) 47 46 : base(original, cloner) { … … 49 48 Log = cloner.Clone(original.Log); 50 49 ExecutionStack = cloner.Clone(original.ExecutionStack); 51 OperatorTrace = new ItemList<IOperator>(original.OperatorTrace.Select(op => cloner.Clone(op)));50 OperatorTrace = cloner.Clone(OperatorTrace); 52 51 operatorParents = original.operatorParents.ToDictionary(kvp => cloner.Clone(kvp.Key), kvp => cloner.Clone(kvp.Value)); 53 52 pausePending = original.pausePending; 54 53 stopPending = original.stopPending; 55 timer = new System.Timers.Timer(100); 56 timer.AutoReset = true; 57 timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); 58 this.currentOperation = cloner.Clone(original.currentOperation); 59 this.currentOperator = cloner.Clone(original.currentOperator); 54 InitializeTimer(); 55 currentOperation = cloner.Clone(original.currentOperation); 56 currentOperator = cloner.Clone(original.currentOperator); 60 57 } 61 58 public DebugEngine() … … 66 63 operatorParents = new Dictionary<IAtomicOperation, IAtomicOperation>(); 67 64 pausePending = stopPending = false; 65 InitializeTimer(); 66 } 67 68 public override IDeepCloneable Clone(Cloner cloner) { 69 return new DebugEngine(this, cloner); 70 } 71 72 private void InitializeTimer() { 68 73 timer = new System.Timers.Timer(100); 69 74 timer.AutoReset = true; 70 75 timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); 71 }72 73 public override IDeepCloneable Clone(Cloner cloner) {74 return new DebugEngine(this, cloner);75 76 } 76 77 … … 100 101 get { return currentOperation; } 101 102 private set { 102 if (value == currentOperation)103 return;104 currentOperation = value;105 OnOperationChanged(value);103 if (value != currentOperation) { 104 currentOperation = value; 105 OnOperationChanged(value); 106 } 106 107 } 107 108 } … … 126 127 127 128 public event EventHandler<OperationChangedEventArgs> CurrentOperationChanged; 128 129 129 protected virtual void OnOperationChanged(IOperation newOperation) { 130 130 EventHandler<OperationChangedEventArgs> handler = CurrentOperationChanged; … … 264 264 } else if (operations != null) { 265 265 Log.LogMessage("Expanding operation collection"); 266 ExpandOperationCollection(operations); 266 ExecutionStack.AddRange(operations.Reverse()); 267 CurrentOperation = null; 267 268 } else if (ExecutionStack.Count > 0) { 268 269 Log.LogMessage("Popping execution stack"); … … 273 274 } 274 275 GenerateOperationTrace(); 275 } catch (Exception x) { 276 } 277 catch (Exception x) { 276 278 OnExceptionOccurred(x); 277 279 } … … 315 317 currentOperator = null; 316 318 CurrentOperation = null; 317 } catch (Exception ex) { 319 } 320 catch (Exception ex) { 318 321 OnExceptionOccurred(new OperatorExecutionException(operation.Operator, ex)); 319 322 Pause(); … … 332 335 } 333 336 334 protected virtual void ExpandOperationCollection(OperationCollection operations) {335 ExecutionStack.AddRange(operations.Reverse());336 CurrentOperation = null;337 }338 339 337 protected virtual string Name(IAtomicOperation operation) { 340 338 return string.IsNullOrEmpty(operation.Operator.Name) ? operation.Operator.ItemName : operation.Operator.Name;
Note: See TracChangeset
for help on using the changeset viewer.