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/03/30 18:00:05 UTC
[10/50] lucenenet git commit:
Lucene.Net.Core.Search.MultiphraseQuery: Changed ValueList to
EquatableList and on same list SequenceEqual() to Equals(). Added using
blocks for iterators.
Lucene.Net.Core.Search.MultiphraseQuery: Changed ValueList<T> to EquatableList<T> and on same list SequenceEqual() to Equals(). Added using blocks for iterators.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/137e4314
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/137e4314
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/137e4314
Branch: refs/heads/api-work
Commit: 137e431496d7e7484f665ff4444a785e6c703c3b
Parents: b3d6ef8
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 05:59:06 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:29 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Search/MultiPhraseQuery.cs | 24 ++++++++++++---------
1 file changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/137e4314/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs b/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
index 9d44378..5518411 100644
--- a/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
+++ b/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
@@ -56,7 +56,7 @@ namespace Lucene.Net.Search
{
private string field;
private List<Term[]> termArrays = new List<Term[]>();
- private readonly ValueList<int> positions = new ValueList<int>();
+ private readonly IList<int> positions = new EquatableList<int>();
private int slop = 0;
@@ -441,7 +441,7 @@ namespace Lucene.Net.Search
return this.Boost == other.Boost
&& this.slop == other.slop
&& TermArraysEquals(this.termArrays, other.termArrays)
- && this.positions.SequenceEqual(other.positions);
+ && this.positions.Equals(other.positions);
}
/// <summary>
@@ -475,16 +475,20 @@ namespace Lucene.Net.Search
{
return false;
}
- IEnumerator<Term[]> iterator1 = termArrays1.GetEnumerator();
- IEnumerator<Term[]> iterator2 = termArrays2.GetEnumerator();
- while (iterator1.MoveNext())
+ using (IEnumerator<Term[]> iterator1 = termArrays1.GetEnumerator())
{
- Term[] termArray1 = iterator1.Current;
- iterator2.MoveNext();
- Term[] termArray2 = iterator2.Current;
- if (!(termArray1 == null ? termArray2 == null : Arrays.Equals(termArray1, termArray2)))
+ using (IEnumerator<Term[]> iterator2 = termArrays2.GetEnumerator())
{
- return false;
+ while (iterator1.MoveNext())
+ {
+ Term[] termArray1 = iterator1.Current;
+ iterator2.MoveNext();
+ Term[] termArray2 = iterator2.Current;
+ if (!(termArray1 == null ? termArray2 == null : Arrays.Equals(termArray1, termArray2)))
+ {
+ return false;
+ }
+ }
}
}
return true;