Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ private void ReadAffixFile(Stream affixStream, Encoding decoder)
patterns.Add(null);

// zero strip -> 0 ord
IDictionary<string, int> seenStrips = new JCG.LinkedDictionary<string, int>
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
IDictionary<string, int> seenStrips = new JCG.OrderedDictionary<string, int>
{
[""] = 0
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public PerFieldAnalyzerWrapper(Analyzer defaultAnalyzer)
/// <description>Use when sorted keys are required. <c>null</c> keys are supported.</description>
/// </item>
/// <item>
/// <term><see cref="JCG.LinkedDictionary{TKey, TValue}"/></term>
/// <term><see cref="JCG.OrderedDictionary{TKey, TValue}"/></term>
/// <description>Use when insertion order must be preserved (<see cref="Dictionary{TKey, TValue}"/> preserves insertion
/// order only until items are removed). <c>null</c> keys are supported.</description>
/// </item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public void Reload()
UninterruptableMonitor.Enter(this);
try
{
IDictionary<string, Type> services = new JCG.LinkedDictionary<string, Type>(this.services);
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
IDictionary<string, Type> services = new JCG.OrderedDictionary<string, Type>(this.services);
SPIClassIterator<S> loader = SPIClassIterator<S>.Get();

foreach (var service in loader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public override int DoLogic()
protected virtual Report ReportSumByNameRound(IList<TaskStats> taskStats)
{
// aggregate by task name and round
JCG.LinkedDictionary<string, TaskStats> p2 = new JCG.LinkedDictionary<string, TaskStats>();
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
JCG.OrderedDictionary<string, TaskStats> p2 = new JCG.OrderedDictionary<string, TaskStats>();
int reported = 0;
foreach (TaskStats stat1 in taskStats)
{
Expand Down
3 changes: 2 additions & 1 deletion src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ protected virtual Report ReportSumByName(IList<TaskStats> taskStats)
{
// aggregate by task name
int reported = 0;
JCG.LinkedDictionary<string, TaskStats> p2 = new JCG.LinkedDictionary<string, TaskStats>();
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
JCG.OrderedDictionary<string, TaskStats> p2 = new JCG.OrderedDictionary<string, TaskStats>();
foreach (TaskStats stat1 in taskStats)
{
if (stat1.Elapsed >= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ protected virtual Report ReportSumByPrefixRound(IList<TaskStats> taskStats)
{
// aggregate by task name and by round
int reported = 0;
JCG.LinkedDictionary<string, TaskStats> p2 = new JCG.LinkedDictionary<string, TaskStats>();
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
JCG.OrderedDictionary<string, TaskStats> p2 = new JCG.OrderedDictionary<string, TaskStats>();
foreach (TaskStats stat1 in taskStats)
{
if (stat1.Elapsed >= 0 && stat1.Task.GetName().StartsWith(m_prefix, StringComparison.Ordinal))
Expand Down
3 changes: 2 additions & 1 deletion src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ protected virtual Report ReportSumByPrefix(IList<TaskStats> taskStats)
{
// aggregate by task name
int reported = 0;
JCG.LinkedDictionary<string, TaskStats> p2 = new JCG.LinkedDictionary<string, TaskStats>();
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
JCG.OrderedDictionary<string, TaskStats> p2 = new JCG.OrderedDictionary<string, TaskStats>();
foreach (TaskStats stat1 in taskStats)
{
if (stat1.Elapsed >= 0 && stat1.Task.GetName().StartsWith(m_prefix, StringComparison.Ordinal))
Expand Down
3 changes: 2 additions & 1 deletion src/Lucene.Net.Benchmark/ByTask/Tasks/ReportTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ protected virtual string TaskReportLine(string longestOp, TaskStats stat)
return sb.ToString();
}

protected virtual Report GenPartialReport(int reported, JCG.LinkedDictionary<string, TaskStats> partOfTasks, int totalSize)
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
protected virtual Report GenPartialReport(int reported, JCG.OrderedDictionary<string, TaskStats> partOfTasks, int totalSize)
{
string longetOp = LongestOp(partOfTasks.Values);
bool first = true;
Expand Down
3 changes: 2 additions & 1 deletion src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ private static MethodInfo GetMethod(Type type, string method, Type[] parms)

private readonly string sourceText;

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

private TypeBuilder dynamicType;

Expand Down
3 changes: 2 additions & 1 deletion src/Lucene.Net.Facet/DrillDownQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public static Term Term(string field, string dim, params string[] path)

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

/// <summary>
/// Used by <see cref="Clone"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public FunctionDistinctValuesCollector(IDictionary /*Map<?, ?>*/ vsContext, Valu
this.vsContext = vsContext;
this.groupSource = groupSource;
this.countSource = countSource;
groupMap = new JCG.LinkedDictionary<MutableValue, GroupCount>();
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
groupMap = new JCG.OrderedDictionary<MutableValue, GroupCount>();
foreach (SearchGroup<MutableValue> group in groups)
{
groupMap[group.GroupValue] = new GroupCount(group.GroupValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public StandardQueryConfigHandler()
Set(ConfigurationKeys.PHRASE_SLOP, 0); //default value 2.4
Set(ConfigurationKeys.LOWERCASE_EXPANDED_TERMS, true); //default value 2.4
Set(ConfigurationKeys.ENABLE_POSITION_INCREMENTS, false); //default value 2.4
Set(ConfigurationKeys.FIELD_BOOST_MAP, new JCG.LinkedDictionary<string, float>());
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
Set(ConfigurationKeys.FIELD_BOOST_MAP, new JCG.OrderedDictionary<string, float>());
Set(ConfigurationKeys.FUZZY_CONFIG, new FuzzyConfig());
Set(ConfigurationKeys.LOCALE, null);
Set(ConfigurationKeys.MULTI_TERM_REWRITE_METHOD, MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT);
Expand Down
3 changes: 2 additions & 1 deletion src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,8 @@ private IndexContext CreateIndexContext()
if (!searchTermToGroupCounts.TryGetValue(content, out var groupToCounts))
{
// Groups sort always DOCID asc...
searchTermToGroupCounts.Add(content, groupToCounts = new JCG.LinkedDictionary<string, ISet<string>>());
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
searchTermToGroupCounts.Add(content, groupToCounts = new JCG.OrderedDictionary<string, ISet<string>>());
contentStrings.Add(content);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,8 @@ public virtual void TestComplex06()
[Test]
public virtual void TestWeightedTerm()
{
IDictionary<string, float> weights = new JCG.LinkedDictionary<string, float>();
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
IDictionary<string, float> weights = new JCG.OrderedDictionary<string, float>();
weights["field0"] = 5f;
weights["field1"] = 10f;

Expand All @@ -562,7 +563,8 @@ public virtual void TestWeightedTerm()
[Test]
public virtual void TestWeightedOR()
{
IDictionary<string, float> weights = new JCG.LinkedDictionary<string, float>();
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
IDictionary<string, float> weights = new JCG.OrderedDictionary<string, float>();
weights["field0"] = 5f;
weights["field1"] = 10f;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,10 @@ private void doTest(SpatialOperation operation)
bool biasContains = (operation == SpatialOperation.Contains);

//Main index loop:
IDictionary<String, IShape> indexedShapes = new JCG.LinkedDictionary<String, IShape>();
IDictionary<String, IShape> indexedShapesGS = new JCG.LinkedDictionary<String, IShape>();//grid snapped
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
IDictionary<String, IShape> indexedShapes = new JCG.OrderedDictionary<String, IShape>();
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
IDictionary<String, IShape> indexedShapesGS = new JCG.OrderedDictionary<String, IShape>(); //grid snapped
int numIndexedShapes = randomIntBetween(1, 6);
#pragma warning disable 219
bool indexedAtLeastOneShapePair = false;
Expand Down
16 changes: 10 additions & 6 deletions src/Lucene.Net/Index/BufferedUpdates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ load factor (say 2 * POINTER). Entry is object w/
// one that came in wins), and helps us detect faster if the same Term is
// used to update the same field multiple times (so we later traverse it
// only once).
internal readonly SCG.IDictionary<string, LinkedDictionary<Term, NumericDocValuesUpdate>> numericUpdates = new Dictionary<string, LinkedDictionary<Term, NumericDocValuesUpdate>>();
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
internal readonly SCG.IDictionary<string, OrderedDictionary<Term, NumericDocValuesUpdate>> numericUpdates = new Dictionary<string, OrderedDictionary<Term, NumericDocValuesUpdate>>();

// Map<dvField,Map<updateTerm,BinaryUpdate>>
// For each field we keep an ordered list of BinaryUpdates, key'd by the
Expand All @@ -139,7 +140,8 @@ load factor (say 2 * POINTER). Entry is object w/
// one that came in wins), and helps us detect faster if the same Term is
// used to update the same field multiple times (so we later traverse it
// only once).
internal readonly SCG.IDictionary<string, LinkedDictionary<Term, BinaryDocValuesUpdate>> binaryUpdates = new Dictionary<string, LinkedDictionary<Term, BinaryDocValuesUpdate>>();
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
internal readonly SCG.IDictionary<string, OrderedDictionary<Term, BinaryDocValuesUpdate>> binaryUpdates = new Dictionary<string, OrderedDictionary<Term, BinaryDocValuesUpdate>>();

/// <summary>
/// NOTE: This was MAX_INT in Lucene
Expand Down Expand Up @@ -245,9 +247,10 @@ internal virtual void AddTerm(Term term, int docIDUpto) // LUCENENET specific -

internal virtual void AddNumericUpdate(NumericDocValuesUpdate update, int docIDUpto) // LUCENENET specific - Made internal rather than public, since this class is intended to be internal but couldn't be because it is exposed through a public API
{
if (!numericUpdates.TryGetValue(update.field, out LinkedDictionary<Term, NumericDocValuesUpdate> fieldUpdates))
if (!numericUpdates.TryGetValue(update.field, out OrderedDictionary<Term, NumericDocValuesUpdate> fieldUpdates))
{
fieldUpdates = new LinkedDictionary<Term, NumericDocValuesUpdate>();
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
fieldUpdates = new OrderedDictionary<Term, NumericDocValuesUpdate>();
numericUpdates[update.field] = fieldUpdates;
bytesUsed.AddAndGet(BYTES_PER_NUMERIC_FIELD_ENTRY);
}
Expand Down Expand Up @@ -278,9 +281,10 @@ internal virtual void AddNumericUpdate(NumericDocValuesUpdate update, int docIDU

internal virtual void AddBinaryUpdate(BinaryDocValuesUpdate update, int docIDUpto) // LUCENENET specific - Made internal rather than public, since this class is intended to be internal but couldn't be because it is exposed through a public API
{
if (!binaryUpdates.TryGetValue(update.field, out LinkedDictionary<Term, BinaryDocValuesUpdate> fieldUpdates))
if (!binaryUpdates.TryGetValue(update.field, out OrderedDictionary<Term, BinaryDocValuesUpdate> fieldUpdates))
{
fieldUpdates = new LinkedDictionary<Term, BinaryDocValuesUpdate>();
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
fieldUpdates = new OrderedDictionary<Term, BinaryDocValuesUpdate>();
binaryUpdates[update.field] = fieldUpdates;
bytesUsed.AddAndGet(BYTES_PER_BINARY_FIELD_ENTRY);
}
Expand Down
9 changes: 5 additions & 4 deletions src/Lucene.Net/Search/SloppyPhraseScorer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ private void SortRptGroups(IList<IList<PhrasePositions>> rgs)

/// <summary>
/// Detect repetition groups. Done once - for first doc. </summary>
private IList<IList<PhrasePositions>> GatherRptGroups(JCG.LinkedDictionary<Term, int> rptTerms)
private IList<IList<PhrasePositions>> GatherRptGroups(JCG.OrderedDictionary<Term, int> rptTerms)
{
PhrasePositions[] rpp = RepeatingPPs(rptTerms);
IList<IList<PhrasePositions>> res = new JCG.List<IList<PhrasePositions>>();
Expand Down Expand Up @@ -534,9 +534,10 @@ private static int TpPos(PhrasePositions pp) // LUCENENET: CA1822: Mark members

/// <summary>
/// Find repeating terms and assign them ordinal values </summary>
private JCG.LinkedDictionary<Term, int> RepeatingTerms()
private JCG.OrderedDictionary<Term, int> RepeatingTerms()
{
JCG.LinkedDictionary<Term, int> tord = new JCG.LinkedDictionary<Term, int>();
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
JCG.OrderedDictionary<Term, int> tord = new JCG.OrderedDictionary<Term, int>();
Dictionary<Term, int> tcnt = new Dictionary<Term, int>();
for (PhrasePositions pp = min, prev = null; prev != max; pp = (prev = pp).next) // iterate cyclic list: done once handled max
{
Expand Down Expand Up @@ -618,7 +619,7 @@ private static void UnionTermGroups(IList<FixedBitSet> bb) // LUCENENET: CA1822:

/// <summary>
/// Map each term to the single group that contains it </summary>
private static IDictionary<Term, int> TermGroups(JCG.LinkedDictionary<Term, int> tord, IList<FixedBitSet> bb) // LUCENENET: CA1822: Mark members as static
private static IDictionary<Term, int> TermGroups(JCG.OrderedDictionary<Term, int> tord, IList<FixedBitSet> bb) // LUCENENET: CA1822: Mark members as static
{
Dictionary<Term, int> tg = new Dictionary<Term, int>();
Term[] t = tord.Keys.ToArray(/*new Term[0]*/);
Expand Down
6 changes: 4 additions & 2 deletions src/Lucene.Net/Util/AttributeSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,10 @@ public AttributeSource(AttributeSource input)
/// </summary>
public AttributeSource(AttributeFactory factory)
{
this.attributes = new JCG.LinkedDictionary<Type, Util.Attribute>();
this.attributeImpls = new JCG.LinkedDictionary<Type, Util.Attribute>();
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
this.attributes = new JCG.OrderedDictionary<Type, Util.Attribute>();
// LUCENENET specific: OrderedDictioary<TKey, TValue> is a replacement for LinkedHashMap<K, V> in the JDK
this.attributeImpls = new JCG.OrderedDictionary<Type, Util.Attribute>();
this.currentState = new State[1];
this.factory = factory;
}
Expand Down