public static List <ParallelSearchResult> ArrayThreadTask(object paramObj) { ParallelSearchThreadParam param = (ParallelSearchThreadParam)paramObj; //Слово для поиска в верхнем регистре string wordUpper = param.wordPattern.Trim().ToUpper(); //Результаты поиска в одном потоке List <ParallelSearchResult> Result = new List <ParallelSearchResult>(); //Перебор всех слов во временном списке данного потока foreach (string str in param.tempList) { //Вычисление расстояния Дамерау-Левенштейна int dist = Libs.Distance(str.ToUpper(), wordUpper); if (dist <= param.maxDist) { ParallelSearchResult temp = new ParallelSearchResult() { word = str, dist = dist, ThreadNum = param.ThreadNum }; Result.Add(temp); } } return(Result); }
public static List <ParallelSearchResult> ArrayThreadTask(object paramObj) { ParallelSearchThreadParam param = (ParallelSearchThreadParam)paramObj; string wordUpper = param.wordPattern.Trim().ToUpper(); List <ParallelSearchResult> Result = new List <ParallelSearchResult>(); foreach (string str in param.tempList) { int dist = Levenshtain.Distance(str.ToUpper(), wordUpper); if (dist <= param.maxDist) { ParallelSearchResult temp = new ParallelSearchResult() { word = str, dist = dist, ThreadNum = param.ThreadNum }; Result.Add(temp); } } return(Result); }
public static List <ParallelSearchResult> arrayThreadTask(object p) { ParallelSearchThreadParam param = (ParallelSearchThreadParam)p; string wordUpper = param.wordToFind.Trim().ToUpper(); List <ParallelSearchResult> result = new List <ParallelSearchResult>(); foreach (string str in param.wordsList) { int dist = Distance.CalculateDistance(str.ToUpper(), wordUpper); if (dist <= param.maxDist) { ParallelSearchResult t = new ParallelSearchResult(str, dist, param.threadNum); result.Add(t); } } return(result); }