private static IDictionary GetDatasetCategories( [NotNull] IEnumerable <SpecificationDataset> specificationDatasets, [NotNull] IComparer <DatasetCategoryItem> categoryComparer, [NotNull] IComparer <Dataset> datasetComparer) { IDictionary result = new SortedDictionary <DatasetCategoryItem, object>( categoryComparer); foreach (SpecificationDataset specificationDataset in specificationDatasets) { QualityCondition condition = specificationDataset.QualityCondition; if (condition == null) { continue; } foreach (Dataset dataset in condition.GetDatasetParameterValues()) { var datasetCategoryItem = new DatasetCategoryItem(dataset.DatasetCategory); if (result.Contains(datasetCategoryItem)) { continue; } IDictionary datasetDict = new SortedDictionary <Dataset, object>(datasetComparer); result.Add(datasetCategoryItem, datasetDict); } } return(result); }
private static IDictionary GetLayersPerCategory( [NotNull] ICollection <SpecificationDataset> allSpecList, [NotNull] IComparer <DatasetCategoryItem> categorySorter, [NotNull] IComparer <Dataset> datasetSorter, [NotNull] IComparer <SpecificationDataset> specSorter) { IDictionary result = GetDatasetCategories(allSpecList, categorySorter, datasetSorter); foreach (SpecificationDataset specificationDataset in allSpecList) { QualityCondition condition = specificationDataset.QualityCondition; if (condition == null) { continue; } // List specification only once per dataset ==> var uniqueDatasets = new Dictionary <string, Dataset>(); foreach (Dataset dataset in condition.GetDatasetParameterValues()) { if (uniqueDatasets.ContainsKey(dataset.Name)) { continue; } uniqueDatasets.Add(dataset.Name, dataset); var datasetCategoryItem = new DatasetCategoryItem(dataset.DatasetCategory); var datasetList = (IDictionary)result[datasetCategoryItem]; List <SpecificationDataset> specList; if (datasetList.Contains(dataset)) { specList = (List <SpecificationDataset>)datasetList[dataset]; } else { specList = new List <SpecificationDataset>(); datasetList.Add(dataset, specList); } specList.Add(specificationDataset); } } SortSpecifications(result, specSorter); return(result); }