You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/02/02 12:42:45 UTC
[14/14] lucenenet git commit: SWEEP: Where used,
changed Dictionary/OrderedDictionary back to LinkedHashMap,
which is a better match of the LinkedHashMap in Java.
SWEEP: Where used, changed Dictionary/OrderedDictionary back to LinkedHashMap, which is a better match of the LinkedHashMap in Java.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/bc485b4c
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/bc485b4c
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/bc485b4c
Branch: refs/heads/api-work
Commit: bc485b4c42db371f93d90534ee30db6824baca2f
Parents: fc7b5b5
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Feb 2 19:41:38 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Feb 2 19:41:38 2017 +0700
----------------------------------------------------------------------
.../Analysis/Hunspell/Dictionary.cs | 2 +-
.../Analysis/Util/AnalysisSPILoader.cs | 2 +-
src/Lucene.Net.Core/Index/BufferedUpdates.cs | 40 ++++++++------------
.../JS/JavascriptCompiler.cs | 2 +-
src/Lucene.Net.Facet/DrillDownQuery.cs | 2 +-
.../Simple/TestSimpleQueryParser.cs | 4 +-
6 files changed, 21 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bc485b4c/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
index f8e3107..af966d1 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs
@@ -269,7 +269,7 @@ namespace Lucene.Net.Analysis.Hunspell
patterns.Add(null);
// zero strip -> 0 ord
- IDictionary<string, int?> seenStrips = new Dictionary<string, int?>();
+ IDictionary<string, int?> seenStrips = new LinkedHashMap<string, int?>();
seenStrips[""] = 0;
var reader = new StreamReader(affixStream, decoder);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bc485b4c/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs
index 5797c10..03b949d 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs
@@ -63,7 +63,7 @@ namespace Lucene.Net.Analysis.Util
{
lock (this)
{
- IDictionary<string, Type> services = new Dictionary<string, Type>(this.services);
+ IDictionary<string, Type> services = new LinkedHashMap<string, Type>(this.services);
SPIClassIterator<S> loader = SPIClassIterator<S>.Get();
foreach (var service in loader)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bc485b4c/src/Lucene.Net.Core/Index/BufferedUpdates.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/BufferedUpdates.cs b/src/Lucene.Net.Core/Index/BufferedUpdates.cs
index 764fdae..d03d298 100644
--- a/src/Lucene.Net.Core/Index/BufferedUpdates.cs
+++ b/src/Lucene.Net.Core/Index/BufferedUpdates.cs
@@ -123,25 +123,25 @@ namespace Lucene.Net.Index
internal readonly IDictionary<Term, int?> terms = new Dictionary<Term, int?>();
internal readonly IDictionary<Query, int?> queries = new Dictionary<Query, int?>();
internal readonly IList<int?> docIDs = new List<int?>();
-
+
// Map<dvField,Map<updateTerm,NumericUpdate>>
// For each field we keep an ordered list of NumericUpdates, key'd by the
- // update Term. OrderedDictionary guarantees we will later traverse the map in
+ // update Term. LinkedHashMap guarantees we will later traverse the map in
// insertion order (so that if two terms affect the same document, the last
// 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 IDictionary<string, OrderedDictionary> numericUpdates = new Dictionary<string, OrderedDictionary>();
+ internal readonly IDictionary<string, LinkedHashMap<Term, NumericDocValuesUpdate>> numericUpdates = new Dictionary<string, LinkedHashMap<Term, NumericDocValuesUpdate>>();
// Map<dvField,Map<updateTerm,BinaryUpdate>>
// For each field we keep an ordered list of BinaryUpdates, key'd by the
- // update Term. OrderedDictionary guarantees we will later traverse the map in
+ // update Term. LinkedHashMap guarantees we will later traverse the map in
// insertion order (so that if two terms affect the same document, the last
// 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 IDictionary<string, OrderedDictionary> binaryUpdates = new Dictionary<string, OrderedDictionary>();
+ internal readonly IDictionary<string, LinkedHashMap<Term, BinaryDocValuesUpdate>> binaryUpdates = new Dictionary<string, LinkedHashMap<Term, BinaryDocValuesUpdate>>();
public static readonly int MAX_INT = Convert.ToInt32(int.MaxValue);
@@ -241,21 +241,16 @@ namespace Lucene.Net.Index
public virtual void AddNumericUpdate(NumericDocValuesUpdate update, int docIDUpto)
{
- OrderedDictionary fieldUpdates = null;
+ LinkedHashMap<Term, NumericDocValuesUpdate> fieldUpdates = null;
if (!numericUpdates.TryGetValue(update.field, out fieldUpdates))
{
- fieldUpdates = new OrderedDictionary();
+ fieldUpdates = new LinkedHashMap<Term, NumericDocValuesUpdate>();
numericUpdates[update.field] = fieldUpdates;
bytesUsed.AddAndGet(BYTES_PER_NUMERIC_FIELD_ENTRY);
}
- NumericDocValuesUpdate current = null;
- if (fieldUpdates.Contains(update.term))
- {
- current = fieldUpdates[update.term] as NumericDocValuesUpdate;
- }
-
- if (current != null && docIDUpto < current.docIDUpto)
+ NumericDocValuesUpdate current;
+ if (fieldUpdates.TryGetValue(update.term, out current) && current != null && docIDUpto < current.docIDUpto)
{
// Only record the new number if it's greater than or equal to the current
// one. this is important because if multiple threads are replacing the
@@ -265,7 +260,7 @@ namespace Lucene.Net.Index
}
update.docIDUpto = docIDUpto;
- // since it's an OrderedDictionary, we must first remove the Term entry so that
+ // since it's an LinkedHashMap, we must first remove the Term entry so that
// it's added last (we're interested in insertion-order).
if (current != null)
{
@@ -281,21 +276,16 @@ namespace Lucene.Net.Index
public virtual void AddBinaryUpdate(BinaryDocValuesUpdate update, int docIDUpto)
{
- OrderedDictionary fieldUpdates;
+ LinkedHashMap<Term, BinaryDocValuesUpdate> fieldUpdates;
if (!binaryUpdates.TryGetValue(update.field, out fieldUpdates))
{
- fieldUpdates = new OrderedDictionary();
+ fieldUpdates = new LinkedHashMap<Term, BinaryDocValuesUpdate>();
binaryUpdates[update.field] = fieldUpdates;
bytesUsed.AddAndGet(BYTES_PER_BINARY_FIELD_ENTRY);
}
- BinaryDocValuesUpdate current = null;
- if (fieldUpdates.Contains(update.term))
- {
- current = fieldUpdates[update.term] as BinaryDocValuesUpdate;
- }
-
- if (current != null && docIDUpto < current.docIDUpto)
+ BinaryDocValuesUpdate current;
+ if (fieldUpdates.TryGetValue(update.term, out current) && current != null && docIDUpto < current.docIDUpto)
{
// Only record the new number if it's greater than or equal to the current
// one. this is important because if multiple threads are replacing the
@@ -305,7 +295,7 @@ namespace Lucene.Net.Index
}
update.docIDUpto = docIDUpto;
- // since it's an OrderedDictionary, we must first remove the Term entry so that
+ // since it's an LinkedHashMap, we must first remove the Term entry so that
// it's added last (we're interested in insertion-order).
if (current != null)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bc485b4c/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
index 550d756..d037d2d 100644
--- a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
+++ b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
@@ -92,7 +92,7 @@ namespace Lucene.Net.Expressions.JS
private readonly string sourceText;
- private readonly IDictionary<string, int> externalsMap = new HashMap<string, int>();
+ private readonly IDictionary<string, int> externalsMap = new LinkedHashMap<string, int>();
private TypeBuilder dynamicType;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bc485b4c/src/Lucene.Net.Facet/DrillDownQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Facet/DrillDownQuery.cs b/src/Lucene.Net.Facet/DrillDownQuery.cs
index e222f2d..5e7d4e5 100644
--- a/src/Lucene.Net.Facet/DrillDownQuery.cs
+++ b/src/Lucene.Net.Facet/DrillDownQuery.cs
@@ -60,7 +60,7 @@ namespace Lucene.Net.Facet
private readonly FacetsConfig config;
private readonly BooleanQuery query;
- private readonly IDictionary<string, int?> drillDownDims = new Dictionary<string, int?>();
+ private readonly IDictionary<string, int?> drillDownDims = new LinkedHashMap<string, int?>();
/// <summary>
/// Used by <see cref="Clone"/>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bc485b4c/src/Lucene.Net.Tests.QueryParser/Simple/TestSimpleQueryParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Simple/TestSimpleQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Simple/TestSimpleQueryParser.cs
index 065aa82..0cd23ec 100644
--- a/src/Lucene.Net.Tests.QueryParser/Simple/TestSimpleQueryParser.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Simple/TestSimpleQueryParser.cs
@@ -541,7 +541,7 @@ namespace Lucene.Net.QueryParsers.Simple
[Test]
public virtual void TestWeightedTerm()
{
- IDictionary<string, float> weights = new Dictionary<string, float>();
+ IDictionary<string, float> weights = new LinkedHashMap<string, float>();
weights["field0"] = 5f;
weights["field1"] = 10f;
@@ -562,7 +562,7 @@ namespace Lucene.Net.QueryParsers.Simple
[Test]
public virtual void TestWeightedOR()
{
- IDictionary<string, float> weights = new Dictionary<string, float>();
+ IDictionary<string, float> weights = new LinkedHashMap<string, float>();
weights["field0"] = 5f;
weights["field1"] = 10f;