Index: branches/histogram/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityDistributionAnalyzer.cs
===================================================================
--- branches/histogram/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityDistributionAnalyzer.cs	(revision 5994)
+++ branches/histogram/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityDistributionAnalyzer.cs	(revision 6013)
@@ -30,7 +30,7 @@
 
 namespace HeuristicLab.Analysis.QualityAnalysis {
-  [Item("Quality Distribution Analyzer", "Analyzes the distribution of the quality values in that it adds a Histogram of them into the result collection.")]
+  [Item("QualityDistributionAnalyzer", "Analyzes the distribution of the quality values in that it adds a Histogram of them into the result collection.")]
   [StorableClass]
-  public class QualityDistributionAnalyzer : SingleSuccessorOperator, IAnalyzer {
+  public class QualityDistributionAnalyzer : SingleSuccessorOperator, IAnalyzer, IIterationBasedOperator {
 
     #region Parameter properties
@@ -41,8 +41,27 @@
       get { return (IValueLookupParameter<ResultCollection>)Parameters["Results"]; }
     }
-    public IValueParameter<StringValue> HistogramNameParameter {
-      get { return (IValueParameter<StringValue>)Parameters["HistogramName"]; }
+    private ValueParameter<StringValue> HistogramNameParameter {
+      get { return (ValueParameter<StringValue>)Parameters["HistogramName"]; }
+    }
+    private ValueParameter<BoolValue> StoreHistoryParameter {
+      get { return (ValueParameter<BoolValue>)Parameters["StoreHistory"]; }
+    }
+    public ILookupParameter<IntValue> IterationsParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["Iterations"]; }
+    }
+    public IValueLookupParameter<IntValue> MaximumIterationsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["MaximumIterations"]; }
     }
     #endregion
+
+    public string HistogramName {
+      get { return HistogramNameParameter.Value.Value; }
+      set { HistogramNameParameter.Value.Value = value; }
+    }
+
+    public bool StoreHistory {
+      get { return StoreHistoryParameter.Value.Value; }
+      set { StoreHistoryParameter.Value.Value = value; }
+    }
 
     [StorableConstructor]
@@ -55,5 +74,13 @@
       Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution."));
       Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection where the analysis values should be stored."));
-      Parameters.Add(new ValueParameter<StringValue>("HistogramName", "The name of the histogram that gets injected in to the results collection.", new StringValue("QualityDistribution")));
+      Parameters.Add(new FixedValueParameter<StringValue>("HistogramName", "The name of the histogram that gets injected in to the results collection.", new StringValue("Quality Distribution")));
+      Parameters.Add(new FixedValueParameter<BoolValue>("StoreHistory", "True if the history should be stored in addition to the current distribution", new BoolValue(false)));
+      Parameters.Add(new LookupParameter<IntValue>("Iterations", "Optional: A value indicating the current iteration."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumIterations", "Unused", new IntValue(-1)));
+
+      QualityParameter.Hidden = true;
+      ResultsParameter.Hidden = true;
+      IterationsParameter.Hidden = true;
+      MaximumIterationsParameter.Hidden = true;
     }
 
@@ -63,20 +90,45 @@
 
     public override IOperation Apply() {
-      HistogramHistory qualityDistribution = null;
+      DataTable qualityDistribution = null;
       ResultCollection results = ResultsParameter.ActualValue;
       string description = "Shows the quality distributions in the current population.";
-      string resultName = HistogramNameParameter.Value.Value;
-      if (results.ContainsKey(resultName)) {
-        qualityDistribution = results[resultName].Value as HistogramHistory;
+      if (results.ContainsKey(HistogramName)) {
+        qualityDistribution = results[HistogramName].Value as DataTable;
       } else {
-        qualityDistribution = new HistogramHistory();
-        results.Add(new Result(resultName, description, qualityDistribution));
+        qualityDistribution = new DataTable("Population Quality Distribution", description);
+        qualityDistribution.VisualProperties.XAxisTitle = IterationsParameter.ActualName;
+        qualityDistribution.VisualProperties.YAxisTitle = QualityParameter.ActualName;
+        results.Add(new Result(HistogramName, description, qualityDistribution));
       }
-      Histogram histogram = new Histogram("History " + qualityDistribution.Count, description);
+      DataRow row;
+      if (!qualityDistribution.Rows.TryGetValue("QualityDistribution", out row)) {
+        row = new DataRow("QualityDistribution");
+        row.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
+        qualityDistribution.Rows.Add(row);
+      }
       var qualities = QualityParameter.ActualValue;
-      histogram.Values.Clear();
-      histogram.Values.AddRange(qualities.Select(x => x.Value));
-      qualityDistribution.Add(histogram);
+      row.Values.Clear();
+      row.Values.AddRange(qualities.Select(x => x.Value));
 
+      if (StoreHistory) {
+        string historyResultName = HistogramName + " History";
+        DataTableHistory qdHistory = null;
+        if (results.ContainsKey(historyResultName)) {
+          qdHistory = results[historyResultName].Value as DataTableHistory;
+        } else {
+          qdHistory = new DataTableHistory();
+          results.Add(new Result(historyResultName, qdHistory));
+        }
+        DataTable table = (DataTable)qualityDistribution.Clone();
+        IntValue iteration = IterationsParameter.ActualValue;
+        if (iteration != null) {
+          string iterationName = IterationsParameter.ActualName;
+          if (iterationName.EndsWith("s")) iterationName = iterationName.Remove(iterationName.Length - 1);
+          string appendix = " at " + iterationName + " " + iteration.Value.ToString();
+          table.Name += appendix;
+          table.Rows["QualityDistribution"].Name += appendix;
+        }
+        qdHistory.Add(table);
+      }
       return base.Apply();
     }
