Skip to content

Commit e9a0be2

Browse files
authored
Replace LinkedDictionary with OrderedDictionary (#1200)
Replaced all usages of JCG.LinkedDictionary with JCG.OrderedDictionary across the codebase for consistency and to better match the semantics of LinkedHashMap in the JDK. Updated comments to clarify the change as Lucene.NET specific.
1 parent 21a9882 commit e9a0be2

File tree

18 files changed

+52
-29
lines changed

18 files changed

+52
-29
lines changed

src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ private void ReadAffixFile(Stream affixStream, Encoding decoder)
290290
patterns.Add(null);
291291

292292
// zero strip -> 0 ord
293-
IDictionary<string, int> seenStrips = new JCG.LinkedDictionary<string, int>
293+
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
294+
IDictionary<string, int> seenStrips = new JCG.OrderedDictionary<string, int>
294295
{
295296
[""] = 0
296297
};

src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PerFieldAnalyzerWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public PerFieldAnalyzerWrapper(Analyzer defaultAnalyzer)
8585
/// <description>Use when sorted keys are required. <c>null</c> keys are supported.</description>
8686
/// </item>
8787
/// <item>
88-
/// <term><see cref="JCG.LinkedDictionary{TKey, TValue}"/></term>
88+
/// <term><see cref="JCG.OrderedDictionary{TKey, TValue}"/></term>
8989
/// <description>Use when insertion order must be preserved (<see cref="Dictionary{TKey, TValue}"/> preserves insertion
9090
/// order only until items are removed). <c>null</c> keys are supported.</description>
9191
/// </item>

src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public void Reload()
6363
UninterruptableMonitor.Enter(this);
6464
try
6565
{
66-
IDictionary<string, Type> services = new JCG.LinkedDictionary<string, Type>(this.services);
66+
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
67+
IDictionary<string, Type> services = new JCG.OrderedDictionary<string, Type>(this.services);
6768
SPIClassIterator<S> loader = SPIClassIterator<S>.Get();
6869

6970
foreach (var service in loader)

src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameRoundTask.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public override int DoLogic()
5555
protected virtual Report ReportSumByNameRound(IList<TaskStats> taskStats)
5656
{
5757
// aggregate by task name and round
58-
JCG.LinkedDictionary<string, TaskStats> p2 = new JCG.LinkedDictionary<string, TaskStats>();
58+
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
59+
JCG.OrderedDictionary<string, TaskStats> p2 = new JCG.OrderedDictionary<string, TaskStats>();
5960
int reported = 0;
6061
foreach (TaskStats stat1 in taskStats)
6162
{

src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameTask.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ protected virtual Report ReportSumByName(IList<TaskStats> taskStats)
5656
{
5757
// aggregate by task name
5858
int reported = 0;
59-
JCG.LinkedDictionary<string, TaskStats> p2 = new JCG.LinkedDictionary<string, TaskStats>();
59+
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
60+
JCG.OrderedDictionary<string, TaskStats> p2 = new JCG.OrderedDictionary<string, TaskStats>();
6061
foreach (TaskStats stat1 in taskStats)
6162
{
6263
if (stat1.Elapsed >= 0)

src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefRoundTask.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ protected virtual Report ReportSumByPrefixRound(IList<TaskStats> taskStats)
5151
{
5252
// aggregate by task name and by round
5353
int reported = 0;
54-
JCG.LinkedDictionary<string, TaskStats> p2 = new JCG.LinkedDictionary<string, TaskStats>();
54+
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
55+
JCG.OrderedDictionary<string, TaskStats> p2 = new JCG.OrderedDictionary<string, TaskStats>();
5556
foreach (TaskStats stat1 in taskStats)
5657
{
5758
if (stat1.Elapsed >= 0 && stat1.Task.GetName().StartsWith(m_prefix, StringComparison.Ordinal))

src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefTask.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ protected virtual Report ReportSumByPrefix(IList<TaskStats> taskStats)
5353
{
5454
// aggregate by task name
5555
int reported = 0;
56-
JCG.LinkedDictionary<string, TaskStats> p2 = new JCG.LinkedDictionary<string, TaskStats>();
56+
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
57+
JCG.OrderedDictionary<string, TaskStats> p2 = new JCG.OrderedDictionary<string, TaskStats>();
5758
foreach (TaskStats stat1 in taskStats)
5859
{
5960
if (stat1.Elapsed >= 0 && stat1.Task.GetName().StartsWith(m_prefix, StringComparison.Ordinal))

src/Lucene.Net.Benchmark/ByTask/Tasks/ReportTask.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ protected virtual string TaskReportLine(string longestOp, TaskStats stat)
130130
return sb.ToString();
131131
}
132132

133-
protected virtual Report GenPartialReport(int reported, JCG.LinkedDictionary<string, TaskStats> partOfTasks, int totalSize)
133+
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
134+
protected virtual Report GenPartialReport(int reported, JCG.OrderedDictionary<string, TaskStats> partOfTasks, int totalSize)
134135
{
135136
string longetOp = LongestOp(partOfTasks.Values);
136137
bool first = true;

src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ private static MethodInfo GetMethod(Type type, string method, Type[] parms)
8989

9090
private readonly string sourceText;
9191

92-
private readonly IDictionary<string, int> externalsMap = new JCG.LinkedDictionary<string, int>();
92+
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
93+
private readonly IDictionary<string, int> externalsMap = new JCG.OrderedDictionary<string, int>();
9394

9495
private TypeBuilder dynamicType;
9596

src/Lucene.Net.Facet/DrillDownQuery.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ public static Term Term(string field, string dim, params string[] path)
7676

7777
private readonly FacetsConfig config;
7878
private readonly BooleanQuery query;
79-
private readonly IDictionary<string, int> drillDownDims = new JCG.LinkedDictionary<string, int>();
79+
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
80+
private readonly IDictionary<string, int> drillDownDims = new JCG.OrderedDictionary<string, int>();
8081

8182
/// <summary>
8283
/// Used by <see cref="Clone"/>

0 commit comments

Comments
 (0)