SWEEP: in all LinkedLists that are being used as a queue, ensure we remove the same instance from the queue that we use further on in the process.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/e382d8a9 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/e382d8a9 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/e382d8a9 Branch: refs/heads/api-work Commit: e382d8a930610b8e08fc1ad8798b9663bd4294f9 Parents: 3031be6 Author: Shad Storhaug <[email protected]> Authored: Sun Feb 5 01:14:17 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Sun Feb 5 01:14:17 2017 +0700 ---------------------------------------------------------------------- .../Analysis/Compound/CompoundWordTokenFilterBase.cs | 3 ++- .../Analysis/Shingle/ShingleFilter.cs | 2 +- .../Analysis/Synonym/SlowSynonymFilter.cs | 7 +++---- src/Lucene.Net.Core/Index/DocumentsWriterFlushQueue.cs | 2 +- src/Lucene.Net.Core/Index/IndexWriter.cs | 2 +- src/Lucene.Net.Core/Search/NumericRangeQuery.cs | 4 ++-- .../Support/LimitedConcurrencyLevelTaskScheduler.cs | 2 +- src/Lucene.Net.Core/Util/Automaton/Automaton.cs | 6 +++--- src/Lucene.Net.Core/Util/Automaton/BasicOperations.cs | 4 ++-- src/Lucene.Net.Core/Util/Automaton/MinimizationOperations.cs | 2 +- .../Util/automaton/AutomatonTestUtil.cs | 4 ++-- 11 files changed, 19 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e382d8a9/src/Lucene.Net.Analysis.Common/Analysis/Compound/CompoundWordTokenFilterBase.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/CompoundWordTokenFilterBase.cs b/src/Lucene.Net.Analysis.Common/Analysis/Compound/CompoundWordTokenFilterBase.cs index 0d42753..f479951 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/CompoundWordTokenFilterBase.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/CompoundWordTokenFilterBase.cs @@ -110,7 +110,8 @@ namespace Lucene.Net.Analysis.Compound if (m_tokens.Count > 0) { Debug.Assert(current != null); - CompoundToken token = m_tokens.First.Value; m_tokens.RemoveFirst(); + CompoundToken token = m_tokens.First.Value; + m_tokens.Remove(token); RestoreState(current); // keep all other attributes untouched m_termAtt.SetEmpty().Append(token.Text); m_offsetAtt.SetOffset(token.StartOffset, token.EndOffset); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e382d8a9/src/Lucene.Net.Analysis.Common/Analysis/Shingle/ShingleFilter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Shingle/ShingleFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Shingle/ShingleFilter.cs index 1153d9e..609a50b 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Shingle/ShingleFilter.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Shingle/ShingleFilter.cs @@ -509,7 +509,7 @@ namespace Lucene.Net.Analysis.Shingle if (inputWindow.Count > 0) { firstToken = inputWindow.First.Value; - inputWindow.RemoveFirst(); // LUCENENET TODO: Safer if we remove the .First.Value from the previous line (do this across the solution) - extension method? + inputWindow.Remove(firstToken); } while (inputWindow.Count < maxShingleSize) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e382d8a9/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilter.cs index ebdf488..c488c83 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilter.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SlowSynonymFilter.cs @@ -167,7 +167,7 @@ namespace Lucene.Net.Analysis.Synonym else { origTok = matched.First.Value; - matched.RemoveFirst(); + matched.Remove(origTok); } if (origTok != null) { @@ -195,7 +195,7 @@ namespace Lucene.Net.Analysis.Synonym else { origTok = matched.First.Value; - matched.RemoveFirst(); + matched.Remove(origTok); } if (origTok != null) { @@ -230,9 +230,8 @@ namespace Lucene.Net.Analysis.Synonym if (buffer != null && buffer.Count > 0) { var first = buffer.First.Value; - buffer.RemoveFirst(); + buffer.Remove(first); return first; - } else { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e382d8a9/src/Lucene.Net.Core/Index/DocumentsWriterFlushQueue.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/DocumentsWriterFlushQueue.cs b/src/Lucene.Net.Core/Index/DocumentsWriterFlushQueue.cs index c414c6f..f488afb 100644 --- a/src/Lucene.Net.Core/Index/DocumentsWriterFlushQueue.cs +++ b/src/Lucene.Net.Core/Index/DocumentsWriterFlushQueue.cs @@ -156,7 +156,7 @@ namespace Lucene.Net.Index { // finally remove the published ticket from the queue FlushTicket poll = queue.First.Value; - queue.RemoveFirst(); + queue.Remove(poll); ticketCount.DecrementAndGet(); Debug.Assert(poll == head); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e382d8a9/src/Lucene.Net.Core/Index/IndexWriter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/IndexWriter.cs b/src/Lucene.Net.Core/Index/IndexWriter.cs index 39983c1..d929cf1 100644 --- a/src/Lucene.Net.Core/Index/IndexWriter.cs +++ b/src/Lucene.Net.Core/Index/IndexWriter.cs @@ -2463,7 +2463,7 @@ namespace Lucene.Net.Index { // Advance the merge from pending to running MergePolicy.OneMerge merge = pendingMerges.First.Value; - pendingMerges.RemoveFirst(); + pendingMerges.Remove(merge); runningMerges.Add(merge); return merge; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e382d8a9/src/Lucene.Net.Core/Search/NumericRangeQuery.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/NumericRangeQuery.cs b/src/Lucene.Net.Core/Search/NumericRangeQuery.cs index 63928c9..7c17a5f 100644 --- a/src/Lucene.Net.Core/Search/NumericRangeQuery.cs +++ b/src/Lucene.Net.Core/Search/NumericRangeQuery.cs @@ -457,11 +457,11 @@ namespace Lucene.Net.Search Debug.Assert(rangeBounds.Count % 2 == 0); currentLowerBound = rangeBounds.First.Value; - rangeBounds.RemoveFirst(); + rangeBounds.Remove(currentLowerBound); Debug.Assert(currentUpperBound == null || termComp.Compare(currentUpperBound, currentLowerBound) <= 0, "The current upper bound must be <= the new lower bound"); currentUpperBound = rangeBounds.First.Value; - rangeBounds.RemoveFirst(); + rangeBounds.Remove(currentUpperBound); } protected override sealed BytesRef NextSeekTerm(BytesRef term) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e382d8a9/src/Lucene.Net.Core/Support/LimitedConcurrencyLevelTaskScheduler.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Support/LimitedConcurrencyLevelTaskScheduler.cs b/src/Lucene.Net.Core/Support/LimitedConcurrencyLevelTaskScheduler.cs index 1531584..9190722 100644 --- a/src/Lucene.Net.Core/Support/LimitedConcurrencyLevelTaskScheduler.cs +++ b/src/Lucene.Net.Core/Support/LimitedConcurrencyLevelTaskScheduler.cs @@ -80,7 +80,7 @@ namespace Lucene.Net.Support // Get the next item from the queue item = _tasks.First.Value; - _tasks.RemoveFirst(); + _tasks.Remove(item); } // Execute the task we pulled out of the queue http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e382d8a9/src/Lucene.Net.Core/Util/Automaton/Automaton.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Automaton/Automaton.cs b/src/Lucene.Net.Core/Util/Automaton/Automaton.cs index 488a641..5238672 100644 --- a/src/Lucene.Net.Core/Util/Automaton/Automaton.cs +++ b/src/Lucene.Net.Core/Util/Automaton/Automaton.cs @@ -291,7 +291,7 @@ namespace Lucene.Net.Util.Automaton while (worklist.Count > 0) { State s = worklist.First.Value; - worklist.RemoveFirst(); + worklist.Remove(s); for (int i = 0; i < s.numTransitions; i++) { Transition t = s.TransitionsArray[i]; @@ -364,7 +364,7 @@ namespace Lucene.Net.Util.Automaton while (worklist.Count > 0) { State s = worklist.First.Value; - worklist.RemoveFirst(); + worklist.Remove(s); if (s.accept) { accepts.Add(s); @@ -502,7 +502,7 @@ namespace Lucene.Net.Util.Automaton while (worklist.Count > 0) { State s = worklist.First.Value; - worklist.RemoveFirst(); + worklist.Remove(s); foreach (State p in map[s.number]) { if (!live.Contains(p)) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e382d8a9/src/Lucene.Net.Core/Util/Automaton/BasicOperations.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Automaton/BasicOperations.cs b/src/Lucene.Net.Core/Util/Automaton/BasicOperations.cs index 962e1b1..5b560b3 100644 --- a/src/Lucene.Net.Core/Util/Automaton/BasicOperations.cs +++ b/src/Lucene.Net.Core/Util/Automaton/BasicOperations.cs @@ -407,7 +407,7 @@ namespace Lucene.Net.Util.Automaton while (worklist.Count > 0) { p = worklist.First.Value; - worklist.RemoveFirst(); + worklist.Remove(p); p.s.accept = p.S1.accept && p.S2.accept; Transition[] t1 = transitions1[p.S1.number]; Transition[] t2 = transitions2[p.S2.number]; @@ -958,7 +958,7 @@ namespace Lucene.Net.Util.Automaton while (worklist.Count > 0) { StatePair p = worklist.First.Value; - worklist.RemoveFirst(); + worklist.Remove(p); workset.Remove(p); HashSet<State> to; HashSet<State> from; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e382d8a9/src/Lucene.Net.Core/Util/Automaton/MinimizationOperations.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Automaton/MinimizationOperations.cs b/src/Lucene.Net.Core/Util/Automaton/MinimizationOperations.cs index e583215..3a1d413 100644 --- a/src/Lucene.Net.Core/Util/Automaton/MinimizationOperations.cs +++ b/src/Lucene.Net.Core/Util/Automaton/MinimizationOperations.cs @@ -142,7 +142,7 @@ namespace Lucene.Net.Util.Automaton while (pending.Count > 0) { IntPair ip = pending.First.Value; - pending.RemoveFirst(); + pending.Remove(ip); int p = ip.N1; int x = ip.N2; pending2.SafeSet(x * statesLen + p, false); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e382d8a9/src/Lucene.Net.TestFramework/Util/automaton/AutomatonTestUtil.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Util/automaton/AutomatonTestUtil.cs b/src/Lucene.Net.TestFramework/Util/automaton/AutomatonTestUtil.cs index 954a213..c060fd1 100644 --- a/src/Lucene.Net.TestFramework/Util/automaton/AutomatonTestUtil.cs +++ b/src/Lucene.Net.TestFramework/Util/automaton/AutomatonTestUtil.cs @@ -264,7 +264,7 @@ namespace Lucene.Net.Util.Automaton while (q.Count > 0) { State s = q.First.Value; - q.RemoveFirst(); + q.Remove(s); IList<ArrivingTransition> arriving; allArriving.TryGetValue(s, out arriving); if (arriving != null) @@ -478,7 +478,7 @@ namespace Lucene.Net.Util.Automaton while (worklist.Count > 0) { ISet<State> s = worklist.First.Value; - worklist.RemoveFirst(); + worklist.Remove(s); State r = newstate[s]; foreach (State q in s) {
