- Timestamp:
- 05/07/10 21:10:46 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Analysis/3.3/MinAverageMaxValueAnalyzer.cs
r3662 r3710 56 56 get { return (ValueLookupParameter<VariableCollection>)Parameters["Results"]; } 57 57 } 58 public ValueParameter<BoolValue> CollectMinValueInResultsParameter { 59 get { return (ValueParameter<BoolValue>)Parameters["CollectMinValueInResults"]; } 60 } 61 public ValueParameter<BoolValue> CollectMaxValueInResultsParameter { 62 get { return (ValueParameter<BoolValue>)Parameters["CollectMaxValueInResults"]; } 63 } 64 public ValueParameter<BoolValue> CollectAverageValueInResultsParameter { 65 get { return (ValueParameter<BoolValue>)Parameters["CollectAverageValueInResults"]; } 66 } 58 67 #endregion 59 68 … … 62 71 get { return (MinAverageMaxValueCalculator)OperatorGraph.InitialOperator; } 63 72 } 73 private BoolValue CollectMinValueInResults { 74 get { return CollectMinValueInResultsParameter.Value; } 75 } 76 private BoolValue CollectMaxValueInResults { 77 get { return CollectMaxValueInResultsParameter.Value; } 78 } 79 private BoolValue CollectAverageValueInResults { 80 get { return CollectAverageValueInResultsParameter.Value; } 81 } 64 82 #endregion 65 83 [Storable] 84 private ResultsCollector resultsCollector; 66 85 public MinAverageMaxValueAnalyzer() 67 86 : base() { … … 69 88 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Value", "The value contained in the scope tree which should be analyzed.")); 70 89 Parameters.Add(new ValueLookupParameter<DoubleValue>("MinValue", "The minimum of the value.")); 90 Parameters.Add(new ValueParameter<BoolValue>("CollectMinValueInResults", "Determines if the minimum of the value should also be stored in the results.", new BoolValue(true))); 71 91 Parameters.Add(new ValueLookupParameter<DoubleValue>("AverageValue", "The average of the value.")); 92 Parameters.Add(new ValueParameter<BoolValue>("CollectAverageValueInResults", "Determines if the average of the value should also be stored in the results.", new BoolValue(true))); 72 93 Parameters.Add(new ValueLookupParameter<DoubleValue>("MaxValue", "The maximum of the value.")); 94 Parameters.Add(new ValueParameter<BoolValue>("CollectMaxValueInResults", "Determines if the maximum of the value should also be stored in the results.", new BoolValue(true))); 73 95 Parameters.Add(new ValueLookupParameter<DataTable>("Values", "The data table to store the minimum, average and maximum of the value.")); 74 96 Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The results collection where the analysis values should be stored.")); … … 78 100 MinAverageMaxValueCalculator minAverageMaxValueCalculator = new MinAverageMaxValueCalculator(); 79 101 DataTableValuesCollector dataTableValuesCollector = new DataTableValuesCollector(); 80 ResultsCollectorresultsCollector = new ResultsCollector();102 resultsCollector = new ResultsCollector(); 81 103 82 104 minAverageMaxValueCalculator.AverageValueParameter.ActualName = AverageValueParameter.Name; … … 91 113 dataTableValuesCollector.DataTableParameter.ActualName = ValuesParameter.Name; 92 114 93 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("MinValue", null, MinValueParameter.Name)); 94 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("AverageValue", null, AverageValueParameter.Name)); 95 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("MaxValue", null, MaxValueParameter.Name)); 115 if (CollectMinValueInResults.Value) 116 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("MinValue", null, MinValueParameter.Name)); 117 if (CollectAverageValueInResults.Value) 118 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("AverageValue", null, AverageValueParameter.Name)); 119 if (CollectMaxValueInResults.Value) 120 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("MaxValue", null, MaxValueParameter.Name)); 96 121 resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(ValuesParameter.Name)); 97 122 resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name; … … 113 138 private void Initialize() { 114 139 ValueParameter.DepthChanged += new EventHandler(ValueParameter_DepthChanged); 140 CollectMinValueInResultsParameter.ValueChanged += new EventHandler(CollectMinValueInResultsParameter_ValueChanged); 141 CollectMinValueInResultsParameter.Value.ValueChanged += new EventHandler(CollectMinValueInResultsParameter_ValueChanged); 142 CollectMaxValueInResultsParameter.ValueChanged += new EventHandler(CollectMaxValueInResultsParameter_ValueChanged); 143 CollectMaxValueInResultsParameter.Value.ValueChanged += new EventHandler(CollectMaxValueInResultsParameter_ValueChanged); 144 CollectAverageValueInResultsParameter.ValueChanged += new EventHandler(CollectAverageValueInResultsParameter_ValueChanged); 145 CollectAverageValueInResultsParameter.Value.ValueChanged += new EventHandler(CollectAverageValueInResultsParameter_ValueChanged); 146 } 147 148 private void CollectAverageValueInResultsParameter_ValueChanged(object sender, EventArgs e) { 149 if (CollectAverageValueInResults.Value) 150 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("AverageValue", null, AverageValueParameter.Name)); 151 else { 152 IParameter avgValueParameter; 153 resultsCollector.CollectedValues.TryGetValue("AverageValue", out avgValueParameter); 154 resultsCollector.CollectedValues.Remove(avgValueParameter); 155 } 156 } 157 158 private void CollectMaxValueInResultsParameter_ValueChanged(object sender, EventArgs e) { 159 if (CollectMaxValueInResults.Value) 160 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("MaxValue", null, MaxValueParameter.Name)); 161 else { 162 IParameter maxValueParameter; 163 resultsCollector.CollectedValues.TryGetValue("MaxValue", out maxValueParameter); 164 resultsCollector.CollectedValues.Remove(maxValueParameter); 165 } 166 } 167 168 private void CollectMinValueInResultsParameter_ValueChanged(object sender, EventArgs e) { 169 if (CollectMinValueInResults.Value) 170 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("MinValue", null, MinValueParameter.Name)); 171 else { 172 IParameter minValueParameter; 173 resultsCollector.CollectedValues.TryGetValue("MinValue", out minValueParameter); 174 resultsCollector.CollectedValues.Remove(minValueParameter); 175 } 115 176 } 116 177
Note: See TracChangeset
for help on using the changeset viewer.