/// <summary> /// This method will produce a JSON object that contains all the data from /// the current instance. Only focusing upon fail events, this method will /// firstly group the events by the start MixBand only, and then by the /// start and end MixBand values. /// </summary> /// <returns>A well formed JSON string</returns> public String CreateFailMixBandJSON() { // Create a new JSONResults Data Structure JSONResults json = new JSONResults(WeekNumber); // Loop over all clusters in this week foreach (KeyValuePair <int, ClusterAnalysis> pair in ClustersAnalysis) { // Get the Drop Analysis object FailAnalysis analysis = pair.Value.FailAnalysis; // Used to stores the split up events List <String> keys = analysis.GroupByStartMixBand().Keys.ToList(); AnalysisResultsCollection groups = new AnalysisResultsCollection(keys); // Get the Analysis result AnalysisResults results = analysis.GroupByStartEndMixBand(); // Loop over each result foreach (KeyValuePair <String, EventCollection> p in results) { // Calculate the Key String key = p.Value[0].StartMixBand; // Add into the array groups[key].Add(p.Key, p.Value); } // Add the Mix-Band goup to the JSONResults Data Structure json.Add(pair.Key, groups); } // return the JSON data structure for this week return(json.ToString()); }