/// <summary> /// /// </summary> /// <param name="fileAndContent"></param> /// <param name="maxClusterSize"></param> /// <returns></returns> public static TextFileClassifier GetInstance( IDictionary <string, string> fileAndContent, int maxClusterSize = -1) { Queue <Task <Point> > tasks = new Queue <Task <Point> >(); foreach (KeyValuePair <string, string> kvp in fileAndContent) { tasks.Enqueue( new Task <Point>( () => { return(new Text(kvp.Value, kvp.Key)); } ) ); } QueueBasedTaskRunner <Point> runner = new QueueBasedTaskRunner <Point>(tasks); runner.RunParallel(); TextFileClassifier TheInstance = new TextFileClassifier(); TheInstance.ClusterIdentifier = new KMinSpanningTree(runner.GetResult().ToArray(), maxClusterSize); return(TheInstance); }
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()); }