Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
rampaa committed Dec 11, 2023
1 parent 8c25d2e commit 692f2f0
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions JL.Core/Lookup/LookupUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -865,8 +865,8 @@ private static List<string> GetSearchKeysFromEpwingNazekaRecord(Dictionary<strin
return searchKeys.ToList();
}

private static ConcurrentBag<LookupResult> BuildJmdictResult(
Dictionary<string, IntermediaryResult> jmdictResults, List<Freq> dbFreqs, bool useDBForPitchDict, Dict? pitchDict)
private static List<LookupResult> BuildJmdictResult(
Dictionary<string, IntermediaryResult> jmdictResults, List<Freq> dbFreqs, bool useDBForPitchDict, Dict? pitchDict)
{
IDictionary<string, Dictionary<string, List<FrequencyRecord>>>? frequencyDicts = null;
Dictionary<string, IList<IDictRecord>>? pitchAccentDict = null;
Expand All @@ -892,8 +892,8 @@ private static ConcurrentBag<LookupResult> BuildJmdictResult(
bool showROrthographyInfo = dict.Options?.ROrthographyInfo?.Value ?? true;
bool showAOrthographyInfo = dict.Options?.AOrthographyInfo?.Value ?? true;

ConcurrentBag<LookupResult> results = new();
_ = Parallel.ForEach(jmdictResults.Values.ToList(), wordResult =>
List<LookupResult> results = new();
foreach (IntermediaryResult wordResult in jmdictResults.Values.ToList())
{
int resultsListCount = wordResult.Results.Count;
for (int i = 0; i < resultsListCount; i++)
Expand Down Expand Up @@ -982,13 +982,13 @@ private static ConcurrentBag<LookupResult> BuildJmdictResult(
results.Add(result);
}
}
});
}

return results;
}

private static ConcurrentBag<LookupResult> BuildJmnedictResult(
Dictionary<string, IntermediaryResult> jmnedictResults, bool useDBForPitchDict, Dict? pitchDict)
private static List<LookupResult> BuildJmnedictResult(
Dictionary<string, IntermediaryResult> jmnedictResults, bool useDBForPitchDict, Dict? pitchDict)
{
Dictionary<string, IList<IDictRecord>>? pitchAccentDict = null;
if (useDBForPitchDict)
Expand All @@ -997,8 +997,8 @@ private static ConcurrentBag<LookupResult> BuildJmnedictResult(
pitchAccentDict = YomichanPitchAccentDBManager.GetRecordsFromDB(pitchDict!.Name, searchKeys);
}

ConcurrentBag<LookupResult> results = new();
_ = Parallel.ForEach(jmnedictResults.Values.ToList(), nameResult =>
List<LookupResult> results = new();
foreach (IntermediaryResult nameResult in jmnedictResults.Values.ToList())
{
int resultsListCount = nameResult.Results.Count;
for (int i = 0; i < resultsListCount; i++)
Expand All @@ -1025,7 +1025,7 @@ private static ConcurrentBag<LookupResult> BuildJmnedictResult(
results.Add(result);
}
}
});
}

return results;
}
Expand Down Expand Up @@ -1118,8 +1118,8 @@ private static ConcurrentBag<LookupResult> BuildYomichanKanjiResult(
return results;
}

private static ConcurrentBag<LookupResult> BuildEpwingYomichanResult(
Dictionary<string, IntermediaryResult> epwingResults, List<Freq> dbFreqs, bool useDBForPitchDict, Dict? pitchDict)
private static List<LookupResult> BuildEpwingYomichanResult(
Dictionary<string, IntermediaryResult> epwingResults, List<Freq> dbFreqs, bool useDBForPitchDict, Dict? pitchDict)
{
IDictionary<string, Dictionary<string, List<FrequencyRecord>>>? frequencyDicts = null;
Dictionary<string, IList<IDictRecord>>? pitchAccentDict = null;
Expand All @@ -1141,8 +1141,8 @@ private static ConcurrentBag<LookupResult> BuildEpwingYomichanResult(
}
});

ConcurrentBag<LookupResult> results = new();
_ = Parallel.ForEach(epwingResults.Values.ToList(), wordResult =>
List<LookupResult> results = new();
foreach (IntermediaryResult wordResult in epwingResults.Values.ToList())
{
int resultsListCount = wordResult.Results.Count;
for (int i = 0; i < resultsListCount; i++)
Expand Down Expand Up @@ -1170,7 +1170,7 @@ private static ConcurrentBag<LookupResult> BuildEpwingYomichanResult(
results.Add(result);
}
}
});
}

return results;
}
Expand Down

0 comments on commit 692f2f0

Please sign in to comment.