protected void ConstructorHelper(IDictionary <string, string> FilesAndContent) // UNDONE: HOW TO Paralize??? { Queue <Task <Point> > tasks = new Queue <Task <Point> >(); foreach (KeyValuePair <string, string> kvp in FilesAndContent) { tasks.Enqueue( new Task <Point>( () => { return(new Text(kvp.Value, kvp.Key)); } ) ); } QueueBasedTaskRunner <Point> runner = new QueueBasedTaskRunner <Point>(tasks); runner.RunParallel(); ClusterIdentifier = new FullGraphClustering(runner.GetResult().ToArray()); }
/// <summary> /// Generate a report on the 2 clustering of files names. /// </summary> /// <returns></returns> public string GetReport() { StringBuilder sb1 = new StringBuilder("The first clusters of files: \n"); FullGraphClustering theFullGraph = FileCluster.ClusterIdentifier; IImmutableSet <Point> clusterMajor = theFullGraph.ClusterMajor; IImmutableSet <Point> clusterMinor = theFullGraph.ClusterMinor; // String for first cluster. foreach (Point p in clusterMajor) { Text t = p as Text; sb1.AppendLine($"\t{t.file_name}"); } sb1.AppendLine("This is the second cluster of files: "); foreach (Point p in clusterMinor) { Text t = p as Text; sb1.AppendLine($"\t{t.file_name}"); } return(sb1.ToString()); }