Changeset 5419
- Timestamp:
- 02/04/11 01:29:43 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.3/CrossValidationView.cs
r4569 r5419 21 21 22 22 using System; 23 using System.Linq; 23 24 using System.Windows.Forms; 24 25 using HeuristicLab.Common; … … 102 103 } 103 104 105 protected override void OnClosed(FormClosedEventArgs e) { 106 if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) { 107 //The content must be stopped if no other view showing the content is available 108 var optimizers = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v != this).Select(v => v.Content).OfType<IOptimizer>(); 109 //add nested optimizers 110 optimizers = optimizers.SelectMany(opt => opt.NestedOptimizers).Union(optimizers); 111 112 if (!optimizers.Contains(Content)) Content.Stop(); 113 } 114 base.OnClosed(e); 115 } 116 104 117 protected override void SetEnabledStateOfControls() { 105 118 if (InvokeRequired) Invoke((Action)SetEnabledStateOfControls); -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.3/CrossValidation.cs
r5287 r5419 165 165 } 166 166 167 public IEnumerable<IOptimizer> NestedOptimizers { 168 get { 169 if (Algorithm != null) yield return Algorithm; 170 if (clonedAlgorithms != null) { 171 foreach (IAlgorithm alg in ClonedAlgorithms) { 172 yield return alg; 173 foreach (IOptimizer nested in alg.NestedOptimizers) 174 yield return nested; 175 } 176 } 177 } 178 } 179 167 180 [Storable] 168 181 private ResultCollection results; -
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs
r5237 r5419 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 24 25 using System.Windows.Forms; 25 26 using HeuristicLab.Common; … … 133 134 134 135 protected override void OnClosed(FormClosedEventArgs e) { 135 if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) Content.Stop(); 136 if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) { 137 //The content must be stopped if no other view showing the content is available 138 var optimizers = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v != this).Select(v => v.Content).OfType<IOptimizer>(); 139 //add nested optimizers 140 optimizers = optimizers.SelectMany(opt => opt.NestedOptimizers).Union(optimizers); 141 142 if (!optimizers.Contains(Content)) Content.Stop(); 143 } 136 144 base.OnClosed(e); 137 145 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs
r5300 r5419 21 21 22 22 using System; 23 using System.Linq; 23 24 using System.Windows.Forms; 24 25 using HeuristicLab.Common; … … 109 110 110 111 protected override void OnClosed(FormClosedEventArgs e) { 111 if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) Content.Stop(); 112 if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) { 113 //The content must be stopped if no other view showing the content is available 114 var optimizers = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v != this).Select(v => v.Content).OfType<IOptimizer>(); 115 //add nested optimizers 116 optimizers = optimizers.SelectMany(opt => opt.NestedOptimizers).Union(optimizers); 117 118 if (!optimizers.Contains(Content)) Content.Stop(); 119 } 112 120 base.OnClosed(e); 113 121 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentView.cs
r4540 r5419 21 21 22 22 using System; 23 using System.Linq; 23 24 using System.Windows.Forms; 24 25 using HeuristicLab.Common; … … 91 92 92 93 protected override void OnClosed(FormClosedEventArgs e) { 93 if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) Content.Stop(); 94 if ((Content != null) && (Content.ExecutionState == ExecutionState.Started)) { 95 //The content must be stopped if no other view showing the content is available 96 var optimizers = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v != this).Select(v => v.Content).OfType<IOptimizer>(); 97 //add nested optimizers 98 optimizers = optimizers.SelectMany(opt => opt.NestedOptimizers).Union(optimizers); 99 100 if (!optimizers.Contains(Content)) Content.Stop(); 101 } 94 102 base.OnClosed(e); 95 103 } -
trunk/sources/HeuristicLab.Optimization/3.3/Algorithm.cs
r5287 r5419 23 23 using System.Collections.Generic; 24 24 using System.Drawing; 25 using System.Linq; 25 26 using HeuristicLab.Collections; 26 27 using HeuristicLab.Common; … … 120 121 } 121 122 123 public virtual IEnumerable<IOptimizer> NestedOptimizers { 124 get { return Enumerable.Empty<IOptimizer>(); } 125 } 126 122 127 protected Algorithm() 123 128 : base() { -
trunk/sources/HeuristicLab.Optimization/3.3/BatchRun.cs
r5409 r5419 137 137 } 138 138 139 public IEnumerable<IOptimizer> NestedOptimizers { 140 get { 141 if (Optimizer == null) yield break; 142 143 yield return Optimizer; 144 foreach (IOptimizer opt in Optimizer.NestedOptimizers) 145 yield return opt; 146 } 147 } 148 139 149 private bool stopPending; 140 150 -
trunk/sources/HeuristicLab.Optimization/3.3/Experiment.cs
r5300 r5419 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Drawing; 24 25 using System.Linq; … … 91 92 } 92 93 94 public IEnumerable<IOptimizer> NestedOptimizers { 95 get { 96 if (Optimizers == null) yield break; 97 98 foreach (IOptimizer opt in Optimizers) { 99 yield return opt; 100 foreach (IOptimizer nestedOpt in opt.NestedOptimizers) 101 yield return nestedOpt; 102 } 103 } 104 } 105 93 106 private bool stopPending; 94 107 -
trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IOptimizer.cs
r4068 r5419 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using HeuristicLab.Core; 23 24 … … 30 31 31 32 void Prepare(bool clearRuns); 33 34 IEnumerable<IOptimizer> NestedOptimizers { get; } 32 35 } 33 36 }
Note: See TracChangeset
for help on using the changeset viewer.