Changeset 15721 for branches/1614_GeneralizedQAP/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs
- Timestamp:
- 02/04/18 22:33:26 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1614_GeneralizedQAP/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs
r15719 r15721 64 64 } 65 65 } 66 67 public abstract TimeSpan ExecutionTime { get; } 66 67 [Storable] 68 private TimeSpan executionTime; 69 public TimeSpan ExecutionTime { 70 get { return executionTime; } 71 protected set { 72 executionTime = value; 73 OnExecutionTimeChanged(); 74 } 75 } 68 76 69 77 public virtual Type ProblemType { … … 125 133 : base() { 126 134 executionState = ExecutionState.Stopped; 135 executionTime = TimeSpan.Zero; 127 136 storeAlgorithmInEachRun = false; 128 137 runsCounter = 0; … … 132 141 : base(name) { 133 142 executionState = ExecutionState.Stopped; 143 executionTime = TimeSpan.Zero; 134 144 storeAlgorithmInEachRun = false; 135 145 runsCounter = 0; … … 139 149 : base(name, parameters) { 140 150 executionState = ExecutionState.Stopped; 151 executionTime = TimeSpan.Zero; 141 152 storeAlgorithmInEachRun = false; 142 153 runsCounter = 0; … … 146 157 : base(name, description) { 147 158 executionState = ExecutionState.Stopped; 159 executionTime = TimeSpan.Zero; 148 160 storeAlgorithmInEachRun = false; 149 161 runsCounter = 0; … … 153 165 : base(name, description, parameters) { 154 166 executionState = ExecutionState.Stopped; 167 executionTime = TimeSpan.Zero; 155 168 storeAlgorithmInEachRun = false; 156 169 runsCounter = 0; … … 168 181 if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState)); 169 182 executionState = original.executionState; 183 executionTime = original.executionTime; 170 184 problem = cloner.Clone(original.problem); 171 185 storeAlgorithmInEachRun = original.storeAlgorithmInEachRun; … … 246 260 if (handler != null) handler(this, EventArgs.Empty); 247 261 } 262 public event EventHandler ExecutionTimeChanged; 263 protected virtual void OnExecutionTimeChanged() { 264 EventHandler handler = ExecutionTimeChanged; 265 if (handler != null) handler(this, EventArgs.Empty); 266 } 248 267 public event EventHandler ProblemChanged; 249 268 protected virtual void OnProblemChanged() { … … 258 277 public event EventHandler Prepared; 259 278 protected virtual void OnPrepared() { 279 ExecutionTime = TimeSpan.Zero; 260 280 foreach (IStatefulItem statefulObject in this.GetObjectGraphObjects(new HashSet<object>() { Runs }).OfType<IStatefulItem>()) { 261 281 statefulObject.InitializeState(); … … 328 348 } 329 349 #endregion 330 331 [Obsolete("Deprecate, does nothing, needs to be removed from IExecutable")]332 public event EventHandler ExecutionTimeChanged;333 350 } 334 351 }
Note: See TracChangeset
for help on using the changeset viewer.