- Timestamp:
- 10/29/10 17:38:42 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactoring/HeuristicLab.Core/3.3/Engine.cs
r4477 r4668 46 46 private System.Timers.Timer timer; 47 47 48 [StorableConstructor] 49 protected Engine(bool deserializing) 50 : base(deserializing) { 51 pausePending = stopPending = false; 52 timer = new System.Timers.Timer(100); 53 timer.AutoReset = true; 54 timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); 55 } 56 protected Engine(Engine original, Cloner cloner) 57 : base(original, cloner) { 58 if (original.ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState)); 59 log = cloner.Clone(original.log); 60 IOperation[] contexts = original.executionStack.ToArray(); 61 for (int i = contexts.Length - 1; i >= 0; i--) 62 executionStack.Push(cloner.Clone(contexts[i])); 63 pausePending = original.pausePending; 64 stopPending = original.stopPending; 65 } 48 66 protected Engine() 49 67 : base() { … … 54 72 timer.AutoReset = true; 55 73 timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); 56 }57 [StorableConstructor]58 protected Engine(bool deserializing)59 : base(deserializing) {60 pausePending = stopPending = false;61 timer = new System.Timers.Timer(100);62 timer.AutoReset = true;63 timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);64 }65 66 public override IDeepCloneable Clone(Cloner cloner) {67 if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));68 Engine clone = (Engine)base.Clone(cloner);69 clone.log = (ILog)cloner.Clone(log);70 IOperation[] contexts = executionStack.ToArray();71 for (int i = contexts.Length - 1; i >= 0; i--)72 clone.executionStack.Push((IOperation)cloner.Clone(contexts[i]));73 clone.pausePending = pausePending;74 clone.stopPending = stopPending;75 return clone;76 74 } 77 75
Note: See TracChangeset
for help on using the changeset viewer.