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 17:59:56 UTC
[01/50] lucenenet git commit:
Lucene.Net.Core.Util.Automaton.Automaton: Removed dependency on
HashHelpers.CombineHashCodes()
Repository: lucenenet
Updated Branches:
refs/heads/api-work d0d6c7e05 -> a02dd137d
Lucene.Net.Core.Util.Automaton.Automaton: Removed dependency on HashHelpers.CombineHashCodes()
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/a4a5f1cc
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/a4a5f1cc
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/a4a5f1cc
Branch: refs/heads/api-work
Commit: a4a5f1ccbeb200db6785c90cda238b781e3a78dd
Parents: 174e221
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Mar 29 19:41:12 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:27 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Util/Automaton/Automaton.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4a5f1cc/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 5238672..dc32efb 100644
--- a/src/Lucene.Net.Core/Util/Automaton/Automaton.cs
+++ b/src/Lucene.Net.Core/Util/Automaton/Automaton.cs
@@ -669,7 +669,7 @@ namespace Lucene.Net.Util.Automaton
{
current = worklist.First.Value;
worklist.Remove(current);
- hash = HashHelpers.CombineHashCodes(hash, current.accept.GetHashCode());
+ hash = 31 * hash + current.accept.GetHashCode();
Transition[] t1 = transitions[current.number];
@@ -677,8 +677,8 @@ namespace Lucene.Net.Util.Automaton
{
int min1 = t1[n1].min, max1 = t1[n1].max;
- hash = HashHelpers.CombineHashCodes(hash, min1.GetHashCode());
- hash = HashHelpers.CombineHashCodes(hash, max1.GetHashCode());
+ hash = 31 * hash + min1.GetHashCode();
+ hash = 31 * hash + max1.GetHashCode();
State next = t1[n1].to;
if (!visited.Contains(next))
[34/50] lucenenet git commit:
Lucene.Net.Core.Support.Arrays.Equals(): Changed implementation to be more
like the original JDK version,
including the ability to test equality based on the values of the nested value
if it is a collection
Posted by ni...@apache.org.
Lucene.Net.Core.Support.Arrays.Equals(): Changed implementation to be more like the original JDK version, including the ability to test equality based on the values of the nested value if it is a collection
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/d0c2c108
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/d0c2c108
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/d0c2c108
Branch: refs/heads/api-work
Commit: d0c2c108eea1fd2035a9d8a54eb9cee34772ac74
Parents: 842182c
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 09:55:01 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:55:01 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Support/Arrays.cs | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d0c2c108/src/Lucene.Net.Core/Support/Arrays.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/Arrays.cs b/src/Lucene.Net.Core/Support/Arrays.cs
index 80cd06e..bea165d 100644
--- a/src/Lucene.Net.Core/Support/Arrays.cs
+++ b/src/Lucene.Net.Core/Support/Arrays.cs
@@ -87,19 +87,39 @@ namespace Lucene.Net.Support
/// considered equal if (e1==null ? e2==null : e1.equals(e2)). In other
/// words, the two arrays are equal if they contain the same elements in
/// the same order. Also, two array references are considered equal if
- /// both are null.</returns>
+ /// both are null.
+ /// <para/>
+ /// Note that if the type of <paramref name="T"/> is a <see cref="IDictionary{TKey, TValue}"/>,
+ /// <see cref="IList{T}"/>, or <see cref="ISet{T}"/>, its values and any nested collection values
+ /// will be compared for equality as well.
+ /// </returns>
public static bool Equals<T>(T[] a, T[] b)
{
- if (a == null)
+ if (object.ReferenceEquals(a, b))
+ {
+ return true;
+ }
+ bool isValueType = typeof(T).IsValueType;
+ if (!isValueType && a == null)
+ {
return b == null;
+ }
+
+ int length = a.Length;
- if (a.Length != b.Length)
+ if (b.Length != length)
+ {
return false;
+ }
- for (int i = 0; i < a.Length; i++)
+ for (int i = 0; i < length; i++)
{
- if (!object.Equals(a[i], b[i]))
+ T o1 = a[i];
+ T o2 = b[i];
+ if (!(isValueType ? o1.Equals(o2) : (o1 == null ? o2 == null : Collections.Equals(o1, o2))))
+ {
return false;
+ }
}
return true;
[19/50] lucenenet git commit:
Lucene.Net.Core.Codecs.Compressing.CompressingTermVectorsWriter: Use
LinkedList.Max instead of Linq Last() for better efficency
Posted by ni...@apache.org.
Lucene.Net.Core.Codecs.Compressing.CompressingTermVectorsWriter: Use LinkedList.Max instead of Linq Last() for better efficency
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/595697e4
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/595697e4
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/595697e4
Branch: refs/heads/api-work
Commit: 595697e4b5593dcb3f8e098f97778177a553f9a0
Parents: e0318a4
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 05:19:13 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:31 2017 +0700
----------------------------------------------------------------------
.../Codecs/Compressing/CompressingTermVectorsWriter.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/595697e4/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsWriter.cs b/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsWriter.cs
index f3b729e..042c319 100644
--- a/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsWriter.cs
+++ b/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsWriter.cs
@@ -455,7 +455,7 @@ namespace Lucene.Net.Codecs.Compressing
int numDistinctFields = fieldNums.Count;
Debug.Assert(numDistinctFields > 0);
- int bitsRequired = PackedInt32s.BitsRequired(fieldNums.Last());
+ int bitsRequired = PackedInt32s.BitsRequired(fieldNums.Max);
int token = (Math.Min(numDistinctFields - 1, 0x07) << 5) | bitsRequired;
vectorsStream.WriteByte((byte)(sbyte)token);
if (numDistinctFields - 1 >= 0x07)
[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.
Posted by ni...@apache.org.
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;
[50/50] lucenenet git commit: Lucene.Net.Core + Lucene.Net.Tests:
Reviewed and removed some TODOs
Posted by ni...@apache.org.
Lucene.Net.Core + Lucene.Net.Tests: Reviewed and removed some TODOs
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/a02dd137
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/a02dd137
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/a02dd137
Branch: refs/heads/api-work
Commit: a02dd137d1e6f4627f751ca5f4f38b7828040019
Parents: 1697106
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Fri Mar 31 00:56:45 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Fri Mar 31 00:56:45 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Util/LongBitSet.cs | 2 --
src/Lucene.Net.Core/Util/OpenBitSet.cs | 2 --
src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat.cs | 1 -
3 files changed, 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a02dd137/src/Lucene.Net.Core/Util/LongBitSet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/LongBitSet.cs b/src/Lucene.Net.Core/Util/LongBitSet.cs
index fe46132..331eb82 100644
--- a/src/Lucene.Net.Core/Util/LongBitSet.cs
+++ b/src/Lucene.Net.Core/Util/LongBitSet.cs
@@ -321,7 +321,6 @@ namespace Lucene.Net.Util
/// **
*/
- //LUCENE TO-DO
long startmask = -1L << (int)startIndex;
long endmask = (long)(unchecked(((ulong)-1L)) >> (int)-endIndex); // 64-(endIndex&0x3f) is the same as -endIndex due to wrap
@@ -358,7 +357,6 @@ namespace Lucene.Net.Util
int startWord = (int)(startIndex >> 6);
int endWord = (int)((endIndex - 1) >> 6);
- //LUCENE TO-DO
long startmask = -1L << (int)startIndex;
long endmask = (long)(0xffffffffffffffffUL >> (int)-endIndex);//-(int)((uint)1L >> (int)-endIndex); // 64-(endIndex&0x3f) is the same as -endIndex due to wrap
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a02dd137/src/Lucene.Net.Core/Util/OpenBitSet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/OpenBitSet.cs b/src/Lucene.Net.Core/Util/OpenBitSet.cs
index e43325c..e8d438c 100644
--- a/src/Lucene.Net.Core/Util/OpenBitSet.cs
+++ b/src/Lucene.Net.Core/Util/OpenBitSet.cs
@@ -486,7 +486,6 @@ namespace Lucene.Net.Util
// word to be changed.
int endWord = (int)((endIndex - 1) >> 6);
- //LUCENE TO-DO
long startmask = -1L << (int)startIndex;
long endmask = -(int)((uint)1L >> (int)-endIndex); // 64-(endIndex&0x3f) is the same as -endIndex due to wrap
@@ -631,7 +630,6 @@ namespace Lucene.Net.Util
/// **
/// </summary>
- //LUCENE TO-DO
long startmask = -1L << (int)startIndex;
long endmask = (long)(0xffffffffffffffffUL >> (int)-endIndex); // 64-(endIndex&0x3f) is the same as -endIndex due to wrap
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a02dd137/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat.cs b/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat.cs
index a6d5dd2..897dfb9 100644
--- a/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat.cs
+++ b/src/Lucene.Net.Tests/Codecs/PerField/TestPerFieldPostingsFormat.cs
@@ -42,7 +42,6 @@ namespace Lucene.Net.Codecs.PerField
[Test]
public override void TestMergeStability()
{
- //LUCENE TO-DO
AssumeTrue("The MockRandom PF randomizes content on the fly, so we can't check it", false);
}
[16/50] lucenenet git commit:
Lucene.Net.QueryParser.Flexibl.Standard.Config.NumericConfig: Factored out
HashHelpers.CombineHashCodes
Posted by ni...@apache.org.
Lucene.Net.QueryParser.Flexibl.Standard.Config.NumericConfig: Factored out HashHelpers.CombineHashCodes
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/a701b994
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/a701b994
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/a701b994
Branch: refs/heads/api-work
Commit: a701b9941fe36e22664e0117292f2a3ed1eb3dd0
Parents: 1a251a1
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 08:11:41 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:31 2017 +0700
----------------------------------------------------------------------
.../Flexible/Standard/Config/NumericConfig.cs | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a701b994/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumericConfig.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumericConfig.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumericConfig.cs
index 913904a..13d5938 100644
--- a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumericConfig.cs
+++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Config/NumericConfig.cs
@@ -115,11 +115,12 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Config
/// </summary>
public override int GetHashCode()
{
- return HashHelpers.CombineHashCodes(
- base.GetHashCode(),
- this.precisionStep.GetHashCode(),
- this.type.GetHashCode(),
- this.format.GetHashCode());
+ const int prime = 31;
+ int result = base.GetHashCode();
+ result = prime * result + this.precisionStep.GetHashCode();
+ result = prime * result + this.type.GetHashCode();
+ result = prime * result + this.format.GetHashCode();
+ return result;
}
}
}
[25/50] lucenenet git commit:
Lucene.Net.Queries.Function.ValueSources.MultiBoolFunction: Use
Equatable.Wrap() to wrap the provided list in EquatableList for Equals() and
GetHashCode() comparisons
Posted by ni...@apache.org.
Lucene.Net.Queries.Function.ValueSources.MultiBoolFunction: Use Equatable.Wrap() to wrap the provided list in EquatableList for Equals() and GetHashCode() comparisons
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/39333d07
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/39333d07
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/39333d07
Branch: refs/heads/api-work
Commit: 39333d070c5a8f9a8bd7776aafbe3a32a1726935
Parents: 1c751a2
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 08:40:55 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:51 2017 +0700
----------------------------------------------------------------------
.../Function/ValueSources/MultiBoolFunction.cs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/39333d07/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs
index ad1caec..48bf116 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MultiBoolFunction.cs
@@ -1,6 +1,7 @@
\ufeffusing Lucene.Net.Index;
using Lucene.Net.Queries.Function.DocValues;
using Lucene.Net.Search;
+using Lucene.Net.Support;
using System.Collections;
using System.Collections.Generic;
using System.Text;
@@ -114,7 +115,9 @@ namespace Lucene.Net.Queries.Function.ValueSources
public override int GetHashCode()
{
- return m_sources.GetHashCode() + Name.GetHashCode();
+ // LUCENENET specific: ensure our passed in list is equatable by
+ // wrapping it in an EquatableList if it is not one already
+ return Equatable.Wrap(m_sources).GetHashCode() + Name.GetHashCode();
}
public override bool Equals(object o)
@@ -126,7 +129,10 @@ namespace Lucene.Net.Queries.Function.ValueSources
var other = o as MultiBoolFunction;
if (other == null)
return false;
- return this.m_sources.Equals(other.m_sources);
+
+ // LUCENENET specific: ensure our passed in list is equatable by
+ // wrapping it in an EquatableList if it is not one already
+ return Equatable.Wrap(this.m_sources).Equals(other.m_sources);
}
public override void CreateWeight(IDictionary context, IndexSearcher searcher)
[12/50] lucenenet git commit: Lucene.Net.Queries.TermsFilter: renamed
private field
Posted by ni...@apache.org.
Lucene.Net.Queries.TermsFilter: renamed private field
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/e0318a49
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/e0318a49
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/e0318a49
Branch: refs/heads/api-work
Commit: e0318a494153b3ca664d1f87e70e2c9cb3ab591e
Parents: cf3c6ec
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Mar 29 21:42:23 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:30 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Queries/TermsFilter.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e0318a49/src/Lucene.Net.Queries/TermsFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/TermsFilter.cs b/src/Lucene.Net.Queries/TermsFilter.cs
index 3a04993..705e441 100644
--- a/src/Lucene.Net.Queries/TermsFilter.cs
+++ b/src/Lucene.Net.Queries/TermsFilter.cs
@@ -48,7 +48,7 @@ namespace Lucene.Net.Queries
private readonly int[] offsets;
private readonly byte[] termsBytes;
private readonly TermsAndField[] termsAndFields;
- private readonly int hashCode_Renamed; // cached hashcode for fast cache lookups
+ private readonly int hashCode; // cached hashcode for fast cache lookups
private const int PRIME = 31;
/// <summary>
@@ -214,7 +214,7 @@ namespace Lucene.Net.Queries
termsAndFields.Add(lastTermsAndField);
this.termsBytes = ArrayUtil.Shrink(serializedTerms, lastEndOffset);
this.termsAndFields = termsAndFields.ToArray();
- this.hashCode_Renamed = hash;
+ this.hashCode = hash;
}
public override DocIdSet GetDocIdSet(AtomicReaderContext context, IBits acceptDocs)
@@ -275,7 +275,7 @@ namespace Lucene.Net.Queries
var test = (TermsFilter)obj;
// first check the fields before even comparing the bytes
- if (test.hashCode_Renamed == hashCode_Renamed && Arrays.Equals(termsAndFields, test.termsAndFields))
+ if (test.hashCode == hashCode && Arrays.Equals(termsAndFields, test.termsAndFields))
{
int lastOffset = termsAndFields[termsAndFields.Length - 1].end;
// compare offsets since we sort they must be identical
@@ -290,7 +290,7 @@ namespace Lucene.Net.Queries
public override int GetHashCode()
{
- return hashCode_Renamed;
+ return hashCode;
}
public override string ToString()
[31/50] lucenenet git commit: Lucene.Net.Core.Support: Deleted
HashHelpers and ObjectExtensions because they have been replaced by the
Collections.GetHashCode() and Collections.Equals() functionality
Posted by ni...@apache.org.
Lucene.Net.Core.Support: Deleted HashHelpers and ObjectExtensions because they have been replaced by the Collections.GetHashCode() and Collections.Equals() functionality
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/92b7d0b7
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/92b7d0b7
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/92b7d0b7
Branch: refs/heads/api-work
Commit: 92b7d0b7a3b2fc021bff49dc3057fd52f12dd7be
Parents: f25215f
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 09:29:51 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:29:51 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Lucene.Net.csproj | 2 -
src/Lucene.Net.Core/Support/HashHelpers.cs | 127 -------------------
src/Lucene.Net.Core/Support/ObjectExtensions.cs | 56 --------
3 files changed, 185 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/92b7d0b7/src/Lucene.Net.Core/Lucene.Net.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Lucene.Net.csproj b/src/Lucene.Net.Core/Lucene.Net.csproj
index 622d7b3..d140dd4 100644
--- a/src/Lucene.Net.Core/Lucene.Net.csproj
+++ b/src/Lucene.Net.Core/Lucene.Net.csproj
@@ -643,7 +643,6 @@
<Compile Include="Support\ExceptionToClassNameConventionAttribute.cs" />
<Compile Include="Support\ExceptionToNullableEnumConvention.cs" />
<Compile Include="Support\FileStreamExtensions.cs" />
- <Compile Include="Support\HashHelpers.cs" />
<Compile Include="Support\ICallable.cs" />
<Compile Include="Support\ICharSequence.cs" />
<Compile Include="Support\ICompletionService.cs" />
@@ -666,7 +665,6 @@
<Compile Include="Support\MathExtension.cs" />
<Compile Include="Support\MemoryMappedFileByteBuffer.cs" />
<Compile Include="Support\NumberFormat.cs" />
- <Compile Include="Support\ObjectExtensions.cs" />
<Compile Include="Support\PriorityQueue.cs" />
<Compile Include="Support\ReaderWriterLockSlimExtensions.cs" />
<Compile Include="Support\ReentrantLock.cs" />
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/92b7d0b7/src/Lucene.Net.Core/Support/HashHelpers.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/HashHelpers.cs b/src/Lucene.Net.Core/Support/HashHelpers.cs
deleted file mode 100644
index 5268a43..0000000
--- a/src/Lucene.Net.Core/Support/HashHelpers.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-\ufeff//-----------------------------------------------------------------------
-// <copyright file="HashHelpers.cs" company="Microsoft">
-// Copyright (c) Microsoft. All rights reserved.
-// Internal use only.
-// </copyright>
-//-----------------------------------------------------------------------
-
-using System;
-using System.Collections;
-
-namespace Lucene.Net.Support
-{
- public static class HashHelpers
- {
- public static int CombineHashCodes(int h1, int h2)
- {
- return ((h1 << 5) + h1) ^ h2;
- }
-
- public static int CombineHashCodes(int h1, int h2, int h3)
- {
- return HashHelpers.CombineHashCodes(h1, HashHelpers.CombineHashCodes(h2, h3));
- }
-
- public static int CombineHashCodes(int h1, int h2, int h3, int h4)
- {
- return HashHelpers.CombineHashCodes(
- HashHelpers.CombineHashCodes(h1, h2),
- HashHelpers.CombineHashCodes(h3, h4)
- );
- }
-
- public static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5)
- {
- return HashHelpers.CombineHashCodes(
- HashHelpers.CombineHashCodes(h1, h2),
- HashHelpers.CombineHashCodes(h3, h4),
- h5
- );
- }
-
- private static uint[] crc32Table;
-
- public static int GetCRC32HashCode(this byte[] buffer, int offset, int count)
- {
- if (null == buffer)
- {
- throw new ArgumentNullException("buffer");
- }
-
- if ((offset + count) > buffer.Length)
- {
- count = (buffer.Length - offset);
- }
-
- if (null == HashHelpers.crc32Table)
- {
- uint[] localCrc32Table = new uint[256];
-
- for (uint i = 0; i < 256; i++)
- {
- uint c = i;
- for (int k = 0; k < 8; k++)
- {
- if (0 != (c & 1))
- {
- c = 0xedb88320 ^ (c >> 1);
- }
- else
- {
- c = c >> 1;
- }
- }
-
- localCrc32Table[i] = c;
- }
-
- HashHelpers.crc32Table = localCrc32Table;
- }
-
- uint crc32Value = uint.MaxValue;
- for (int i = offset, max = offset + count; i < max; i++)
- {
- byte index = (byte)(crc32Value ^ buffer[i]);
- crc32Value = HashHelpers.crc32Table[index] ^ ((crc32Value >> 8) & 0xffffff);
- }
-
- return (int)crc32Value;
- }
-
- /// <summary>
- /// Gets a hash code for the valueOrEnumerable. If the valueOrEnumerable implements
- /// IEnumerable, it enumerates the values and makes a combined hash code representing
- /// all of the values in the order they occur in the set. The types of IEnumerable must also be
- /// the same, so for example a <see cref="int[]"/> and a <see cref="List{Int32}"/> containing
- /// the same values will have different hash codes.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="valueOrEnumerable">Any value type, reference type or IEnumerable type.</param>
- /// <returns>A combined hash code of the value and, if IEnumerable, any values it contains.</returns>
- public static int GetValueHashCode<T>(this T valueOrEnumerable)
- {
- if (valueOrEnumerable == null)
- return 0; // 0 for null
-
- if (!(valueOrEnumerable is IEnumerable) || valueOrEnumerable is string)
- {
- return valueOrEnumerable.GetHashCode();
- }
-
- int hashCode = valueOrEnumerable.GetType().GetHashCode();
- foreach (object value in valueOrEnumerable as IEnumerable)
- {
- if (value != null)
- {
- hashCode = CombineHashCodes(hashCode, value.GetHashCode());
- }
- else
- {
- hashCode = CombineHashCodes(hashCode, 0 /* 0 for null */);
- }
- }
-
- return hashCode;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/92b7d0b7/src/Lucene.Net.Core/Support/ObjectExtensions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/ObjectExtensions.cs b/src/Lucene.Net.Core/Support/ObjectExtensions.cs
deleted file mode 100644
index 37ef70b..0000000
--- a/src/Lucene.Net.Core/Support/ObjectExtensions.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-\ufeffusing System.Collections;
-
-namespace Lucene.Net.Support
-{
- public static class ObjectExtensions
- {
- /// <summary>
- /// Compares the current value against the other value to determine if
- /// the values are equal. If the values implement IEnumerable (and are
- /// not strings), then it will enumerate over the values and compare them
- /// in the same order.
- ///
- /// This differs from most SetEquals implementations in that they usually
- /// don't check the order of the elements in the IEnumerable, but this one does.
- /// It also does the check in a safe manner in case the IEnumerable type is nullable,
- /// so that null == null.
- ///
- /// The values that are provided don't necessarily have to implement IEnumerable
- /// to check their values for equality.
- ///
- /// This method is most useful for assertions and testing, but it may
- /// also be useful in other scenarios. Do note the IEnumerable values are cast to
- /// object before comparing, so it may not be ideal for production scenarios
- /// if the values are not reference types.
- /// </summary>
- /// <typeparam name="T">The type of object</typeparam>
- /// <param name="a">This object</param>
- /// <param name="b">The object that this object will be compared against</param>
- /// <returns><c>true</c> if the values are equal; otherwise <c>false</c></returns>
- public static bool ValueEquals<T>(this T a, T b)
- {
- if (a is IEnumerable && b is IEnumerable)
- {
- var iter = (b as IEnumerable).GetEnumerator();
- foreach (object value in a as IEnumerable)
- {
- iter.MoveNext();
- if (!object.Equals(value, iter.Current))
- {
- return false;
- }
- }
- return true;
- }
-
- return a.Equals(b);
- }
-
- // Special case: strings are IEnumerable, but the default Equals works fine
- // for testing value equality
- public static bool ValueEquals(this string a, string b)
- {
- return a.Equals(b);
- }
- }
-}
[17/50] lucenenet git commit: Lucene.Net.Core.Search.Spans
(SpanNearPayLoadQuery + SpanPayloadCheckQuery): added documentation about the
importance of passing a collection that implements one of the 3 primary types
or provides an overload of Equals and G
Posted by ni...@apache.org.
Lucene.Net.Core.Search.Spans (SpanNearPayLoadQuery + SpanPayloadCheckQuery): added documentation about the importance of passing a collection that implements one of the 3 primary types or provides an overload of Equals and GetHashCode()
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/1a251a1c
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/1a251a1c
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/1a251a1c
Branch: refs/heads/api-work
Commit: 1a251a1c4fe9af25384322876ad80b880e184b18
Parents: 3ffcd7f
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 08:04:38 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:31 2017 +0700
----------------------------------------------------------------------
.../Search/Spans/SpanNearPayloadCheckQuery.cs | 8 ++++++--
src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1a251a1c/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs b/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs
index a523fb6..e590644 100644
--- a/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs
+++ b/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs
@@ -34,8 +34,12 @@ namespace Lucene.Net.Search.Spans
{
protected readonly ICollection<byte[]> m_payloadToMatch;
- /// <param name="match"> The underlying <seealso cref="SpanQuery"/> to check </param>
- /// <param name="payloadToMatch"> The <seealso cref="java.util.Collection"/> of payloads to match </param>
+ /// <param name="match"> The underlying <see cref="SpanQuery"/> to check </param>
+ /// <param name="payloadToMatch"> The <see cref="T:ICollection{byte[]}"/> of payloads to match.
+ /// IMPORTANT: If the type provided does not implement <see cref="IList{T}"/> (including arrays),
+ /// <see cref="ISet{T}"/>, or <see cref="IDictionary{TKey, TValue}"/>, it should provide an
+ /// <see cref="object.Equals(object)"/> and <see cref="object.GetHashCode()"/> implementation
+ /// that compares the values of the byte arrays to ensure they are the same. </param>
public SpanNearPayloadCheckQuery(SpanNearQuery match, ICollection<byte[]> payloadToMatch)
: base(match)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1a251a1c/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs b/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs
index 466d894..dade50a 100644
--- a/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs
+++ b/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs
@@ -39,8 +39,12 @@ namespace Lucene.Net.Search.Spans
protected readonly ICollection<byte[]> m_payloadToMatch;
///
- /// <param name="match"> The underlying <seealso cref="Lucene.Net.Search.Spans.SpanQuery"/> to check </param>
- /// <param name="payloadToMatch"> The <seealso cref="java.util.Collection"/> of payloads to match </param>
+ /// <param name="match"> The underlying <see cref="SpanQuery"/> to check </param>
+ /// <param name="payloadToMatch"> The <see cref="T:ICollection<byte[]>"/> of payloads to match.
+ /// IMPORTANT: If the type provided does not implement <see cref="IList{T}"/> (including arrays),
+ /// <see cref="ISet{T}"/>, or <see cref="IDictionary{TKey, TValue}"/>, it should provide an
+ /// <see cref="object.Equals(object)"/> and <see cref="object.GetHashCode()"/> implementation
+ /// that compares the values of the byte arrays to ensure they are the same.</param>
public SpanPayloadCheckQuery(SpanQuery match, ICollection<byte[]> payloadToMatch)
: base(match)
{
[28/50] lucenenet git commit: Lucene.Net.Core.Support.Collections:
Removed commented code
Posted by ni...@apache.org.
Lucene.Net.Core.Support.Collections: Removed commented code
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/a3ef60a3
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/a3ef60a3
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/a3ef60a3
Branch: refs/heads/api-work
Commit: a3ef60a3e1396333a556e67f75b1b10dc3664ed9
Parents: d21dd79
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 09:15:45 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:15:45 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Support/Collections.cs | 476 ------------------------
1 file changed, 476 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a3ef60a3/src/Lucene.Net.Core/Support/Collections.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/Collections.cs b/src/Lucene.Net.Core/Support/Collections.cs
index 380cf75..4abd26b 100644
--- a/src/Lucene.Net.Core/Support/Collections.cs
+++ b/src/Lucene.Net.Core/Support/Collections.cs
@@ -190,15 +190,6 @@ namespace Lucene.Net
return h;
}
- //public static int GetHashCode<TKey, TValue>(KeyValuePair<TKey, TValue> kvp)
- //{
- // TKey key = kvp.Key;
- // TValue value = kvp.Value;
- // int keyHash = (key == null ? 0 : GetHashCode(key));
- // int valueHash = (value == null ? 0 : GetHashCode(value));
- // return keyHash ^ valueHash;
- //}
-
/// <summary>
/// This method generally assists with the recursive GetHashCode() that
/// builds a hash code based on all of the values in a collection
@@ -280,18 +271,6 @@ namespace Lucene.Net
}
return (!(eA.MoveNext() || eB.MoveNext()));
-
- //while (eA.MoveNext())
- //{
- // if (!eB.MoveNext() || (isValueType ? !eA.Current.Equals(eB.Current) : !Equals(eA.Current, eB.Current)))
- // {
- // return false;
- // }
- //}
- //if (eB.MoveNext())
- //{
- // return false;
- //}
}
}
}
@@ -383,22 +362,6 @@ namespace Lucene.Net
return false;
}
- //foreach (var eA in dictionaryA)
- //{
- // bool contains = false;
- // foreach (var eB in dictionaryB)
- // {
- // if (Equals(eA, eB))
- // {
- // contains = true;
- // break;
- // }
- // }
- // if (!contains)
- // {
- // return false;
- // }
- //}
bool valueIsValueType = typeof(TValue).IsValueType;
using (var i = dictionaryB.GetEnumerator())
@@ -429,21 +392,6 @@ namespace Lucene.Net
return true;
}
- //public static bool Equals<TKey, TValue>(KeyValuePair<TKey, TValue> kvpA, KeyValuePair<TKey, TValue> kvpB)
- //{
- // return Equals(kvpA, kvpB, false);
- //}
-
- //public static bool Equals<TKey, TValue>(KeyValuePair<TKey, TValue> kvpA, KeyValuePair<TKey, TValue> kvpB, bool deep)
- //{
- // return Equals(kvpA.Key, kvpB.Key, deep) && Equals(kvpA.Value, kvpB.Value, deep);
- // //if (deep)
- // //{
- // // return Equals(kvpA.Key, kvpB.Key, deep) && Equals(kvpA.Value, kvpB.Value, deep);
- // //}
- // //return kvpA.Equals(kvpB);
- //}
-
/// <summary>
/// A helper method to recursively determine equality based on
/// the values of the collection and all nested collections.
@@ -642,430 +590,6 @@ namespace Lucene.Net
}
}
-
-
- //public static int GetHashCode<T>(IList<T> list)
- //{
- // return GetHashCode(list, false);
- //}
-
- ///// <summary>
- ///// The same implementation of GetHashCode from Java's AbstractList
- ///// (the default implementation for all lists).
- ///// <para/>
- ///// This algorithm depends on the order of the items in the list.
- ///// </summary>
- //public static int GetHashCode<T>(IList<T> list, bool deep)
- //{
- // int hashCode = 1;
- // foreach (T e in list)
- // {
- // hashCode = 31 * hashCode +
- // // LUCENENET: Value types will never be null, so this is ok
- // (e == null ? 0 :
- // (deep ? GetHashCode(e, deep) : e.GetHashCode()));
- // }
-
- // return hashCode;
- //}
-
- //public static int GetHashCode<T>(ISet<T> set)
- //{
- // return GetHashCode(set, false);
- //}
-
- ///// <summary>
- ///// The same implementation of GetHashCode from Java's AbstractSet
- ///// (the default implementation for all sets)
- ///// <para/>
- ///// This algorithm does not depend on the order of the items in the set.
- ///// </summary>
- //public static int GetHashCode<T>(ISet<T> set, bool deep)
- //{
- // int h = 0;
- // using (var i = set.GetEnumerator())
- // {
- // while (i.MoveNext())
- // {
- // T obj = i.Current;
- // if (obj != null) // LUCENENET: Value types will never be null, so this is ok
- // {
- // h += deep ? GetHashCode(obj, deep) : obj.GetHashCode();
- // }
- // }
- // }
- // return h;
- //}
-
- //public static int GetHashCode<TKey, TValue>(IDictionary<TKey, TValue> dictionary)
- //{
- // return GetHashCode(dictionary, false);
- //}
-
- ///// <summary>
- ///// The same implementation of GetHashCode from Java's AbstractMap
- ///// (the default implementation for all dictionaries)
- ///// <para/>
- ///// This algoritm does not depend on the order of the items in the dictionary.
- ///// </summary>
- //public static int GetHashCode<TKey, TValue>(IDictionary<TKey, TValue> dictionary, bool deep)
- //{
- // int h = 0;
- // using (var i = dictionary.GetEnumerator())
- // {
- // while (i.MoveNext())
- // {
- // h += GetHashCode(i.Current, deep);
- // }
- // }
- // return h;
- //}
-
- //public static int GetHashCode<TKey, TValue>(KeyValuePair<TKey, TValue> kvp)
- //{
- // return GetHashCode(kvp, false);
- //}
-
- //public static int GetHashCode<TKey, TValue>(KeyValuePair<TKey, TValue> kvp, bool deep)
- //{
- // if (deep)
- // {
- // TKey key = kvp.Key;
- // TValue value = kvp.Value;
- // int keyHash = (key == null ? 0 : GetHashCode(key, deep));
- // int valueHash = (value == null ? 0 : GetHashCode(value, deep));
- // return keyHash ^ valueHash;
- // }
- // return kvp.GetHashCode();
- //}
-
- //public static int GetHashCode(object obj)
- //{
- // return GetHashCode(obj, false);
- //}
-
- //public static int GetHashCode(object obj, bool deep)
- //{
- // Type t = obj.GetType();
- // if (t.IsGenericType
- // && (t.GetGenericTypeDefinition().GetInterfaces().Any(x => x.IsAssignableFrom(typeof(IList<>)))
- // || t.GetGenericTypeDefinition().GetInterfaces().Any(x => x.IsAssignableFrom(typeof(ISet<>)))
- // || t.GetGenericTypeDefinition().GetInterfaces().Any(x => x.IsAssignableFrom(typeof(IDictionary<,>)))))
- // {
- // dynamic genericType = Convert.ChangeType(obj, t);
- // return GetHashCode(genericType, deep);
- // }
-
- // return obj.GetHashCode();
- //}
-
- //public static bool Equals<T>(IList<T> listA, IList<T> listB)
- //{
- // return Equals(listA, listB, false);
- //}
-
- ///// <summary>
- ///// The same implementation of Equals from Java's AbstractList
- ///// (the default implementation for all lists)
- ///// <para/>
- ///// This algorithm depends on the order of the items in the list.
- ///// </summary>
- //public static bool Equals<T>(IList<T> listA, IList<T> listB, bool deep)
- //{
- // if (object.ReferenceEquals(listA, listB))
- // {
- // return true;
- // }
-
- // if (listA == null)
- // {
- // if (listB == null)
- // {
- // return true;
- // }
- // return false;
- // }
-
- // using (IEnumerator<T> eA = listA.GetEnumerator())
- // {
- // using (IEnumerator<T> eB = listB.GetEnumerator())
- // {
- // while (eA.MoveNext())
- // {
- // if (!eB.MoveNext() || (deep ? Equals(eA, eB, deep) : !eA.Current.Equals(eB.Current)))
- // {
- // return false;
- // }
- // }
- // if (eB.MoveNext())
- // {
- // return false;
- // }
- // }
- // }
- // return true;
- //}
-
- //public static bool Equals<T>(ISet<T> setA, ISet<T> setB)
- //{
- // return Equals(setA, setB, false);
- //}
-
- ///// <summary>
- ///// The same implementation of Equals from Java's AbstractSet
- ///// (the default implementation for all sets)
- ///// <para/>
- ///// This algoritm does not depend on the order of the items in the set.
- ///// </summary>
- //public static bool Equals<T>(ISet<T> setA, ISet<T> setB, bool deep)
- //{
- // if (object.ReferenceEquals(setA, setB))
- // {
- // return true;
- // }
-
- // if (setA == null)
- // {
- // if (setB == null)
- // {
- // return true;
- // }
- // return false;
- // }
-
- // if (setA.Count != setB.Count)
- // {
- // return false;
- // }
-
- // // same operation as containsAll()
- // foreach (T eB in setB)
- // {
- // bool contains = false;
- // foreach (T eA in setA)
- // {
- // if (deep ? Equals(eA, eB, deep) : eA.Equals(eB))
- // {
- // contains = true;
- // break;
- // }
- // }
- // if (!contains)
- // {
- // return false;
- // }
- // }
-
- // return true;
- //}
-
- //public static bool Equals<TKey, TValue>(IDictionary<TKey, TValue> dictionaryA, IDictionary<TKey, TValue> dictionaryB)
- //{
- // return Equals(dictionaryA, dictionaryB, false);
- //}
-
- ///// <summary>
- ///// This is the same implemenation of Equals from Java's AbstractMap
- ///// (the default implementation of all dictionaries)
- ///// <para/>
- ///// This algoritm does not depend on the order of the items in the dictionary.
- ///// </summary>
- //public static bool Equals<TKey, TValue>(IDictionary<TKey, TValue> dictionaryA, IDictionary<TKey, TValue> dictionaryB, bool deep)
- //{
- // if (object.ReferenceEquals(dictionaryA, dictionaryB))
- // {
- // return true;
- // }
-
- // if (dictionaryA == null)
- // {
- // if (dictionaryB == null)
- // {
- // return true;
- // }
- // return false;
- // }
-
- // if (dictionaryA.Count != dictionaryB.Count)
- // {
- // return false;
- // }
-
- // foreach (var eA in dictionaryA)
- // {
- // bool contains = false;
- // foreach (var eB in dictionaryB)
- // {
- // if (deep ? Equals(eA, eB, deep) : eA.GetHashCode().Equals(eB.GetHashCode()))
- // {
- // contains = true;
- // break;
- // }
- // }
- // if (!contains)
- // {
- // return false;
- // }
- // }
-
-
- // //using (var i = dictionaryA.GetEnumerator())
- // //{
- // // while(i.MoveNext())
- // // {
- // // KeyValuePair<TKey, TValue> e = i.Current;
-
-
- // // //TKey key = e.Key;
- // // //TValue value = e.Value;
- // // //if (value == null)
- // // //{
- // // // if (!(dictionaryB.ContainsKey(key)))
- // // // {
- // // // return false;
- // // // }
- // // //}
- // // //else
- // // //{
- // // // TValue valueB;
- // // // if (!dictionaryB.TryGetValue(key, out valueB) || !(deep ? Equals(value, valueB, deep) : value.Equals(valueB)))
- // // // {
- // // // return false;
- // // // }
- // // //}
- // // }
- // //}
-
- // return true;
- //}
-
- //public static bool Equals<TKey, TValue>(KeyValuePair<TKey, TValue> kvpA, KeyValuePair<TKey, TValue> kvpB)
- //{
- // return Equals(kvpA, kvpB, false);
- //}
-
- //public static bool Equals<TKey, TValue>(KeyValuePair<TKey, TValue> kvpA, KeyValuePair<TKey, TValue> kvpB, bool deep)
- //{
- // return Equals(kvpA.Key, kvpB.Key, deep) && Equals(kvpA.Value, kvpB.Value, deep);
- // //if (deep)
- // //{
- // // return Equals(kvpA.Key, kvpB.Key, deep) && Equals(kvpA.Value, kvpB.Value, deep);
- // //}
- // //return kvpA.Equals(kvpB);
- //}
-
- //new public static bool Equals(object objA, object objB)
- //{
- // return Equals(objA, objB, false);
- //}
-
- //public static bool Equals(object objA, object objB, bool deep)
- //{
- // Type t = objA.GetType();
- // if (t.IsGenericType
- // && (t.GetGenericTypeDefinition().GetInterfaces().Any(x => x.IsAssignableFrom(typeof(IList<>)))
- // || t.GetGenericTypeDefinition().GetInterfaces().Any(x => x.IsAssignableFrom(typeof(ISet<>)))
- // || t.GetGenericTypeDefinition().GetInterfaces().Any(x => x.IsAssignableFrom(typeof(IDictionary<,>)))))
- // {
- // dynamic genericType = Convert.ChangeType(objA, t);
- // return Equals(genericType, objB, deep);
- // }
-
- // return objA.Equals(objB);
- //}
-
-
- //public static string ToString<T>(ICollection<T> collection)
- //{
- // return ToString(collection, true);
- //}
-
- ///// <summary>
- ///// This is the same implementation of ToString from Java's AbstractCollection
- ///// (the default implementation for all sets and lists)
- ///// </summary>
- //public static string ToString<T>(ICollection<T> collection, bool deep)
- //{
- // if (collection.Count == 0)
- // {
- // return "[]";
- // }
-
- // using (var it = collection.GetEnumerator())
- // {
- // StringBuilder sb = new StringBuilder();
- // sb.Append('[');
- // it.MoveNext();
- // while (true)
- // {
- // T e = it.Current;
- // sb.Append(object.ReferenceEquals(e, collection) ? "(this Collection)" : deep ? ToString(e, deep) : e.ToString());
- // if (!it.MoveNext())
- // {
- // return sb.Append(']').ToString();
- // }
- // sb.Append(',').Append(' ');
- // }
- // }
- //}
-
- //public static string ToString<TKey, TValue>(IDictionary<TKey, TValue> dictionary)
- //{
- // return ToString(dictionary, true);
- //}
-
- ///// <summary>
- ///// This is the same implementation of ToString from Java's AbstractMap
- ///// (the default implementation for all dictionaries)
- ///// </summary>
- //public static string ToString<TKey, TValue>(IDictionary<TKey, TValue> dictionary, bool deep)
- //{
- // if (dictionary.Count == 0)
- // {
- // return "{}";
- // }
-
- // using (var i = dictionary.GetEnumerator())
- // {
- // StringBuilder sb = new StringBuilder();
- // sb.Append('{');
- // i.MoveNext();
- // while (true)
- // {
- // KeyValuePair<TKey, TValue> e = i.Current;
- // TKey key = e.Key;
- // TValue value = e.Value;
- // sb.Append(object.ReferenceEquals(key, dictionary) ? "(this Dictionary)" : deep ? ToString(key, deep) : key.ToString());
- // sb.Append('=');
- // sb.Append(object.ReferenceEquals(value, dictionary) ? "(this Dictionary)" : deep ? ToString(value, deep) : value.ToString());
- // if (!i.MoveNext())
- // {
- // return sb.Append('}').ToString();
- // }
- // sb.Append(',').Append(' ');
- // }
- // }
- //}
-
- //public static string ToString(object obj)
- //{
- // return ToString(obj, true);
- //}
-
- //public static string ToString(object obj, bool deep)
- //{
- // Type t = obj.GetType();
- // if (t.IsGenericType
- // && (t.GetGenericTypeDefinition().GetInterfaces().Any(x => x.IsAssignableFrom(typeof(ICollection<>)))
- // || t.GetGenericTypeDefinition().GetInterfaces().Any(x => x.IsAssignableFrom(typeof(IDictionary<,>)))))
- // {
- // dynamic genericType = Convert.ChangeType(obj, t);
- // return ToString(genericType, deep);
- // }
-
- // return obj.ToString();
- //}
-
#region Nested Types
#region SetFromMap
[07/50] lucenenet git commit:
Lucene.Net.Core.Search.Spans.SpanNearQuery: Replaced ValueList with
Equatable.Wrap(), which allows any type of list to be utilized
Posted by ni...@apache.org.
Lucene.Net.Core.Search.Spans.SpanNearQuery: Replaced ValueList<T> with Equatable.Wrap(), which allows any type of list to be utilized
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/3489bd19
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/3489bd19
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/3489bd19
Branch: refs/heads/api-work
Commit: 3489bd19d432d0f1bb939644421ac78def1085e8
Parents: 476b289
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Mar 29 20:20:24 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:28 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Search/Spans/SpanNearQuery.cs | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3489bd19/src/Lucene.Net.Core/Search/Spans/SpanNearQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Spans/SpanNearQuery.cs b/src/Lucene.Net.Core/Search/Spans/SpanNearQuery.cs
index 8de90aa..00b038a 100644
--- a/src/Lucene.Net.Core/Search/Spans/SpanNearQuery.cs
+++ b/src/Lucene.Net.Core/Search/Spans/SpanNearQuery.cs
@@ -37,9 +37,7 @@ namespace Lucene.Net.Search.Spans
/// </summary>
public class SpanNearQuery : SpanQuery
{
- // LUCENENET NOTE: The hash code needs to be made from the hash codes of all elements.
- // So, we force all subclasses to use ValueList<SpanQuery> instead of IList<SpanQuery> to ensure that logic is in place.
- protected readonly ValueList<SpanQuery> m_clauses;
+ protected readonly IList<SpanQuery> m_clauses;
protected int m_slop;
protected bool m_inOrder;
@@ -228,7 +226,7 @@ namespace Lucene.Net.Search.Spans
{
return false;
}
- if (!m_clauses.SequenceEqual(spanNearQuery.m_clauses))
+ if (!Equatable.Wrap(m_clauses).Equals(spanNearQuery.m_clauses))
{
return false;
}
@@ -239,7 +237,7 @@ namespace Lucene.Net.Search.Spans
public override int GetHashCode()
{
int result;
- result = m_clauses.GetHashCode();
+ result = Equatable.Wrap(m_clauses).GetHashCode();
// Mix bits before folding in things like boost, since it could cancel the
// last element of clauses. this particular mix also serves to
// differentiate SpanNearQuery hashcodes from others.
[41/50] lucenenet git commit: Lucene.Net.Core.Store: Removed
NoSuchDirectoryException and replaced with
System.IO.DirectoryNotFoundException.
Posted by ni...@apache.org.
Lucene.Net.Core.Store: Removed NoSuchDirectoryException and replaced with System.IO.DirectoryNotFoundException.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/0e2de164
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/0e2de164
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/0e2de164
Branch: refs/heads/api-work
Commit: 0e2de164d6659aa913a327f1858d71b7fe4e8ac8
Parents: b6dcfe8
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 17:15:57 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 17:20:01 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Index/DirectoryReader.cs | 16 ++++-
src/Lucene.Net.Core/Index/IndexFileDeleter.cs | 20 +++++-
src/Lucene.Net.Core/Index/IndexWriter.cs | 6 ++
src/Lucene.Net.Core/Index/SegmentInfos.cs | 3 +-
src/Lucene.Net.Core/Store/Directory.cs | 2 +-
src/Lucene.Net.Core/Store/FSDirectory.cs | 8 +--
.../Store/FileSwitchDirectory.cs | 7 +-
.../Store/NRTCachingDirectory.cs | 2 +-
.../Store/NoSuchDirectoryException.cs | 76 ++++++++++----------
.../Util/LuceneTestCase.cs | 6 ++
.../Index/TestDirectoryReader.cs | 3 +-
.../Index/TestIndexWriterExceptions.cs | 6 ++
.../Index/TestIndexWriterLockRelease.cs | 24 +++++++
src/Lucene.Net.Tests/Store/TestDirectory.cs | 13 +++-
.../Store/TestFileSwitchDirectory.cs | 2 +-
.../Store/TestNRTCachingDirectory.cs | 2 +-
16 files changed, 140 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/src/Lucene.Net.Core/Index/DirectoryReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/DirectoryReader.cs b/src/Lucene.Net.Core/Index/DirectoryReader.cs
index 3d55e8e..4a2b588 100644
--- a/src/Lucene.Net.Core/Index/DirectoryReader.cs
+++ b/src/Lucene.Net.Core/Index/DirectoryReader.cs
@@ -24,7 +24,6 @@ namespace Lucene.Net.Index
// javadocs
using Directory = Lucene.Net.Store.Directory;
- using NoSuchDirectoryException = Lucene.Net.Store.NoSuchDirectoryException;
/// <summary>
/// DirectoryReader is an implementation of <seealso cref="CompositeReader"/>
@@ -315,6 +314,19 @@ namespace Lucene.Net.Index
//{
// sis = null;
//}
+ // LUCENENET specific - since NoSuchDirectoryException subclasses FileNotFoundException
+ // in Lucene, we need to catch it here to be on the safe side.
+ catch (System.IO.DirectoryNotFoundException)
+ {
+ // LUCENE-948: on NFS (and maybe others), if
+ // you have writers switching back and forth
+ // between machines, it's very likely that the
+ // dir listing will be stale and will claim a
+ // file segments_X exists when in fact it
+ // doesn't. So, we catch this and handle it
+ // as if the file does not exist
+ sis = null;
+ }
if (sis != null)
{
@@ -356,7 +368,7 @@ namespace Lucene.Net.Index
files = directory.ListAll();
}
#pragma warning disable 168
- catch (NoSuchDirectoryException nsde)
+ catch (DirectoryNotFoundException nsde)
#pragma warning restore 168
{
// Directory does not exist --> no index exists
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/src/Lucene.Net.Core/Index/IndexFileDeleter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/IndexFileDeleter.cs b/src/Lucene.Net.Core/Index/IndexFileDeleter.cs
index a31b6d7..69a4ff3 100644
--- a/src/Lucene.Net.Core/Index/IndexFileDeleter.cs
+++ b/src/Lucene.Net.Core/Index/IndexFileDeleter.cs
@@ -29,7 +29,6 @@ namespace Lucene.Net.Index
using CollectionUtil = Lucene.Net.Util.CollectionUtil;
using Directory = Lucene.Net.Store.Directory;
using InfoStream = Lucene.Net.Util.InfoStream;
- using NoSuchDirectoryException = Lucene.Net.Store.NoSuchDirectoryException;
/*
* this class keeps track of each SegmentInfos instance that
@@ -149,7 +148,7 @@ namespace Lucene.Net.Index
files = directory.ListAll();
}
#pragma warning disable 168
- catch (NoSuchDirectoryException e)
+ catch (DirectoryNotFoundException e)
#pragma warning restore 168
{
// it means the directory is empty, so ignore it.
@@ -214,6 +213,23 @@ namespace Lucene.Net.Index
// }
// sis = null;
//}
+ // LUCENENET specific - since NoSuchDirectoryException subclasses FileNotFoundException
+ // in Lucene, we need to catch it here to be on the safe side.
+ catch (System.IO.DirectoryNotFoundException)
+ {
+ // LUCENE-948: on NFS (and maybe others), if
+ // you have writers switching back and forth
+ // between machines, it's very likely that the
+ // dir listing will be stale and will claim a
+ // file segments_X exists when in fact it
+ // doesn't. So, we catch this and handle it
+ // as if the file does not exist
+ if (infoStream.IsEnabled("IFD"))
+ {
+ infoStream.Message("IFD", "init: hit FileNotFoundException when loading commit \"" + fileName + "\"; skipping this commit point");
+ }
+ sis = null;
+ }
catch (IOException e)
{
if (SegmentInfos.GenerationFromSegmentsFileName(fileName) <= currentGen && directory.FileLength(fileName) > 0)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/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 d7d5bd4..5032de0 100644
--- a/src/Lucene.Net.Core/Index/IndexWriter.cs
+++ b/src/Lucene.Net.Core/Index/IndexWriter.cs
@@ -5934,6 +5934,12 @@ namespace Lucene.Net.Index
//{
// return false;
//}
+ // LUCENENET specific - since NoSuchDirectoryException subclasses FileNotFoundException
+ // in Lucene, we need to catch it here to be on the safe side.
+ catch (System.IO.DirectoryNotFoundException)
+ {
+ return false;
+ }
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/src/Lucene.Net.Core/Index/SegmentInfos.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SegmentInfos.cs b/src/Lucene.Net.Core/Index/SegmentInfos.cs
index 960dedc..733d3d5 100644
--- a/src/Lucene.Net.Core/Index/SegmentInfos.cs
+++ b/src/Lucene.Net.Core/Index/SegmentInfos.cs
@@ -38,7 +38,6 @@ namespace Lucene.Net.Index
using Lucene3xCodec = Lucene.Net.Codecs.Lucene3x.Lucene3xCodec;
using Lucene3xSegmentInfoFormat = Lucene.Net.Codecs.Lucene3x.Lucene3xSegmentInfoFormat;
using Lucene3xSegmentInfoReader = Lucene.Net.Codecs.Lucene3x.Lucene3xSegmentInfoReader;
- using NoSuchDirectoryException = Lucene.Net.Store.NoSuchDirectoryException;
using StringHelper = Lucene.Net.Util.StringHelper;
/// <summary>
@@ -214,7 +213,7 @@ namespace Lucene.Net.Index
{
return GetLastCommitGeneration(directory.ListAll());
}
- catch (NoSuchDirectoryException)
+ catch (DirectoryNotFoundException)
{
return -1;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/src/Lucene.Net.Core/Store/Directory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/Directory.cs b/src/Lucene.Net.Core/Store/Directory.cs
index 8f6f4a7..6fa8b6a 100644
--- a/src/Lucene.Net.Core/Store/Directory.cs
+++ b/src/Lucene.Net.Core/Store/Directory.cs
@@ -45,7 +45,7 @@ namespace Lucene.Net.Store
/// <summary>
/// Returns an array of strings, one for each file in the directory.
/// </summary>
- /// <exception cref="NoSuchDirectoryException"> if the directory is not prepared for any
+ /// <exception cref="DirectoryNotFoundException"> if the directory is not prepared for any
/// write operations (such as <see cref="CreateOutput(string, IOContext)"/>). </exception>
/// <exception cref="System.IO.IOException"> in case of other IO errors </exception>
public abstract string[] ListAll();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/src/Lucene.Net.Core/Store/FSDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/FSDirectory.cs b/src/Lucene.Net.Core/Store/FSDirectory.cs
index 6c9ce60..b66e535 100644
--- a/src/Lucene.Net.Core/Store/FSDirectory.cs
+++ b/src/Lucene.Net.Core/Store/FSDirectory.cs
@@ -118,7 +118,7 @@ namespace Lucene.Net.Store
if (File.Exists(path.FullName))
{
- throw new NoSuchDirectoryException("file '" + path.FullName + "' exists but is not a directory");
+ throw new DirectoryNotFoundException("file '" + path.FullName + "' exists but is not a directory");
}
SetLockFactory(lockFactory);
@@ -223,7 +223,7 @@ namespace Lucene.Net.Store
/// directory. This method never returns <c>null</c> (throws
/// <seealso cref="IOException"/> instead).
/// </summary>
- /// <exception cref="NoSuchDirectoryException"> if the directory
+ /// <exception cref="DirectoryNotFoundException"> if the directory
/// does not exist, or does exist but is not a
/// directory or is invalid (for example, it is on an unmapped drive). </exception>
/// <exception cref="System.Security.SecurityException">The caller does not have the required permission.</exception>
@@ -231,11 +231,11 @@ namespace Lucene.Net.Store
{
if (!System.IO.Directory.Exists(dir.FullName))
{
- throw new NoSuchDirectoryException("directory '" + dir + "' does not exist");
+ throw new DirectoryNotFoundException("directory '" + dir + "' does not exist");
}
else if (File.Exists(dir.FullName))
{
- throw new NoSuchDirectoryException("file '" + dir + "' exists but is not a directory");
+ throw new DirectoryNotFoundException("file '" + dir + "' exists but is not a directory");
}
// Exclude subdirs
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/src/Lucene.Net.Core/Store/FileSwitchDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/FileSwitchDirectory.cs b/src/Lucene.Net.Core/Store/FileSwitchDirectory.cs
index 4d52a93..3e40945 100644
--- a/src/Lucene.Net.Core/Store/FileSwitchDirectory.cs
+++ b/src/Lucene.Net.Core/Store/FileSwitchDirectory.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
namespace Lucene.Net.Store
@@ -92,7 +93,7 @@ namespace Lucene.Net.Store
// but if one underlying delegate is an FSDir and mkdirs() has not
// yet been called, because so far everything is written to the other,
// in this case, we don't want to throw a NoSuchDirectoryException
- NoSuchDirectoryException exc = null;
+ DirectoryNotFoundException exc = null;
try
{
foreach (string f in primaryDir.ListAll())
@@ -100,7 +101,7 @@ namespace Lucene.Net.Store
files.Add(f);
}
}
- catch (NoSuchDirectoryException e)
+ catch (DirectoryNotFoundException e)
{
exc = e;
}
@@ -112,7 +113,7 @@ namespace Lucene.Net.Store
files.Add(f);
}
}
- catch (NoSuchDirectoryException e)
+ catch (DirectoryNotFoundException e)
{
// we got NoSuchDirectoryException from both dirs
// rethrow the first.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/src/Lucene.Net.Core/Store/NRTCachingDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/NRTCachingDirectory.cs b/src/Lucene.Net.Core/Store/NRTCachingDirectory.cs
index 3d42334..8a603a3 100644
--- a/src/Lucene.Net.Core/Store/NRTCachingDirectory.cs
+++ b/src/Lucene.Net.Core/Store/NRTCachingDirectory.cs
@@ -149,7 +149,7 @@ namespace Lucene.Net.Store
files.Add(f);
}
}
- catch (NoSuchDirectoryException ex)
+ catch (DirectoryNotFoundException ex)
{
// however, if there are no cached files, then the directory truly
// does not "exist"
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/src/Lucene.Net.Core/Store/NoSuchDirectoryException.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/NoSuchDirectoryException.cs b/src/Lucene.Net.Core/Store/NoSuchDirectoryException.cs
index 2b91bb4..a75c4dc 100644
--- a/src/Lucene.Net.Core/Store/NoSuchDirectoryException.cs
+++ b/src/Lucene.Net.Core/Store/NoSuchDirectoryException.cs
@@ -1,38 +1,42 @@
-using System;
-using System.IO;
+// LUCENENET specific - excluding this class in favor of System.IO.DirectoryNotFoundException,
+// although that means we need to catch System.IO.DirectoryNotFoundException everywhere that
+// FileNotFoundException is being caught (because it is a superclass) to be sure we have the same behavior.
-namespace Lucene.Net.Store
-{
- /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+//using System;
+//using System.IO;
- /// <summary>
- /// This exception is thrown when you try to list a
- /// non-existent directory.
- /// </summary>
- // LUCENENET: All exeption classes should be marked serializable
-#if FEATURE_SERIALIZABLE
- [Serializable]
-#endif
- public class NoSuchDirectoryException : FileNotFoundException // LUCENENET TODO: API Replace with System.IO.DirectoryNotFoundException ? Note that it does not subclass FileNotFoundException
- {
- public NoSuchDirectoryException(string message)
- : base(message)
- {
- }
- }
-}
\ No newline at end of file
+//namespace Lucene.Net.Store
+//{
+// /*
+// * Licensed to the Apache Software Foundation (ASF) under one or more
+// * contributor license agreements. See the NOTICE file distributed with
+// * this work for additional information regarding copyright ownership.
+// * The ASF licenses this file to You under the Apache License, Version 2.0
+// * (the "License"); you may not use this file except in compliance with
+// * the License. You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing, software
+// * distributed under the License is distributed on an "AS IS" BASIS,
+// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// * See the License for the specific language governing permissions and
+// * limitations under the License.
+// */
+
+// /// <summary>
+// /// This exception is thrown when you try to list a
+// /// non-existent directory.
+// /// </summary>
+// // LUCENENET: All exeption classes should be marked serializable
+//#if FEATURE_SERIALIZABLE
+// [Serializable]
+//#endif
+// public class NoSuchDirectoryException : FileNotFoundException
+// {
+// public NoSuchDirectoryException(string message)
+// : base(message)
+// {
+// }
+// }
+//}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 1772485..b0a1a49 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -2658,6 +2658,12 @@ namespace Lucene.Net.Util
//{
// return false;
//}
+ // LUCENENET specific - since NoSuchDirectoryException subclasses FileNotFoundException
+ // in Lucene, we need to catch it here to be on the safe side.
+ catch (System.IO.DirectoryNotFoundException)
+ {
+ return false;
+ }
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs b/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs
index 25cbad9..73f7bb4 100644
--- a/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs
@@ -38,7 +38,6 @@ namespace Lucene.Net.Index
*/
using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
- using NoSuchDirectoryException = Lucene.Net.Store.NoSuchDirectoryException;
using StoredField = StoredField;
using StringField = StringField;
using TestUtil = Lucene.Net.Util.TestUtil;
@@ -771,7 +770,7 @@ namespace Lucene.Net.Index
Assert.Fail("did not hit expected exception");
}
#pragma warning disable 168
- catch (NoSuchDirectoryException nsde)
+ catch (DirectoryNotFoundException nsde)
#pragma warning restore 168
{
// expected
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
index dd6cbb5..ed5587f 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs
@@ -2083,6 +2083,12 @@ namespace Lucene.Net.Index
{
continue;
}
+ // LUCENENET specific - since NoSuchDirectoryException subclasses FileNotFoundException
+ // in Lucene, we need to catch it here to be on the safe side.
+ catch (System.IO.DirectoryNotFoundException)
+ {
+ continue;
+ }
failure.ClearDoFail();
iw.Dispose();
ir = DirectoryReader.Open(dir);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/src/Lucene.Net.Tests/Index/TestIndexWriterLockRelease.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterLockRelease.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterLockRelease.cs
index 06a3e52..a228a82 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterLockRelease.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterLockRelease.cs
@@ -55,6 +55,30 @@ namespace Lucene.Net.Index
#pragma warning restore 168
{
}
+ // LUCENENET specific - since NoSuchDirectoryException subclasses FileNotFoundException
+ // in Lucene, we need to catch it here to be on the safe side.
+ catch (System.IO.DirectoryNotFoundException)
+ {
+ }
+ }
+ // LUCENENET specific - since NoSuchDirectoryException subclasses FileNotFoundException
+ // in Lucene, we need to catch it here to be on the safe side.
+ catch (System.IO.DirectoryNotFoundException)
+ {
+ try
+ {
+ new IndexWriter(dir, (new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))).SetOpenMode(OpenMode.APPEND));
+ }
+#pragma warning disable 168
+ catch (FileNotFoundException /*| NoSuchFileException*/ e1)
+#pragma warning restore 168
+ {
+ }
+ // LUCENENET specific - since NoSuchDirectoryException subclasses FileNotFoundException
+ // in Lucene, we need to catch it here to be on the safe side.
+ catch (System.IO.DirectoryNotFoundException)
+ {
+ }
}
finally
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/src/Lucene.Net.Tests/Store/TestDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Store/TestDirectory.cs b/src/Lucene.Net.Tests/Store/TestDirectory.cs
index c8cbb34..735a5c5 100644
--- a/src/Lucene.Net.Tests/Store/TestDirectory.cs
+++ b/src/Lucene.Net.Tests/Store/TestDirectory.cs
@@ -146,6 +146,11 @@ namespace Lucene.Net.Store
#pragma warning restore 168
{
}
+ // LUCENENET specific - since NoSuchDirectoryException subclasses FileNotFoundException
+ // in Lucene, we need to catch it here to be on the safe side.
+ catch (System.IO.DirectoryNotFoundException)
+ {
+ }
catch (IOException e)
{
if (!e.Message.Contains("still open for writing"))
@@ -355,7 +360,7 @@ namespace Lucene.Net.Store
Assert.Fail("did not hit expected exception");
}
#pragma warning disable 168
- catch (NoSuchDirectoryException nsde)
+ catch (DirectoryNotFoundException nsde)
#pragma warning restore 168
{
// Expected
@@ -406,6 +411,12 @@ namespace Lucene.Net.Store
{
// ok
}
+ // LUCENENET specific - since NoSuchDirectoryException subclasses FileNotFoundException
+ // in Lucene, we need to catch it here to be on the safe side.
+ catch (System.IO.DirectoryNotFoundException)
+ {
+ // ok
+ }
// directory is still empty
Assert.AreEqual(0, fsdir.ListAll().Length);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/src/Lucene.Net.Tests/Store/TestFileSwitchDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Store/TestFileSwitchDirectory.cs b/src/Lucene.Net.Tests/Store/TestFileSwitchDirectory.cs
index 3eb0de7..9aebdf4 100644
--- a/src/Lucene.Net.Tests/Store/TestFileSwitchDirectory.cs
+++ b/src/Lucene.Net.Tests/Store/TestFileSwitchDirectory.cs
@@ -120,7 +120,7 @@ namespace Lucene.Net.Store
DirectoryReader.Open(dir);
Assert.Fail("did not hit expected exception");
}
- catch (NoSuchDirectoryException)
+ catch (DirectoryNotFoundException)
{
// expected
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0e2de164/src/Lucene.Net.Tests/Store/TestNRTCachingDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Store/TestNRTCachingDirectory.cs b/src/Lucene.Net.Tests/Store/TestNRTCachingDirectory.cs
index 806295b..0d7aba1 100644
--- a/src/Lucene.Net.Tests/Store/TestNRTCachingDirectory.cs
+++ b/src/Lucene.Net.Tests/Store/TestNRTCachingDirectory.cs
@@ -151,7 +151,7 @@ namespace Lucene.Net.Store
DirectoryReader.Open(dir);
Assert.Fail("did not hit expected exception");
}
- catch (NoSuchDirectoryException)
+ catch (DirectoryNotFoundException)
{
// expected
}
[11/50] lucenenet git commit: Lucene.Net.Core.Search.BooleanQuery:
Replaced ValueList with EquatableList
Posted by ni...@apache.org.
Lucene.Net.Core.Search.BooleanQuery: Replaced ValueList<T> with EquatableList<T>
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/b3d6ef8c
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/b3d6ef8c
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/b3d6ef8c
Branch: refs/heads/api-work
Commit: b3d6ef8ca7430b26831ee9eb4aa87b41de4c9cef
Parents: aa3a11a
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Mar 29 20:48:32 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:29 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Search/BooleanQuery.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b3d6ef8c/src/Lucene.Net.Core/Search/BooleanQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/BooleanQuery.cs b/src/Lucene.Net.Core/Search/BooleanQuery.cs
index 3fca2fc..9d3862b 100644
--- a/src/Lucene.Net.Core/Search/BooleanQuery.cs
+++ b/src/Lucene.Net.Core/Search/BooleanQuery.cs
@@ -80,7 +80,7 @@ namespace Lucene.Net.Search
}
}
- private ValueList<BooleanClause> clauses = new ValueList<BooleanClause>();
+ private EquatableList<BooleanClause> clauses = new EquatableList<BooleanClause>();
private readonly bool disableCoord;
/// <summary>
@@ -585,7 +585,7 @@ namespace Lucene.Net.Search
public override object Clone()
{
BooleanQuery clone = (BooleanQuery)base.Clone();
- clone.clauses = (ValueList<BooleanClause>)this.clauses.Clone();
+ clone.clauses = (EquatableList<BooleanClause>)this.clauses.Clone();
return clone;
}
[33/50] lucenenet git commit:
Lucene.Net.Core.Support.Arrays.GetHashCode(): Changed implementation to be
more like the original JDK version,
including the ability to build the hash code based on the values of the nested
value if it is a collection
Posted by ni...@apache.org.
Lucene.Net.Core.Support.Arrays.GetHashCode(): Changed implementation to be more like the original JDK version, including the ability to build the hash code based on the values of the nested value if it is a collection
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/842182c3
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/842182c3
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/842182c3
Branch: refs/heads/api-work
Commit: 842182c3439c014b8b7e3248e504c754112005fb
Parents: d072fc7
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 09:40:29 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:40:29 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Support/Arrays.cs | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/842182c3/src/Lucene.Net.Core/Support/Arrays.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/Arrays.cs b/src/Lucene.Net.Core/Support/Arrays.cs
index 8a83f22..80cd06e 100644
--- a/src/Lucene.Net.Core/Support/Arrays.cs
+++ b/src/Lucene.Net.Core/Support/Arrays.cs
@@ -11,14 +11,18 @@ namespace Lucene.Net.Support
if (a == null)
return 0;
- int hash = 17;
+ int result = 1;
+ bool isValueType = typeof(T).IsValueType;
foreach (var item in a)
{
- hash = hash * 23 + (item == null ? 0 : item.GetHashCode());
+ result = 31 * result + (item == null ? 0 :
+ // LUCENENET specific: if this is a reference type, pass to
+ // Collections.GetHashCode() in case we have an array of collections
+ (isValueType ? item.GetHashCode() : Collections.GetHashCode(item)));
}
- return hash;
+ return result;
}
/// <summary>
[14/50] lucenenet git commit: Lucene.Net.Core.Util.Automaton:
Replaced ValueHashSet with EquatableSet
Posted by ni...@apache.org.
Lucene.Net.Core.Util.Automaton: Replaced ValueHashSet with EquatableSet
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/46418a44
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/46418a44
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/46418a44
Branch: refs/heads/api-work
Commit: 46418a44901ecc09626db0119cb6a9a64ec48969
Parents: 8801245
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Mar 29 21:36:45 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:30 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Util/Automaton/MinimizationOperations.cs | 8 ++++----
src/Lucene.Net.Core/Util/Automaton/RegExp.cs | 2 +-
src/Lucene.Net.Core/Util/Automaton/SpecialOperations.cs | 8 ++++----
.../Util/Automaton/AutomatonTestUtil.cs | 4 ++--
4 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/46418a44/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 1350478..579845f 100644
--- a/src/Lucene.Net.Core/Util/Automaton/MinimizationOperations.cs
+++ b/src/Lucene.Net.Core/Util/Automaton/MinimizationOperations.cs
@@ -81,7 +81,7 @@ namespace Lucene.Net.Util.Automaton
State[] states = a.GetNumberedStates();
int sigmaLen = sigma.Length, statesLen = states.Length;
List<State>[,] reverse = new List<State>[statesLen, sigmaLen];
- HashSet<State>[] partition = new ValueHashSet<State>[statesLen];
+ ISet<State>[] partition = new EquatableSet<State>[statesLen];
List<State>[] splitblock = new List<State>[statesLen];
int[] block = new int[statesLen];
StateList[,] active = new StateList[statesLen, sigmaLen];
@@ -92,7 +92,7 @@ namespace Lucene.Net.Util.Automaton
for (int q = 0; q < statesLen; q++)
{
splitblock[q] = new List<State>();
- partition[q] = new ValueHashSet<State>();
+ partition[q] = new EquatableSet<State>();
for (int x = 0; x < sigmaLen; x++)
{
active[q, x] = new StateList();
@@ -175,8 +175,8 @@ namespace Lucene.Net.Util.Automaton
List<State> sb = splitblock[j];
if (sb.Count < partition[j].Count)
{
- HashSet<State> b1 = partition[j];
- HashSet<State> b2 = partition[k];
+ ISet<State> b1 = partition[j];
+ ISet<State> b2 = partition[k];
foreach (State s in sb)
{
b1.Remove(s);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/46418a44/src/Lucene.Net.Core/Util/Automaton/RegExp.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Automaton/RegExp.cs b/src/Lucene.Net.Core/Util/Automaton/RegExp.cs
index 87be9eb..1bfe383 100644
--- a/src/Lucene.Net.Core/Util/Automaton/RegExp.cs
+++ b/src/Lucene.Net.Core/Util/Automaton/RegExp.cs
@@ -758,7 +758,7 @@ namespace Lucene.Net.Util.Automaton
/// </summary>
public virtual ISet<string> GetIdentifiers()
{
- HashSet<string> set = new ValueHashSet<string>();
+ ISet<string> set = new EquatableSet<string>();
GetIdentifiers(set);
return set;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/46418a44/src/Lucene.Net.Core/Util/Automaton/SpecialOperations.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Automaton/SpecialOperations.cs b/src/Lucene.Net.Core/Util/Automaton/SpecialOperations.cs
index 8fad6e6..7dfffe9 100644
--- a/src/Lucene.Net.Core/Util/Automaton/SpecialOperations.cs
+++ b/src/Lucene.Net.Core/Util/Automaton/SpecialOperations.cs
@@ -236,9 +236,9 @@ namespace Lucene.Net.Util.Automaton
{
a.ExpandSingleton();
// reverse all edges
- Dictionary<State, HashSet<Transition>> m = new Dictionary<State, HashSet<Transition>>();
+ Dictionary<State, ISet<Transition>> m = new Dictionary<State, ISet<Transition>>();
State[] states = a.GetNumberedStates();
- HashSet<State> accept = new ValueHashSet<State>();
+ ISet<State> accept = new EquatableSet<State>();
foreach (State s in states)
{
if (s.Accept)
@@ -248,7 +248,7 @@ namespace Lucene.Net.Util.Automaton
}
foreach (State r in states)
{
- m[r] = new ValueHashSet<Transition>();
+ m[r] = new EquatableSet<Transition>();
r.accept = false;
}
foreach (State r in states)
@@ -260,7 +260,7 @@ namespace Lucene.Net.Util.Automaton
}
foreach (State r in states)
{
- HashSet<Transition> tr = m[r];
+ ISet<Transition> tr = m[r];
r.SetTransitions(tr.ToArray(/*new Transition[tr.Count]*/));
}
// make new initial+final states
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/46418a44/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 47385b3..6440283 100644
--- a/src/Lucene.Net.TestFramework/Util/Automaton/AutomatonTestUtil.cs
+++ b/src/Lucene.Net.TestFramework/Util/Automaton/AutomatonTestUtil.cs
@@ -455,7 +455,7 @@ namespace Lucene.Net.Util.Automaton
{
return;
}
- HashSet<State> initialset = new ValueHashSet<State>();
+ ISet<State> initialset = new EquatableSet<State>();
initialset.Add(a.initial);
DeterminizeSimple(a, initialset);
}
@@ -490,7 +490,7 @@ namespace Lucene.Net.Util.Automaton
}
for (int n = 0; n < points.Length; n++)
{
- ISet<State> p = new ValueHashSet<State>();
+ ISet<State> p = new EquatableSet<State>();
foreach (State q in s)
{
foreach (Transition t in q.GetTransitions())
[40/50] lucenenet git commit: SWEEP: Changed all SizeInBytes()
methods to GetSizeInBytes()
Posted by ni...@apache.org.
SWEEP: Changed all SizeInBytes() methods to GetSizeInBytes()
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/b6dcfe8a
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/b6dcfe8a
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/b6dcfe8a
Branch: refs/heads/api-work
Commit: b6dcfe8aad432d1c7add7bd5f0619a5f3ba56c92
Parents: d850d55
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 16:58:01 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 16:58:01 2017 +0700
----------------------------------------------------------------------
.../BlockTerms/VariableGapTermsIndexReader.cs | 2 +-
src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs | 2 +-
src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs | 2 +-
.../Memory/MemoryDocValuesProducer.cs | 4 ++--
.../Memory/MemoryPostingsFormat.cs | 2 +-
.../SimpleText/SimpleTextFieldsReader.cs | 2 +-
src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs | 4 ++--
.../Codecs/Lucene42/Lucene42DocValuesProducer.cs | 4 ++--
src/Lucene.Net.Core/Index/BufferedUpdates.cs | 4 ++--
src/Lucene.Net.Core/Index/CheckIndex.cs | 2 +-
src/Lucene.Net.Core/Index/DocValuesUpdate.cs | 10 +++++-----
.../Index/DocumentsWriterPerThread.cs | 4 ++--
src/Lucene.Net.Core/Index/FrozenBufferedUpdates.cs | 6 +++---
src/Lucene.Net.Core/Index/IndexWriter.cs | 10 +++++-----
src/Lucene.Net.Core/Index/LogMergePolicy.cs | 2 +-
src/Lucene.Net.Core/Index/MergePolicy.cs | 2 +-
src/Lucene.Net.Core/Index/PrefixCodedTerms.cs | 7 ++-----
src/Lucene.Net.Core/Index/SegmentCommitInfo.cs | 2 +-
src/Lucene.Net.Core/Index/TieredMergePolicy.cs | 4 ++--
src/Lucene.Net.Core/Search/CachingWrapperFilter.cs | 2 +-
src/Lucene.Net.Core/Store/NRTCachingDirectory.cs | 6 +++---
src/Lucene.Net.Core/Store/RAMDirectory.cs | 2 +-
src/Lucene.Net.Core/Store/RAMFile.cs | 9 +++------
src/Lucene.Net.Core/Store/RAMOutputStream.cs | 2 +-
src/Lucene.Net.Core/Util/Fst/Builder.cs | 4 ++--
src/Lucene.Net.Core/Util/Fst/FST.cs | 2 +-
src/Lucene.Net.Misc/Index/IndexSplitter.cs | 2 +-
.../Suggest/Analyzing/AnalyzingSuggester.cs | 2 +-
.../Suggest/Analyzing/FreeTextSuggester.cs | 2 +-
.../Suggest/Fst/FSTCompletionLookup.cs | 4 ++--
.../Suggest/Fst/WFSTCompletionLookup.cs | 2 +-
.../Index/AlcoholicMergePolicy.cs | 4 ++--
.../Store/MockDirectoryWrapper.cs | 12 ++++++------
.../Store/MockIndexOutputWrapper.cs | 2 +-
src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs | 2 +-
.../Index/TestIndexWriterOnDiskFull.cs | 2 +-
src/Lucene.Net.Tests/Index/TestRollingUpdates.cs | 2 +-
.../Index/TestSizeBoundedForceMerge.cs | 2 +-
.../Search/TestCachingWrapperFilter.cs | 2 +-
src/Lucene.Net.Tests/Store/TestRAMDirectory.cs | 6 +++---
src/Lucene.Net.Tests/Util/Fst/Test2BFST.cs | 16 ++++++++--------
src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs | 4 ++--
42 files changed, 81 insertions(+), 87 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs b/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs
index ae692c6..fe56cc9 100644
--- a/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs
+++ b/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs
@@ -261,7 +261,7 @@ namespace Lucene.Net.Codecs.BlockTerms
/// <summary>Returns approximate RAM bytes used</summary>
public virtual long RamBytesUsed()
{
- return fst == null ? 0 : fst.SizeInBytes();
+ return fst == null ? 0 : fst.GetSizeInBytes();
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
index 1e03403..85754de 100644
--- a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
+++ b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
@@ -1003,7 +1003,7 @@ namespace Lucene.Net.Codecs.Memory
{
if (r.index != null)
{
- ramBytesUsed += r.index.SizeInBytes();
+ ramBytesUsed += r.index.GetSizeInBytes();
ramBytesUsed += RamUsageEstimator.SizeOf(r.metaBytesBlock);
ramBytesUsed += RamUsageEstimator.SizeOf(r.metaLongsBlock);
ramBytesUsed += RamUsageEstimator.SizeOf(r.skipInfo);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
index 35ac4a2..7d732da 100644
--- a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
+++ b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
@@ -909,7 +909,7 @@ namespace Lucene.Net.Codecs.Memory
long ramBytesUsed = 0;
foreach (TermsReader r in fields.Values)
{
- ramBytesUsed += r.dict == null ? 0 : r.dict.SizeInBytes();
+ ramBytesUsed += r.dict == null ? 0 : r.dict.GetSizeInBytes();
}
return ramBytesUsed;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs
index 0537e00..b26bf2b 100644
--- a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs
+++ b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs
@@ -430,7 +430,7 @@ namespace Lucene.Net.Codecs.Memory
{
data.Seek(entry.offset);
instance = new FST<long?>(data, PositiveInt32Outputs.Singleton);
- ramBytesUsed.AddAndGet(instance.SizeInBytes());
+ ramBytesUsed.AddAndGet(instance.GetSizeInBytes());
fstInstances[field.Number] = instance;
}
}
@@ -545,7 +545,7 @@ namespace Lucene.Net.Codecs.Memory
{
data.Seek(entry.offset);
instance = new FST<long?>(data, PositiveInt32Outputs.Singleton);
- ramBytesUsed.AddAndGet(instance.SizeInBytes());
+ ramBytesUsed.AddAndGet(instance.GetSizeInBytes());
fstInstances[field.Number] = instance;
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
index fab9394..55a7e6f 100644
--- a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
+++ b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
@@ -1023,7 +1023,7 @@ namespace Lucene.Net.Codecs.Memory
public long RamBytesUsed()
{
- return ((fst != null) ? fst.SizeInBytes() : 0);
+ return ((fst != null) ? fst.GetSizeInBytes() : 0);
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
index 172b257..731ef52 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
@@ -674,7 +674,7 @@ namespace Lucene.Net.Codecs.SimpleText
/// <summary>Returns approximate RAM bytes used</summary>
public virtual long RamBytesUsed()
{
- return (_fst != null) ? _fst.SizeInBytes() : 0;
+ return (_fst != null) ? _fst.GetSizeInBytes() : 0;
}
public override TermsEnum GetIterator(TermsEnum reuse)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs b/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
index 3825e97..98bd36c 100644
--- a/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
@@ -678,7 +678,7 @@ namespace Lucene.Net.Codecs
/// Returns approximate RAM bytes used </summary>
public long RamBytesUsed()
{
- return ((index != null) ? index.SizeInBytes() : 0);
+ return ((index != null) ? index.GetSizeInBytes() : 0);
}
// NOTE: cannot seek!
@@ -1623,7 +1623,7 @@ namespace Lucene.Net.Codecs
{
stats.IndexNodeCount = outerInstance.index.NodeCount;
stats.IndexArcCount = outerInstance.index.ArcCount;
- stats.IndexNumBytes = outerInstance.index.SizeInBytes();
+ stats.IndexNumBytes = outerInstance.index.GetSizeInBytes();
}
currentFrame = staticFrame;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs b/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
index dde3fdf..010adb0 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
@@ -426,7 +426,7 @@ namespace Lucene.Net.Codecs.Lucene42
{
data.Seek(entry.Offset);
instance = new FST<long?>(data, PositiveInt32Outputs.Singleton);
- ramBytesUsed.AddAndGet(instance.SizeInBytes());
+ ramBytesUsed.AddAndGet(instance.GetSizeInBytes());
fstInstances[field.Number] = instance;
}
}
@@ -541,7 +541,7 @@ namespace Lucene.Net.Codecs.Lucene42
{
data.Seek(entry.Offset);
instance = new FST<long?>(data, PositiveInt32Outputs.Singleton);
- ramBytesUsed.AddAndGet(instance.SizeInBytes());
+ ramBytesUsed.AddAndGet(instance.GetSizeInBytes());
fstInstances[field.Number] = instance;
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/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 e21d595..a069fb4 100644
--- a/src/Lucene.Net.Core/Index/BufferedUpdates.cs
+++ b/src/Lucene.Net.Core/Index/BufferedUpdates.cs
@@ -276,7 +276,7 @@ namespace Lucene.Net.Index
numNumericUpdates.IncrementAndGet();
if (current == null)
{
- bytesUsed.AddAndGet(BYTES_PER_NUMERIC_UPDATE_ENTRY + update.SizeInBytes());
+ bytesUsed.AddAndGet(BYTES_PER_NUMERIC_UPDATE_ENTRY + update.GetSizeInBytes());
}
}
@@ -311,7 +311,7 @@ namespace Lucene.Net.Index
numBinaryUpdates.IncrementAndGet();
if (current == null)
{
- bytesUsed.AddAndGet(BYTES_PER_BINARY_UPDATE_ENTRY + update.SizeInBytes());
+ bytesUsed.AddAndGet(BYTES_PER_BINARY_UPDATE_ENTRY + update.GetSizeInBytes());
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Index/CheckIndex.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/CheckIndex.cs b/src/Lucene.Net.Core/Index/CheckIndex.cs
index 182b906..84657e1 100644
--- a/src/Lucene.Net.Core/Index/CheckIndex.cs
+++ b/src/Lucene.Net.Core/Index/CheckIndex.cs
@@ -717,7 +717,7 @@ namespace Lucene.Net.Index
segInfoStat.Compound = info.Info.UseCompoundFile;
Msg(infoStream, " numFiles=" + info.Files().Count);
segInfoStat.NumFiles = info.Files().Count;
- segInfoStat.SizeMB = info.SizeInBytes() / (1024.0 * 1024.0);
+ segInfoStat.SizeMB = info.GetSizeInBytes() / (1024.0 * 1024.0);
#pragma warning disable 612, 618
if (info.Info.GetAttribute(Lucene3xSegmentInfoFormat.DS_OFFSET_KEY) == null)
#pragma warning restore 612, 618
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Index/DocValuesUpdate.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/DocValuesUpdate.cs b/src/Lucene.Net.Core/Index/DocValuesUpdate.cs
index 17f20e8..5abd693 100644
--- a/src/Lucene.Net.Core/Index/DocValuesUpdate.cs
+++ b/src/Lucene.Net.Core/Index/DocValuesUpdate.cs
@@ -56,15 +56,15 @@ namespace Lucene.Net.Index
this.value = value;
}
- internal abstract long ValueSizeInBytes(); // LUCENENT TODO: Name GetValueSizeInBytes() ?
+ internal abstract long GetValueSizeInBytes();
- internal int SizeInBytes() // LUCENENT TODO: Name GetSizeInBytes() ?
+ internal int GetSizeInBytes()
{
int sizeInBytes = RAW_SIZE_IN_BYTES;
sizeInBytes += term.Field.Length * RamUsageEstimator.NUM_BYTES_CHAR;
sizeInBytes += term.Bytes.Bytes.Length;
sizeInBytes += field.Length * RamUsageEstimator.NUM_BYTES_CHAR;
- sizeInBytes += (int)ValueSizeInBytes();
+ sizeInBytes += (int)GetValueSizeInBytes();
return sizeInBytes;
}
@@ -87,7 +87,7 @@ namespace Lucene.Net.Index
{
}
- internal override long ValueSizeInBytes()
+ internal override long GetValueSizeInBytes()
{
return RAW_VALUE_SIZE_IN_BYTES + ((BytesRef)value).Bytes.Length;
}
@@ -104,7 +104,7 @@ namespace Lucene.Net.Index
{
}
- internal override long ValueSizeInBytes()
+ internal override long GetValueSizeInBytes()
{
return RamUsageEstimator.NUM_BYTES_INT64;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Index/DocumentsWriterPerThread.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/DocumentsWriterPerThread.cs b/src/Lucene.Net.Core/Index/DocumentsWriterPerThread.cs
index 90f80fd..980c954 100644
--- a/src/Lucene.Net.Core/Index/DocumentsWriterPerThread.cs
+++ b/src/Lucene.Net.Core/Index/DocumentsWriterPerThread.cs
@@ -580,7 +580,7 @@ namespace Lucene.Net.Index
if (infoStream.IsEnabled("DWPT"))
{
- double newSegmentSize = segmentInfoPerCommit.SizeInBytes() / 1024.0 / 1024.0;
+ double newSegmentSize = segmentInfoPerCommit.GetSizeInBytes() / 1024.0 / 1024.0;
infoStream.Message("DWPT", "flushed: segment=" + segmentInfo.Name + " ramUsed=" + startMBUsed.ToString(nf) + " MB" + " newFlushedSize(includes docstores)=" + newSegmentSize.ToString(nf) + " MB" + " docs/MB=" + (flushState.SegmentInfo.DocCount / newSegmentSize).ToString(nf));
}
@@ -620,7 +620,7 @@ namespace Lucene.Net.Index
IndexWriter.SetDiagnostics(newSegment.Info, IndexWriter.SOURCE_FLUSH);
- IOContext context = new IOContext(new FlushInfo(newSegment.Info.DocCount, newSegment.SizeInBytes()));
+ IOContext context = new IOContext(new FlushInfo(newSegment.Info.DocCount, newSegment.GetSizeInBytes()));
bool success = false;
try
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Index/FrozenBufferedUpdates.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/FrozenBufferedUpdates.cs b/src/Lucene.Net.Core/Index/FrozenBufferedUpdates.cs
index c315b54..34130c3 100644
--- a/src/Lucene.Net.Core/Index/FrozenBufferedUpdates.cs
+++ b/src/Lucene.Net.Core/Index/FrozenBufferedUpdates.cs
@@ -109,7 +109,7 @@ namespace Lucene.Net.Index
foreach (NumericDocValuesUpdate update in numericUpdates.Values)
{
allNumericUpdates.Add(update);
- numericUpdatesSize += update.SizeInBytes();
+ numericUpdatesSize += update.GetSizeInBytes();
}
}
numericDVUpdates = allNumericUpdates.ToArray();
@@ -125,12 +125,12 @@ namespace Lucene.Net.Index
foreach (BinaryDocValuesUpdate update in binaryUpdates.Values)
{
allBinaryUpdates.Add(update);
- binaryUpdatesSize += update.SizeInBytes();
+ binaryUpdatesSize += update.GetSizeInBytes();
}
}
binaryDVUpdates = allBinaryUpdates.ToArray();
- bytesUsed = (int)terms.SizeInBytes + queries.Length * BYTES_PER_DEL_QUERY + numericUpdatesSize + numericDVUpdates.Length * RamUsageEstimator.NUM_BYTES_OBJECT_REF + binaryUpdatesSize + binaryDVUpdates.Length * RamUsageEstimator.NUM_BYTES_OBJECT_REF;
+ bytesUsed = (int)terms.GetSizeInBytes() + queries.Length * BYTES_PER_DEL_QUERY + numericUpdatesSize + numericDVUpdates.Length * RamUsageEstimator.NUM_BYTES_OBJECT_REF + binaryUpdatesSize + binaryDVUpdates.Length * RamUsageEstimator.NUM_BYTES_OBJECT_REF;
numTermDeletes = deletes.numTermDeletes.Get();
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/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 89aa132..d7d5bd4 100644
--- a/src/Lucene.Net.Core/Index/IndexWriter.cs
+++ b/src/Lucene.Net.Core/Index/IndexWriter.cs
@@ -3076,7 +3076,7 @@ namespace Lucene.Net.Index
infoStream.Message("IW", "addIndexes: process segment origName=" + info.Info.Name + " newName=" + newSegName + " info=" + info);
}
- IOContext context = new IOContext(new MergeInfo(info.Info.DocCount, info.SizeInBytes(), true, -1));
+ IOContext context = new IOContext(new MergeInfo(info.Info.DocCount, info.GetSizeInBytes(), true, -1));
foreach (FieldInfo fi in SegmentReader.ReadFieldInfos(info))
{
@@ -4719,8 +4719,8 @@ namespace Lucene.Net.Index
int delCount = NumDeletedDocs(info);
Debug.Assert(delCount <= info.Info.DocCount);
double delRatio = ((double)delCount) / info.Info.DocCount;
- merge.EstimatedMergeBytes += (long)(info.SizeInBytes() * (1.0 - delRatio));
- merge.totalMergeBytes += info.SizeInBytes();
+ merge.EstimatedMergeBytes += (long)(info.GetSizeInBytes() * (1.0 - delRatio));
+ merge.totalMergeBytes += info.GetSizeInBytes();
}
}
@@ -5217,8 +5217,8 @@ namespace Lucene.Net.Index
// lost...
if (infoStream.IsEnabled("IW"))
- {
- infoStream.Message("IW", string.Format(CultureInfo.InvariantCulture, "merged segment size=%.3f MB vs estimate=%.3f MB", merge.info.SizeInBytes() / 1024.0 / 1024.0, merge.EstimatedMergeBytes / 1024 / 1024.0));
+ {// LUCENENET TODO: String formatting
+ infoStream.Message("IW", string.Format(CultureInfo.InvariantCulture, "merged segment size=%.3f MB vs estimate=%.3f MB", merge.info.GetSizeInBytes() / 1024.0 / 1024.0, merge.EstimatedMergeBytes / 1024 / 1024.0));
}
IndexReaderWarmer mergedSegmentWarmer = config.MergedSegmentWarmer;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Index/LogMergePolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/LogMergePolicy.cs b/src/Lucene.Net.Core/Index/LogMergePolicy.cs
index 5b50c63..21a3079 100644
--- a/src/Lucene.Net.Core/Index/LogMergePolicy.cs
+++ b/src/Lucene.Net.Core/Index/LogMergePolicy.cs
@@ -223,7 +223,7 @@ namespace Lucene.Net.Index
{
return base.Size(info);
}
- return info.SizeInBytes();
+ return info.GetSizeInBytes();
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Index/MergePolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/MergePolicy.cs b/src/Lucene.Net.Core/Index/MergePolicy.cs
index e6e5de1..8bf25cb 100644
--- a/src/Lucene.Net.Core/Index/MergePolicy.cs
+++ b/src/Lucene.Net.Core/Index/MergePolicy.cs
@@ -690,7 +690,7 @@ namespace Lucene.Net.Index
/// </summary>
protected virtual long Size(SegmentCommitInfo info)
{
- long byteSize = info.SizeInBytes();
+ long byteSize = info.GetSizeInBytes();
int delCount = m_writer.Get().NumDeletedDocs(info);
double delRatio = (info.Info.DocCount <= 0 ? 0.0f : ((float)delCount / (float)info.Info.DocCount));
Debug.Assert(delRatio <= 1.0);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Index/PrefixCodedTerms.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/PrefixCodedTerms.cs b/src/Lucene.Net.Core/Index/PrefixCodedTerms.cs
index 3cd1b6e..43c4c2d 100644
--- a/src/Lucene.Net.Core/Index/PrefixCodedTerms.cs
+++ b/src/Lucene.Net.Core/Index/PrefixCodedTerms.cs
@@ -44,12 +44,9 @@ namespace Lucene.Net.Index
}
/// <returns> size in bytes </returns>
- public virtual long SizeInBytes
+ public virtual long GetSizeInBytes()
{
- get
- {
- return buffer.SizeInBytes;
- }
+ return buffer.GetSizeInBytes();
}
/// <returns> iterator over the bytes </returns>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Index/SegmentCommitInfo.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SegmentCommitInfo.cs b/src/Lucene.Net.Core/Index/SegmentCommitInfo.cs
index a102cec..4da94a5 100644
--- a/src/Lucene.Net.Core/Index/SegmentCommitInfo.cs
+++ b/src/Lucene.Net.Core/Index/SegmentCommitInfo.cs
@@ -155,7 +155,7 @@ namespace Lucene.Net.Index
/// <p><b>NOTE:</b> this value is not correct for 3.0 segments
/// that have shared docstores. To get the correct value, upgrade!
/// </summary>
- public virtual long SizeInBytes()
+ public virtual long GetSizeInBytes()
{
if (sizeInBytes == -1)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Index/TieredMergePolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/TieredMergePolicy.cs b/src/Lucene.Net.Core/Index/TieredMergePolicy.cs
index cd788db..391b3a3 100644
--- a/src/Lucene.Net.Core/Index/TieredMergePolicy.cs
+++ b/src/Lucene.Net.Core/Index/TieredMergePolicy.cs
@@ -409,7 +409,7 @@ namespace Lucene.Net.Index
SegmentCommitInfo info = infosSorted[idx];
if (merging.Contains(info))
{
- mergingBytes += info.SizeInBytes();
+ mergingBytes += info.GetSizeInBytes();
}
else if (!toBeMerged.Contains(info))
{
@@ -524,7 +524,7 @@ namespace Lucene.Net.Index
long segBytes = Size(info);
totAfterMergeBytes += segBytes;
totAfterMergeBytesFloored += FloorSize(segBytes);
- totBeforeMergeBytes += info.SizeInBytes();
+ totBeforeMergeBytes += info.GetSizeInBytes();
}
// Roughly measure "skew" of the merge, i.e. how
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Search/CachingWrapperFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/CachingWrapperFilter.cs b/src/Lucene.Net.Core/Search/CachingWrapperFilter.cs
index fc2a9f2..5c733f0 100644
--- a/src/Lucene.Net.Core/Search/CachingWrapperFilter.cs
+++ b/src/Lucene.Net.Core/Search/CachingWrapperFilter.cs
@@ -178,7 +178,7 @@ namespace Lucene.Net.Search
/// <summary>
/// Returns total byte size used by cached filters. </summary>
- public virtual long SizeInBytes()
+ public virtual long GetSizeInBytes()
{
IList<DocIdSet> docIdSets = new List<DocIdSet>(_cache.Values);
return docIdSets.Sum(dis => RamUsageEstimator.SizeOf(dis));
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Store/NRTCachingDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/NRTCachingDirectory.cs b/src/Lucene.Net.Core/Store/NRTCachingDirectory.cs
index cbd57ca..3d42334 100644
--- a/src/Lucene.Net.Core/Store/NRTCachingDirectory.cs
+++ b/src/Lucene.Net.Core/Store/NRTCachingDirectory.cs
@@ -166,9 +166,9 @@ namespace Lucene.Net.Store
/// Returns how many bytes are being used by the
/// <see cref="RAMDirectory"/> cache
/// </summary>
- public virtual long SizeInBytes()
+ public virtual long GetSizeInBytes()
{
- return cache.SizeInBytes();
+ return cache.GetSizeInBytes();
}
[Obsolete("this method will be removed in 5.0")]
@@ -364,7 +364,7 @@ namespace Lucene.Net.Store
bytes = context.FlushInfo.EstimatedSegmentSize;
}
- return !name.Equals(IndexFileNames.SEGMENTS_GEN, StringComparison.Ordinal) && (bytes <= maxMergeSizeBytes) && (bytes + cache.SizeInBytes()) <= maxCachedBytes;
+ return !name.Equals(IndexFileNames.SEGMENTS_GEN, StringComparison.Ordinal) && (bytes <= maxMergeSizeBytes) && (bytes + cache.GetSizeInBytes()) <= maxCachedBytes;
}
private readonly object uncacheLock = new object();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Store/RAMDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/RAMDirectory.cs b/src/Lucene.Net.Core/Store/RAMDirectory.cs
index 2fbb86c..331fe8b 100644
--- a/src/Lucene.Net.Core/Store/RAMDirectory.cs
+++ b/src/Lucene.Net.Core/Store/RAMDirectory.cs
@@ -152,7 +152,7 @@ namespace Lucene.Net.Store
/// Return total size in bytes of all files in this directory. This is
/// currently quantized to <see cref="RAMOutputStream.BUFFER_SIZE"/>.
/// </summary>
- public long SizeInBytes()
+ public long GetSizeInBytes()
{
EnsureOpen();
return m_sizeInBytes.Get();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Store/RAMFile.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/RAMFile.cs b/src/Lucene.Net.Core/Store/RAMFile.cs
index 68abcaa..1da3b5e 100644
--- a/src/Lucene.Net.Core/Store/RAMFile.cs
+++ b/src/Lucene.Net.Core/Store/RAMFile.cs
@@ -109,14 +109,11 @@ namespace Lucene.Net.Store
return new byte[size];
}
- public virtual long SizeInBytes // LUCENENET TODO: API Change to GetSizeInBytes() and check consistency across API
+ public virtual long GetSizeInBytes()
{
- get
+ lock (this)
{
- lock (this)
- {
- return m_sizeInBytes;
- }
+ return m_sizeInBytes;
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Store/RAMOutputStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/RAMOutputStream.cs b/src/Lucene.Net.Core/Store/RAMOutputStream.cs
index 4697b81..1590b51 100644
--- a/src/Lucene.Net.Core/Store/RAMOutputStream.cs
+++ b/src/Lucene.Net.Core/Store/RAMOutputStream.cs
@@ -216,7 +216,7 @@ namespace Lucene.Net.Store
/// <summary>
/// Returns byte usage of all buffers. </summary>
- public virtual long SizeInBytes() // LUCENENET TODO: API Change to GetSizeInBytes()
+ public virtual long GetSizeInBytes()
{
return (long)file.NumBuffers * (long)BUFFER_SIZE;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Util/Fst/Builder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/Builder.cs b/src/Lucene.Net.Core/Util/Fst/Builder.cs
index d87b3b3..418f724 100644
--- a/src/Lucene.Net.Core/Util/Fst/Builder.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Builder.cs
@@ -584,9 +584,9 @@ namespace Lucene.Net.Util.Fst
// LUCENENET specific: moved INode to Builder type
- public virtual long FstSizeInBytes()
+ public virtual long GetFstSizeInBytes()
{
- return fst.SizeInBytes();
+ return fst.GetSizeInBytes();
}
// LUCENENET specific: Moved CompiledNode and UncompiledNode to Builder class
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Core/Util/Fst/FST.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/FST.cs b/src/Lucene.Net.Core/Util/Fst/FST.cs
index aabeab8..3319bc3 100644
--- a/src/Lucene.Net.Core/Util/Fst/FST.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FST.cs
@@ -340,7 +340,7 @@ namespace Lucene.Net.Util.Fst
/// <summary>
/// Returns bytes used to represent the FST </summary>
- public long SizeInBytes()
+ public long GetSizeInBytes()
{
long size = bytes.Position;
if (packed)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Misc/Index/IndexSplitter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Misc/Index/IndexSplitter.cs b/src/Lucene.Net.Misc/Index/IndexSplitter.cs
index 92b3ba2..a8847fc 100644
--- a/src/Lucene.Net.Misc/Index/IndexSplitter.cs
+++ b/src/Lucene.Net.Misc/Index/IndexSplitter.cs
@@ -102,7 +102,7 @@ namespace Lucene.Net.Index
for (int x = 0; x < Infos.Count; x++)
{
SegmentCommitInfo info = Infos.Info(x);
- string sizeStr = string.Format(CultureInfo.InvariantCulture, "{0:###,###.###}", info.SizeInBytes());
+ string sizeStr = string.Format(CultureInfo.InvariantCulture, "{0:###,###.###}", info.GetSizeInBytes());
Console.WriteLine(info.Info.Name + " " + sizeStr);
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs
index a3c4457..74d1106 100644
--- a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs
@@ -237,7 +237,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing
/// Returns byte size of the underlying FST. </summary>
public override long GetSizeInBytes()
{
- return fst == null ? 0 : fst.SizeInBytes();
+ return fst == null ? 0 : fst.GetSizeInBytes();
}
private void CopyDestTransitions(State from, State to, IList<Transition> transitions)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs
index ead705a..a28007f 100644
--- a/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs
@@ -197,7 +197,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing
{
return 0;
}
- return fst.SizeInBytes();
+ return fst.GetSizeInBytes();
}
private class AnalyzingComparer : IComparer<BytesRef>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs
index 5dcce06..49eb6cb 100644
--- a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs
@@ -316,12 +316,12 @@ namespace Lucene.Net.Search.Suggest.Fst
long mem = RamUsageEstimator.ShallowSizeOf(this) + RamUsageEstimator.ShallowSizeOf(normalCompletion) + RamUsageEstimator.ShallowSizeOf(higherWeightsCompletion);
if (normalCompletion != null)
{
- mem += normalCompletion.FST.SizeInBytes();
+ mem += normalCompletion.FST.GetSizeInBytes();
}
if (higherWeightsCompletion != null && (normalCompletion == null || normalCompletion.FST != higherWeightsCompletion.FST))
{
// the fst should be shared between the 2 completion instances, don't count it twice
- mem += higherWeightsCompletion.FST.SizeInBytes();
+ mem += higherWeightsCompletion.FST.GetSizeInBytes();
}
return mem;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs b/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs
index a719954..5ef4114 100644
--- a/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Fst/WFSTCompletionLookup.cs
@@ -334,7 +334,7 @@ namespace Lucene.Net.Search.Suggest.Fst
/// Returns byte size of the underlying FST. </summary>
public override long GetSizeInBytes()
{
- return (fst == null) ? 0 : fst.SizeInBytes();
+ return (fst == null) ? 0 : fst.GetSizeInBytes();
}
public override long Count
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.TestFramework/Index/AlcoholicMergePolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/AlcoholicMergePolicy.cs b/src/Lucene.Net.TestFramework/Index/AlcoholicMergePolicy.cs
index 6c0e00b..07089f4 100644
--- a/src/Lucene.Net.TestFramework/Index/AlcoholicMergePolicy.cs
+++ b/src/Lucene.Net.TestFramework/Index/AlcoholicMergePolicy.cs
@@ -58,10 +58,10 @@ namespace Lucene.Net.Index
Drink.Drink_e[] values = Enum.GetValues(typeof(Drink.Drink_e)).Cast<Drink.Drink_e>().ToArray();
// pick a random drink during the day
Drink.Drink_e drink = values[Random.Next(values.Length - 1)];
- return (long)drink * info.SizeInBytes();
+ return (long)drink * info.GetSizeInBytes();
}
- return info.SizeInBytes();
+ return info.GetSizeInBytes();
}
private class Drink
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
index 3ea4443..43e6005 100644
--- a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
+++ b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
@@ -257,13 +257,13 @@ namespace Lucene.Net.Store
}
}
- public long SizeInBytes()
+ public long GetSizeInBytes()
{
lock (this)
{
if (m_input is RAMDirectory)
{
- return ((RAMDirectory)m_input).SizeInBytes();
+ return ((RAMDirectory)m_input).GetSizeInBytes();
}
else
{
@@ -700,7 +700,7 @@ namespace Lucene.Net.Store
{
if (existing != null)
{
- ramdir.m_sizeInBytes.AddAndGet(-existing.SizeInBytes);
+ ramdir.m_sizeInBytes.AddAndGet(-existing.GetSizeInBytes());
existing.directory = null;
}
ramdir.m_fileMap.Put(name, file);
@@ -835,12 +835,12 @@ namespace Lucene.Net.Store
{
if (!(m_input is RAMDirectory))
{
- return SizeInBytes();
+ return GetSizeInBytes();
}
long size = 0;
foreach (RAMFile file in ((RAMDirectory)m_input).m_fileMap.Values)
{
- size += file.SizeInBytes;
+ size += file.GetSizeInBytes();
}
return size;
}
@@ -862,7 +862,7 @@ namespace Lucene.Net.Store
{
if (!(m_input is RAMDirectory))
{
- return SizeInBytes();
+ return GetSizeInBytes();
}
long size = 0;
foreach (RAMFile file in ((RAMDirectory)m_input).m_fileMap.Values)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs
index ad61d71..1c935f3 100644
--- a/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs
+++ b/src/Lucene.Net.TestFramework/Store/MockIndexOutputWrapper.cs
@@ -56,7 +56,7 @@ namespace Lucene.Net.Store
private void CheckDiskFull(byte[] b, int offset, DataInput @in, long len)
{
- long freeSpace = Dir.MaxSize == 0 ? 0 : Dir.MaxSize - Dir.SizeInBytes();
+ long freeSpace = Dir.MaxSize == 0 ? 0 : Dir.MaxSize - Dir.GetSizeInBytes();
long realUsage = 0;
// Enforce disk full:
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
index 7c834d2..479f787 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
@@ -584,7 +584,7 @@ namespace Lucene.Net.Index
}
writer.Dispose();
- long diskUsage = startDir.SizeInBytes();
+ long diskUsage = startDir.GetSizeInBytes();
long diskFree = diskUsage + 10;
IOException err = null;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs
index 3ff722e..c8c0d24 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterOnDiskFull.cs
@@ -248,7 +248,7 @@ namespace Lucene.Net.Index
// added.
// String[] files = startDir.ListAll();
- long diskUsage = startDir.SizeInBytes();
+ long diskUsage = startDir.GetSizeInBytes();
long startDiskUsage = 0;
string[] files_ = startDir.ListAll();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs b/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs
index 724c37c..9379a32 100644
--- a/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs
+++ b/src/Lucene.Net.Tests/Index/TestRollingUpdates.cs
@@ -176,7 +176,7 @@ namespace Lucene.Net.Index
long totalBytes = 0;
foreach (SegmentCommitInfo sipc in infos.Segments)
{
- totalBytes += sipc.SizeInBytes();
+ totalBytes += sipc.GetSizeInBytes();
}
long totalBytes2 = 0;
foreach (string fileName in dir.ListAll())
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Tests/Index/TestSizeBoundedForceMerge.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestSizeBoundedForceMerge.cs b/src/Lucene.Net.Tests/Index/TestSizeBoundedForceMerge.cs
index dd066d5..8d5f463 100644
--- a/src/Lucene.Net.Tests/Index/TestSizeBoundedForceMerge.cs
+++ b/src/Lucene.Net.Tests/Index/TestSizeBoundedForceMerge.cs
@@ -80,7 +80,7 @@ namespace Lucene.Net.Index
SegmentInfos sis = new SegmentInfos();
sis.Read(dir);
- double min = sis.Info(0).SizeInBytes();
+ double min = sis.Info(0).GetSizeInBytes();
conf = NewWriterConfig();
LogByteSizeMergePolicy lmp = new LogByteSizeMergePolicy();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Tests/Search/TestCachingWrapperFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestCachingWrapperFilter.cs b/src/Lucene.Net.Tests/Search/TestCachingWrapperFilter.cs
index d0bc1a7..f92dd19 100644
--- a/src/Lucene.Net.Tests/Search/TestCachingWrapperFilter.cs
+++ b/src/Lucene.Net.Tests/Search/TestCachingWrapperFilter.cs
@@ -389,7 +389,7 @@ namespace Lucene.Net.Search
CachingWrapperFilter filter = new CachingWrapperFilter(startFilter);
docs = searcher.Search(new MatchAllDocsQuery(), filter, 1);
- Assert.IsTrue(filter.SizeInBytes() > 0);
+ Assert.IsTrue(filter.GetSizeInBytes() > 0);
Assert.AreEqual(1, docs.TotalHits, "[query + filter] Should find a hit...");
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Tests/Store/TestRAMDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Store/TestRAMDirectory.cs b/src/Lucene.Net.Tests/Store/TestRAMDirectory.cs
index 3126ac8..e91d525 100644
--- a/src/Lucene.Net.Tests/Store/TestRAMDirectory.cs
+++ b/src/Lucene.Net.Tests/Store/TestRAMDirectory.cs
@@ -84,7 +84,7 @@ namespace Lucene.Net.Store
dir.Dispose();
// Check size
- Assert.AreEqual(ramDir.SizeInBytes(), ramDir.RecomputedSizeInBytes);
+ Assert.AreEqual(ramDir.GetSizeInBytes(), ramDir.RecomputedSizeInBytes);
// open reader to test document count
IndexReader reader = DirectoryReader.Open(ramDir);
@@ -117,7 +117,7 @@ namespace Lucene.Net.Store
IndexWriter writer = new IndexWriter(ramDir, (new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))).SetOpenMode(OpenMode.APPEND));
writer.ForceMerge(1);
- Assert.AreEqual(ramDir.SizeInBytes(), ramDir.RecomputedSizeInBytes);
+ Assert.AreEqual(ramDir.GetSizeInBytes(), ramDir.RecomputedSizeInBytes);
ThreadClass[] threads = new ThreadClass[NumThreads];
for (int i = 0; i < NumThreads; i++)
@@ -135,7 +135,7 @@ namespace Lucene.Net.Store
}
writer.ForceMerge(1);
- Assert.AreEqual(ramDir.SizeInBytes(), ramDir.RecomputedSizeInBytes);
+ Assert.AreEqual(ramDir.GetSizeInBytes(), ramDir.RecomputedSizeInBytes);
writer.Dispose();
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Tests/Util/Fst/Test2BFST.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Util/Fst/Test2BFST.cs b/src/Lucene.Net.Tests/Util/Fst/Test2BFST.cs
index efce2e5..212112a 100644
--- a/src/Lucene.Net.Tests/Util/Fst/Test2BFST.cs
+++ b/src/Lucene.Net.Tests/Util/Fst/Test2BFST.cs
@@ -71,7 +71,7 @@ namespace Lucene.Net.Util.Fst
count++;
if (count % 100000 == 0)
{
- Console.WriteLine(count + ": " + b.FstSizeInBytes() + " bytes; " + b.TotStateCount + " nodes");
+ Console.WriteLine(count + ": " + b.GetFstSizeInBytes() + " bytes; " + b.TotStateCount + " nodes");
}
if (b.TotStateCount > int.MaxValue + 100L * 1024 * 1024)
{
@@ -84,7 +84,7 @@ namespace Lucene.Net.Util.Fst
for (int verify = 0; verify < 2; verify++)
{
- Console.WriteLine("\nTEST: now verify [fst size=" + fst.SizeInBytes() + "; nodeCount=" + fst.NodeCount + "; arcCount=" + fst.ArcCount + "]");
+ Console.WriteLine("\nTEST: now verify [fst size=" + fst.GetSizeInBytes() + "; nodeCount=" + fst.NodeCount + "; arcCount=" + fst.ArcCount + "]");
Arrays.Fill(ints2, 0);
r = new Random(seed);
@@ -164,9 +164,9 @@ namespace Lucene.Net.Util.Fst
count++;
if (count % 1000000 == 0)
{
- Console.WriteLine(count + "...: " + b.FstSizeInBytes() + " bytes");
+ Console.WriteLine(count + "...: " + b.GetFstSizeInBytes() + " bytes");
}
- if (b.FstSizeInBytes() > LIMIT)
+ if (b.GetFstSizeInBytes() > LIMIT)
{
break;
}
@@ -176,7 +176,7 @@ namespace Lucene.Net.Util.Fst
FST<BytesRef> fst = b.Finish();
for (int verify = 0; verify < 2; verify++)
{
- Console.WriteLine("\nTEST: now verify [fst size=" + fst.SizeInBytes() + "; nodeCount=" + fst.NodeCount + "; arcCount=" + fst.ArcCount + "]");
+ Console.WriteLine("\nTEST: now verify [fst size=" + fst.GetSizeInBytes() + "; nodeCount=" + fst.NodeCount + "; arcCount=" + fst.ArcCount + "]");
r = new Random(seed);
Arrays.Fill(ints, 0);
@@ -250,9 +250,9 @@ namespace Lucene.Net.Util.Fst
count++;
if (count % 1000000 == 0)
{
- Console.WriteLine(count + "...: " + b.FstSizeInBytes() + " bytes");
+ Console.WriteLine(count + "...: " + b.GetFstSizeInBytes() + " bytes");
}
- if (b.FstSizeInBytes() > LIMIT)
+ if (b.GetFstSizeInBytes() > LIMIT)
{
break;
}
@@ -263,7 +263,7 @@ namespace Lucene.Net.Util.Fst
for (int verify = 0; verify < 2; verify++)
{
- Console.WriteLine("\nTEST: now verify [fst size=" + fst.SizeInBytes() + "; nodeCount=" + fst.NodeCount + "; arcCount=" + fst.ArcCount + "]");
+ Console.WriteLine("\nTEST: now verify [fst size=" + fst.GetSizeInBytes() + "; nodeCount=" + fst.NodeCount + "; arcCount=" + fst.ArcCount + "]");
Arrays.Fill(ints, 0);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b6dcfe8a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
index 94f8afd..a9b0556 100644
--- a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
+++ b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
@@ -431,7 +431,7 @@ namespace Lucene.Net.Util.Fst
FST<long?> fst = builder.Finish();
if (VERBOSE)
{
- Console.WriteLine("FST: " + docCount + " docs; " + ord + " terms; " + fst.NodeCount + " nodes; " + fst.ArcCount + " arcs;" + " " + fst.SizeInBytes() + " bytes");
+ Console.WriteLine("FST: " + docCount + " docs; " + ord + " terms; " + fst.NodeCount + " nodes; " + fst.ArcCount + " arcs;" + " " + fst.GetSizeInBytes() + " bytes");
}
if (ord > 0)
@@ -596,7 +596,7 @@ namespace Lucene.Net.Util.Fst
return;
}
- Console.WriteLine(ord + " terms; " + fst.NodeCount + " nodes; " + fst.ArcCount + " arcs; " + fst.ArcWithOutputCount + " arcs w/ output; tot size " + fst.SizeInBytes());
+ Console.WriteLine(ord + " terms; " + fst.NodeCount + " nodes; " + fst.ArcCount + " arcs; " + fst.ArcWithOutputCount + " arcs w/ output; tot size " + fst.GetSizeInBytes());
if (fst.NodeCount < 100)
{
TextWriter w = new StreamWriter(new FileStream("out.dot", FileMode.Create), Encoding.UTF8);
[37/50] lucenenet git commit:
Lucene.Net.Analysis.Common.Analysis.Util.CharArrayMap: Added using block to
enumerator in GetHashCode()
Posted by ni...@apache.org.
Lucene.Net.Analysis.Common.Analysis.Util.CharArrayMap: Added using block to enumerator in GetHashCode()
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/71318f0f
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/71318f0f
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/71318f0f
Branch: refs/heads/api-work
Commit: 71318f0f5dca367b372bb4272ef43058e4902aea
Parents: 7fd381b
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 16:25:50 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 16:25:50 2017 +0700
----------------------------------------------------------------------
.../Analysis/Util/CharArrayMap.cs | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/71318f0f/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs
index 4a2e700..e006ea5 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs
@@ -781,12 +781,14 @@ namespace Lucene.Net.Analysis.Util
public override int GetHashCode()
{
const int PRIME = 31; // arbitrary prime
- int hash = PRIME;
- var iter = (EntryIterator)EntrySet().GetEnumerator();
- while (iter.MoveNext())
+ int hash = PRIME;
+ using (var iter = (EntryIterator)EntrySet().GetEnumerator())
{
- hash = (hash * PRIME) ^ iter.Current.Key.GetHashCode();
- hash = (hash * PRIME) ^ iter.Current.Value.GetHashCode();
+ while (iter.MoveNext())
+ {
+ hash = (hash * PRIME) ^ iter.Current.Key.GetHashCode();
+ hash = (hash * PRIME) ^ iter.Current.Value.GetHashCode();
+ }
}
return hash;
}
[44/50] lucenenet git commit: Lucene.Net.Core.Search.FuzzyTermsEnum
refactor: Automata() > Automata (property)
Posted by ni...@apache.org.
Lucene.Net.Core.Search.FuzzyTermsEnum refactor: Automata() > Automata (property)
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/a966d9af
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/a966d9af
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/a966d9af
Branch: refs/heads/api-work
Commit: a966d9af739b3872a70b6f49f8fcd7c234f175fb
Parents: 291e3ae
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 19:30:23 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 19:30:23 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Search/FuzzyTermsEnum.cs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a966d9af/src/Lucene.Net.Core/Search/FuzzyTermsEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FuzzyTermsEnum.cs b/src/Lucene.Net.Core/Search/FuzzyTermsEnum.cs
index 7159894..530f454 100644
--- a/src/Lucene.Net.Core/Search/FuzzyTermsEnum.cs
+++ b/src/Lucene.Net.Core/Search/FuzzyTermsEnum.cs
@@ -186,7 +186,7 @@ namespace Lucene.Net.Search
/// initialize levenshtein DFAs up to maxDistance, if possible </summary>
private IList<CompiledAutomaton> InitAutomata(int maxDistance)
{
- IList<CompiledAutomaton> runAutomata = dfaAtt.Automata();
+ IList<CompiledAutomaton> runAutomata = dfaAtt.Automata;
//System.out.println("cached automata size: " + runAutomata.size());
if (runAutomata.Count <= maxDistance && maxDistance <= LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE)
{
@@ -475,7 +475,7 @@ namespace Lucene.Net.Search
/// </summary>
public interface ILevenshteinAutomataAttribute : IAttribute
{
- IList<CompiledAutomaton> Automata();
+ IList<CompiledAutomaton> Automata { get; }
}
/// <summary>
@@ -487,9 +487,9 @@ namespace Lucene.Net.Search
// LUCENENET NOTE: Must use EquatableList for Equals and GetHashCode()
private readonly IList<CompiledAutomaton> automata = new EquatableList<CompiledAutomaton>();
- public IList<CompiledAutomaton> Automata() // LUCENENT TODO: API make property
+ public IList<CompiledAutomaton> Automata
{
- return automata;
+ get { return automata; }
}
public override void Clear()
@@ -517,7 +517,7 @@ namespace Lucene.Net.Search
public override void CopyTo(IAttribute target)
{
- IList<CompiledAutomaton> targetAutomata = ((LevenshteinAutomataAttribute)target).Automata();
+ IList<CompiledAutomaton> targetAutomata = ((LevenshteinAutomataAttribute)target).Automata;
targetAutomata.Clear();
targetAutomata.AddRange(automata);
}
[02/50] lucenenet git commit:
Lucene.Net.Spatial.Prefix.IntersectsPrefixTreeFilter: Removed dependency on
HashHelpers.CombineHashCodes()
Posted by ni...@apache.org.
Lucene.Net.Spatial.Prefix.IntersectsPrefixTreeFilter: Removed dependency on HashHelpers.CombineHashCodes()
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/174e2217
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/174e2217
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/174e2217
Branch: refs/heads/api-work
Commit: 174e22178743c6d952ab7e14903815d20ae7cd97
Parents: 44bba1b
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Mar 29 19:28:44 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:27 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Spatial/Prefix/IntersectsPrefixTreeFilter.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/174e2217/src/Lucene.Net.Spatial/Prefix/IntersectsPrefixTreeFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/IntersectsPrefixTreeFilter.cs b/src/Lucene.Net.Spatial/Prefix/IntersectsPrefixTreeFilter.cs
index fe449a7..0287eaa 100644
--- a/src/Lucene.Net.Spatial/Prefix/IntersectsPrefixTreeFilter.cs
+++ b/src/Lucene.Net.Spatial/Prefix/IntersectsPrefixTreeFilter.cs
@@ -54,7 +54,9 @@ namespace Lucene.Net.Spatial.Prefix
/// </summary>
public override int GetHashCode()
{
- return HashHelpers.CombineHashCodes(base.GetHashCode(), hasIndexedLeaves.GetHashCode());
+ int h = base.GetHashCode();
+ h ^= hasIndexedLeaves.GetHashCode(); // reversible
+ return h;
}
/// <exception cref="System.IO.IOException"></exception>
[29/50] lucenenet git commit: Lucene.Net.Core.Support (EquatableList
+ EquatableSet): Moved the operator overrides into their own section and
removed other commented code
Posted by ni...@apache.org.
Lucene.Net.Core.Support (EquatableList + EquatableSet): Moved the operator overrides into their own section and removed other commented code
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/62160cde
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/62160cde
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/62160cde
Branch: refs/heads/api-work
Commit: 62160cdea68fc012d55789ad8ab727190d058ec4
Parents: a3ef60a
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 09:21:40 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:21:40 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Support/EquatableList.cs | 378 ++++------------------
src/Lucene.Net.Core/Support/EquatableSet.cs | 61 ++++
2 files changed, 122 insertions(+), 317 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62160cde/src/Lucene.Net.Core/Support/EquatableList.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/EquatableList.cs b/src/Lucene.Net.Core/Support/EquatableList.cs
index 182e997..82d747b 100644
--- a/src/Lucene.Net.Core/Support/EquatableList.cs
+++ b/src/Lucene.Net.Core/Support/EquatableList.cs
@@ -226,6 +226,67 @@ namespace Lucene.Net.Support
#endregion
+ #region Operator overrides
+
+ // TODO: When diverging from Java version of Lucene, can uncomment these to adhere to best practices when overriding the Equals method and implementing IEquatable<T>.
+ ///// <summary>Overload of the == operator, it compares a
+ ///// <see cref="EquatableList{T}"/> to an <see cref="IEnumerable{T}"/>
+ ///// implementation.</summary>
+ ///// <param name="x">The <see cref="EquatableList{T}"/> to compare
+ ///// against <paramref name="y"/>.</param>
+ ///// <param name="y">The <see cref="IEnumerable{T}"/> to compare
+ ///// against <paramref name="x"/>.</param>
+ ///// <returns>True if the instances are equal, false otherwise.</returns>
+ //public static bool operator ==(EquatableList<T> x, System.Collections.Generic.IEnumerable<T> y)
+ //{
+ // // Call Equals.
+ // return Equals(x, y);
+ //}
+
+ ///// <summary>Overload of the == operator, it compares a
+ ///// <see cref="EquatableList{T}"/> to an <see cref="IEnumerable{T}"/>
+ ///// implementation.</summary>
+ ///// <param name="y">The <see cref="EquatableList{T}"/> to compare
+ ///// against <paramref name="x"/>.</param>
+ ///// <param name="x">The <see cref="IEnumerable{T}"/> to compare
+ ///// against <paramref name="y"/>.</param>
+ ///// <returns>True if the instances are equal, false otherwise.</returns>
+ //public static bool operator ==(System.Collections.Generic.IEnumerable<T> x, EquatableList<T> y)
+ //{
+ // // Call equals.
+ // return Equals(x, y);
+ //}
+
+ ///// <summary>Overload of the != operator, it compares a
+ ///// <see cref="EquatableList{T}"/> to an <see cref="IEnumerable{T}"/>
+ ///// implementation.</summary>
+ ///// <param name="x">The <see cref="EquatableList{T}"/> to compare
+ ///// against <paramref name="y"/>.</param>
+ ///// <param name="y">The <see cref="IEnumerable{T}"/> to compare
+ ///// against <paramref name="x"/>.</param>
+ ///// <returns>True if the instances are not equal, false otherwise.</returns>
+ //public static bool operator !=(EquatableList<T> x, System.Collections.Generic.IEnumerable<T> y)
+ //{
+ // // Return the negative of the equals operation.
+ // return !(x == y);
+ //}
+
+ ///// <summary>Overload of the != operator, it compares a
+ ///// <see cref="EquatableList{T}"/> to an <see cref="IEnumerable{T}"/>
+ ///// implementation.</summary>
+ ///// <param name="y">The <see cref="EquatableList{T}"/> to compare
+ ///// against <paramref name="x"/>.</param>
+ ///// <param name="x">The <see cref="IEnumerable{T}"/> to compare
+ ///// against <paramref name="y"/>.</param>
+ ///// <returns>True if the instances are not equal, false otherwise.</returns>
+ //public static bool operator !=(System.Collections.Generic.IEnumerable<T> x, EquatableList<T> y)
+ //{
+ // // Return the negative of the equals operation.
+ // return !(x == y);
+ //}
+
+ #endregion
+
#region IEquatable<T> members
/// <summary>
@@ -317,321 +378,4 @@ namespace Lucene.Net.Support
#endregion
}
-
- // public class EquatableList<T> : System.Collections.Generic.List<T>,
- // IEquatable<IEnumerable<T>>
- // {
- // /// <summary>Initializes a new instance of the
- // /// <see cref="EquatableList{T}"/> class that is empty and has the
- // /// default initial capacity.</summary>
- // public EquatableList()
- // : base()
- // {
- // }
-
- // /// <summary>Initializes a new instance of the <see cref="EquatableList{T}"/>
- // /// class that contains elements copied from the specified collection and has
- // /// sufficient capacity to accommodate the number of elements copied.</summary>
- // /// <param name="collection">The collection whose elements are copied to the new list.</param>
- // public EquatableList(System.Collections.Generic.IEnumerable<T> collection)
- // : base(collection)
- // {
- // }
-
- // /// <summary>Initializes a new instance of the <see cref="EquatableList{T}"/>
- // /// class that is empty and has the specified initial capacity.</summary>
- // /// <param name="capacity">The number of elements that the new list can initially store.</param>
- // public EquatableList(int capacity)
- // : base(capacity)
- // {
- // }
-
- // /// <summary>Adds a range of objects represented by the <see cref="ICollection"/>
- // /// implementation.</summary>
- // /// <param name="c">The <see cref="ICollection"/>
- // /// implementation to add to this list.</param>
- // public void AddRange(ICollection c)
- // {
- // // If the collection is null, throw an exception.
- // if (c == null) throw new ArgumentNullException("c");
-
- // // Pre-compute capacity.
- // Capacity = Math.Max(c.Count + Count, Capacity);
-
- // // Cycle through the items and add.
- // foreach (T item in c)
- // {
- // // Add the item.
- // Add(item);
- // }
- // }
-
- // /// <summary>Compares the counts of two <see cref="System.Collections.Generic.IEnumerable{T}"/>
- // /// implementations.</summary>
- // /// <remarks>This uses a trick in LINQ, sniffing types for implementations
- // /// of interfaces that might supply shortcuts when trying to make comparisons.
- // /// In this case, that is the <see cref="System.Collections.Generic.ICollection{T}"/> and
- // /// <see cref="ICollection"/> interfaces, either of which can provide a count
- // /// which can be used in determining the equality of sequences (if they don't have
- // /// the same count, then they can't be equal).</remarks>
- // /// <param name="x">The <see cref="System.Collections.Generic.IEnumerable{T}"/> from the left hand side of the
- // /// comparison to check the count of.</param>
- // /// <param name="y">The <see cref="System.Collections.Generic.IEnumerable{T}"/> from the right hand side of the
- // /// comparison to check the count of.</param>
- // /// <returns>Null if the result is indeterminate. This occurs when either <paramref name="x"/>
- // /// or <paramref name="y"/> doesn't implement <see cref="ICollection"/> or <see cref="System.Collections.Generic.ICollection{T}"/>.
- // /// Otherwise, it will get the count from each and return true if they are equal, false otherwise.</returns>
- // private static bool? EnumerableCountsEqual(System.Collections.Generic.IEnumerable<T> x, System.Collections.Generic.IEnumerable<T> y)
- // {
- // // Get the ICollection<T> and ICollection interfaces.
- // System.Collections.Generic.ICollection<T> xOfTCollection = x as System.Collections.Generic.ICollection<T>;
- // System.Collections.Generic.ICollection<T> yOfTCollection = y as System.Collections.Generic.ICollection<T>;
- // ICollection xCollection = x as ICollection;
- // ICollection yCollection = y as ICollection;
-
- // // The count in x and y.
- // int? xCount = xOfTCollection != null ? xOfTCollection.Count : xCollection != null ? xCollection.Count : (int?)null;
- // int? yCount = yOfTCollection != null ? yOfTCollection.Count : yCollection != null ? yCollection.Count : (int?)null;
-
- // // If either are null, return null, the result is indeterminate.
- // if (xCount == null || yCount == null)
- // {
- // // Return null, indeterminate.
- // return null;
- // }
-
- // // Both counts are non-null, compare.
- // return xCount == yCount;
- // }
-
- // /// <summary>Compares the contents of a <see cref="System.Collections.Generic.IEnumerable{T}"/>
- // /// implementation to another one to determine equality.</summary>
- // /// <remarks>Thinking of the <see cref="System.Collections.Generic.IEnumerable{T}"/> implementation as
- // /// a string with any number of characters, the algorithm checks
- // /// each item in each list. If any item of the list is not equal (or
- // /// one list contains all the elements of another list), then that list
- // /// element is compared to the other list element to see which
- // /// list is greater.</remarks>
- // /// <param name="x">The <see cref="System.Collections.Generic.IEnumerable{T}"/> implementation
- // /// that is considered the left hand side.</param>
- // /// <param name="y">The <see cref="System.Collections.Generic.IEnumerable{T}"/> implementation
- // /// that is considered the right hand side.</param>
- // /// <returns>True if the items are equal, false otherwise.</returns>
- // private static bool Equals(System.Collections.Generic.IEnumerable<T> x,
- // System.Collections.Generic.IEnumerable<T> y)
- // {
- // // If x and y are null, then return true, they are the same.
- // if (x == null && y == null)
- // {
- // // They are the same, return 0.
- // return true;
- // }
-
- // // If one is null, then return a value based on whether or not
- // // one is null or not.
- // if (x == null || y == null)
- // {
- // // Return false, one is null, the other is not.
- // return false;
- // }
-
- // // Check to see if the counts on the IEnumerable implementations are equal.
- // // This is a shortcut, if they are not equal, then the lists are not equal.
- // // If the result is indeterminate, then get out.
- // bool? enumerableCountsEqual = EnumerableCountsEqual(x, y);
-
- // // If the enumerable counts have been able to be calculated (indicated by
- // // a non-null value) and it is false, then no need to iterate through the items.
- // if (enumerableCountsEqual != null && !enumerableCountsEqual.Value)
- // {
- // // The sequences are not equal.
- // return false;
- // }
-
- // // The counts of the items in the enumerations are equal, or indeterminate
- // // so a full iteration needs to be made to compare each item.
- // // Get the default comparer for T first.
- // System.Collections.Generic.EqualityComparer<T> defaultComparer =
- // EqualityComparer<T>.Default;
-
- // // Get the enumerator for y.
- // System.Collections.Generic.IEnumerator<T> otherEnumerator = y.GetEnumerator();
-
- // // Call Dispose on IDisposable if there is an implementation on the
- // // IEnumerator<T> returned by a call to y.GetEnumerator().
- // using (otherEnumerator as IDisposable)
- // {
- // // Cycle through the items in this list.
- // foreach (T item in x)
- // {
- // // If there isn't an item to get, then this has more
- // // items than that, they are not equal.
- // if (!otherEnumerator.MoveNext())
- // {
- // // Return false.
- // return false;
- // }
-
- // // Perform a comparison. Must check this on the left hand side
- // // and that on the right hand side.
- // bool comparison = defaultComparer.Equals(item, otherEnumerator.Current);
-
- // // If the value is false, return false.
- // if (!comparison)
- // {
- // // Return the value.
- // return comparison;
- // }
- // }
-
- // // If there are no more items, then return true, the sequences
- // // are equal.
- // if (!otherEnumerator.MoveNext())
- // {
- // // The sequences are equal.
- // return true;
- // }
-
- // // The other sequence has more items than this one, return
- // // false, these are not equal.
- // return false;
- // }
- // }
-
- // #region IEquatable<IEnumerable<T>> Members
-
- // /// <summary>Compares this sequence to another <see cref="System.Collections.Generic.IEnumerable{T}"/>
- // /// implementation, returning true if they are equal, false otherwise.</summary>
- // /// <param name="other">The other <see cref="System.Collections.Generic.IEnumerable{T}"/> implementation
- // /// to compare against.</param>
- // /// <returns>True if the sequence in <paramref name="other"/>
- // /// is the same as this one.</returns>
- // public bool Equals(System.Collections.Generic.IEnumerable<T> other)
- // {
- // // Compare to the other sequence. If 0, then equal.
- // return Equals(this, other);
- // }
-
- // #endregion IEquatable<IEnumerable<T>> Members
-
- // /// <summary>Compares this object for equality against other.</summary>
- // /// <param name="obj">The other object to compare this object against.</param>
- // /// <returns>True if this object and <paramref name="obj"/> are equal, false
- // /// otherwise.</returns>
- // public override bool Equals(object obj)
- // {
- // // Call the strongly typed version.
- // return Equals(obj as System.Collections.Generic.IEnumerable<T>);
- // }
-
- // /// <summary>Gets the hash code for the list.</summary>
- // /// <returns>The hash code value.</returns>
- // public override int GetHashCode()
- // {
- // // Call the static method, passing this.
- // return GetHashCode(this);
- // }
-
- //#if __MonoCS__
- // public static int GetHashCode<T>(System.Collections.Generic.IEnumerable<T> source)
- //#else
-
- // /// <summary>Gets the hash code for the list.</summary>
- // /// <param name="source">The <see cref="System.Collections.Generic.IEnumerable{T}"/>
- // /// implementation which will have all the contents hashed.</param>
- // /// <returns>The hash code value.</returns>
- // public static int GetHashCode(System.Collections.Generic.IEnumerable<T> source)
- //#endif
- // {
- // // If source is null, then return 0.
- // if (source == null) return 0;
-
- // // Seed the hash code with the hash code of the type.
- // // This is done so that you don't have a lot of collisions of empty
- // // ComparableList instances when placed in dictionaries
- // // and things that rely on hashcodes.
- // int hashCode = typeof(T).GetHashCode();
-
- // // Iterate through the items in this implementation.
- // foreach (T item in source)
- // {
- // // Adjust the hash code.
- // hashCode = 31 * hashCode + (item == null ? 0 : item.GetHashCode());
- // }
-
- // // Return the hash code.
- // return hashCode;
- // }
-
- // // TODO: When diverging from Java version of Lucene, can uncomment these to adhere to best practices when overriding the Equals method and implementing IEquatable<T>.
- // ///// <summary>Overload of the == operator, it compares a
- // ///// <see cref="ComparableList{T}"/> to an <see cref="IEnumerable{T}"/>
- // ///// implementation.</summary>
- // ///// <param name="x">The <see cref="ComparableList{T}"/> to compare
- // ///// against <paramref name="y"/>.</param>
- // ///// <param name="y">The <see cref="IEnumerable{T}"/> to compare
- // ///// against <paramref name="x"/>.</param>
- // ///// <returns>True if the instances are equal, false otherwise.</returns>
- // //public static bool operator ==(EquatableList<T> x, System.Collections.Generic.IEnumerable<T> y)
- // //{
- // // // Call Equals.
- // // return Equals(x, y);
- // //}
-
- // ///// <summary>Overload of the == operator, it compares a
- // ///// <see cref="ComparableList{T}"/> to an <see cref="IEnumerable{T}"/>
- // ///// implementation.</summary>
- // ///// <param name="y">The <see cref="ComparableList{T}"/> to compare
- // ///// against <paramref name="x"/>.</param>
- // ///// <param name="x">The <see cref="IEnumerable{T}"/> to compare
- // ///// against <paramref name="y"/>.</param>
- // ///// <returns>True if the instances are equal, false otherwise.</returns>
- // //public static bool operator ==(System.Collections.Generic.IEnumerable<T> x, EquatableList<T> y)
- // //{
- // // // Call equals.
- // // return Equals(x, y);
- // //}
-
- // ///// <summary>Overload of the != operator, it compares a
- // ///// <see cref="ComparableList{T}"/> to an <see cref="IEnumerable{T}"/>
- // ///// implementation.</summary>
- // ///// <param name="x">The <see cref="ComparableList{T}"/> to compare
- // ///// against <paramref name="y"/>.</param>
- // ///// <param name="y">The <see cref="IEnumerable{T}"/> to compare
- // ///// against <paramref name="x"/>.</param>
- // ///// <returns>True if the instances are not equal, false otherwise.</returns>
- // //public static bool operator !=(EquatableList<T> x, System.Collections.Generic.IEnumerable<T> y)
- // //{
- // // // Return the negative of the equals operation.
- // // return !(x == y);
- // //}
-
- // ///// <summary>Overload of the != operator, it compares a
- // ///// <see cref="ComparableList{T}"/> to an <see cref="IEnumerable{T}"/>
- // ///// implementation.</summary>
- // ///// <param name="y">The <see cref="ComparableList{T}"/> to compare
- // ///// against <paramref name="x"/>.</param>
- // ///// <param name="x">The <see cref="IEnumerable{T}"/> to compare
- // ///// against <paramref name="y"/>.</param>
- // ///// <returns>True if the instances are not equal, false otherwise.</returns>
- // //public static bool operator !=(System.Collections.Generic.IEnumerable<T> x, EquatableList<T> y)
- // //{
- // // // Return the negative of the equals operation.
- // // return !(x == y);
- // //}
-
- // #region ICloneable Members
-
- // /// <summary>Clones the <see cref="EquatableList{T}"/>.</summary>
- // /// <remarks>This is a shallow clone.</remarks>
- // /// <returns>A new shallow clone of this
- // /// <see cref="EquatableList{T}"/>.</returns>
- // public object Clone()
- // {
- // // Just create a new one, passing this to the constructor.
- // return new EquatableList<T>(this);
- // }
-
- // #endregion ICloneable Members
- // }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62160cde/src/Lucene.Net.Core/Support/EquatableSet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/EquatableSet.cs b/src/Lucene.Net.Core/Support/EquatableSet.cs
index 90bf0f3..22ee7a0 100644
--- a/src/Lucene.Net.Core/Support/EquatableSet.cs
+++ b/src/Lucene.Net.Core/Support/EquatableSet.cs
@@ -305,6 +305,67 @@ namespace Lucene.Net.Support
#endregion
+ #region Operator overrides
+
+ // TODO: When diverging from Java version of Lucene, can uncomment these to adhere to best practices when overriding the Equals method and implementing IEquatable<T>.
+ ///// <summary>Overload of the == operator, it compares a
+ ///// <see cref="EquatableSet{T}"/> to an <see cref="IEnumerable{T}"/>
+ ///// implementation.</summary>
+ ///// <param name="x">The <see cref="EquatableSet{T}"/> to compare
+ ///// against <paramref name="y"/>.</param>
+ ///// <param name="y">The <see cref="IEnumerable{T}"/> to compare
+ ///// against <paramref name="x"/>.</param>
+ ///// <returns>True if the instances are equal, false otherwise.</returns>
+ //public static bool operator ==(EquatableSet<T> x, System.Collections.Generic.IEnumerable<T> y)
+ //{
+ // // Call Equals.
+ // return Equals(x, y);
+ //}
+
+ ///// <summary>Overload of the == operator, it compares a
+ ///// <see cref="EquatableSet{T}"/> to an <see cref="IEnumerable{T}"/>
+ ///// implementation.</summary>
+ ///// <param name="y">The <see cref="EquatableSet{T}"/> to compare
+ ///// against <paramref name="x"/>.</param>
+ ///// <param name="x">The <see cref="IEnumerable{T}"/> to compare
+ ///// against <paramref name="y"/>.</param>
+ ///// <returns>True if the instances are equal, false otherwise.</returns>
+ //public static bool operator ==(System.Collections.Generic.IEnumerable<T> x, EquatableSet<T> y)
+ //{
+ // // Call equals.
+ // return Equals(x, y);
+ //}
+
+ ///// <summary>Overload of the != operator, it compares a
+ ///// <see cref="EquatableSet{T}"/> to an <see cref="IEnumerable{T}"/>
+ ///// implementation.</summary>
+ ///// <param name="x">The <see cref="EquatableSet{T}"/> to compare
+ ///// against <paramref name="y"/>.</param>
+ ///// <param name="y">The <see cref="IEnumerable{T}"/> to compare
+ ///// against <paramref name="x"/>.</param>
+ ///// <returns>True if the instances are not equal, false otherwise.</returns>
+ //public static bool operator !=(EquatableSet<T> x, System.Collections.Generic.IEnumerable<T> y)
+ //{
+ // // Return the negative of the equals operation.
+ // return !(x == y);
+ //}
+
+ ///// <summary>Overload of the != operator, it compares a
+ ///// <see cref="EquatableSet{T}"/> to an <see cref="IEnumerable{T}"/>
+ ///// implementation.</summary>
+ ///// <param name="y">The <see cref="EquatableSet{T}"/> to compare
+ ///// against <paramref name="x"/>.</param>
+ ///// <param name="x">The <see cref="IEnumerable{T}"/> to compare
+ ///// against <paramref name="y"/>.</param>
+ ///// <returns>True if the instances are not equal, false otherwise.</returns>
+ //public static bool operator !=(System.Collections.Generic.IEnumerable<T> x, EquatableSet<T> y)
+ //{
+ // // Return the negative of the equals operation.
+ // return !(x == y);
+ //}
+
+ #endregion
+
#region IEquatable<T> members
/// <summary>
[42/50] lucenenet git commit: BUG:
Lucene.Net.Tests.Index.TestDirectoryReader. Added missing
DirectoryNotFoundException catch clauses
Posted by ni...@apache.org.
BUG: Lucene.Net.Tests.Index.TestDirectoryReader. Added missing DirectoryNotFoundException catch clauses
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/43a270df
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/43a270df
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/43a270df
Branch: refs/heads/api-work
Commit: 43a270df3f3d33963326a4b4c5ae2bcb523b6b4c
Parents: 0e2de16
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 19:28:10 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 19:28:10 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Tests/Index/TestDirectoryReader.cs | 12 ++++++++++++
1 file changed, 12 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/43a270df/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs b/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs
index 73f7bb4..a85e264 100644
--- a/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs
@@ -485,6 +485,12 @@ namespace Lucene.Net.Index
{
// expected
}
+ // LUCENENET specific - since NoSuchDirectoryException subclasses FileNotFoundException
+ // in Lucene, we need to catch it here to be on the safe side.
+ catch (System.IO.DirectoryNotFoundException)
+ {
+ // expected
+ }
dirFile.Delete();
@@ -500,6 +506,12 @@ namespace Lucene.Net.Index
{
// expected
}
+ // LUCENENET specific - since NoSuchDirectoryException subclasses FileNotFoundException
+ // in Lucene, we need to catch it here to be on the safe side.
+ catch (System.IO.DirectoryNotFoundException)
+ {
+ // expected
+ }
dir.Dispose();
}
[05/50] lucenenet git commit: Lucene.Net.Core.Search.PhraseQuery:
Replaced ValueList with EquatableList and changed SequenceEqual to
Equals on those lists.
Posted by ni...@apache.org.
Lucene.Net.Core.Search.PhraseQuery: Replaced ValueList<T> with EquatableList<T> and changed SequenceEqual to Equals on those lists.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/aa3a11aa
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/aa3a11aa
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/aa3a11aa
Branch: refs/heads/api-work
Commit: aa3a11aaa6d43ac6f3fb3838b6dc9f71708c5c24
Parents: 71fab05e6
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 05:54:40 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:28 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Search/PhraseQuery.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/aa3a11aa/src/Lucene.Net.Core/Search/PhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/PhraseQuery.cs b/src/Lucene.Net.Core/Search/PhraseQuery.cs
index 9686b6a4..12ea55f 100644
--- a/src/Lucene.Net.Core/Search/PhraseQuery.cs
+++ b/src/Lucene.Net.Core/Search/PhraseQuery.cs
@@ -51,8 +51,8 @@ namespace Lucene.Net.Search
public class PhraseQuery : Query
{
private string field;
- private List<Term> terms = new ValueList<Term>(4);
- private List<int?> positions = new ValueList<int?>(4);
+ private IList<Term> terms = new EquatableList<Term>(4);
+ private IList<int?> positions = new EquatableList<int?>(4);
private int maxPosition = 0;
private int slop = 0;
@@ -502,8 +502,8 @@ namespace Lucene.Net.Search
PhraseQuery other = (PhraseQuery)o;
return (this.Boost == other.Boost)
&& (this.slop == other.slop)
- && this.terms.SequenceEqual(other.terms)
- && this.positions.SequenceEqual(other.positions);
+ && this.terms.Equals(other.terms)
+ && this.positions.Equals(other.positions);
}
/// <summary>
[23/50] lucenenet git commit:
Lucene.Net.Core.Util.Packed.EliasFanoEncoder: Formatted the Equals() and
GetHashCode() methods the same as in Lucene
Posted by ni...@apache.org.
Lucene.Net.Core.Util.Packed.EliasFanoEncoder: Formatted the Equals() and GetHashCode() methods the same as in Lucene
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/c0a9ae6f
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/c0a9ae6f
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/c0a9ae6f
Branch: refs/heads/api-work
Commit: c0a9ae6fbd4db02befe4097dc3e5bb333629fd9a
Parents: d48493d
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 08:37:03 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:32 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Util/Packed/EliasFanoEncoder.cs | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c0a9ae6f/src/Lucene.Net.Core/Util/Packed/EliasFanoEncoder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Packed/EliasFanoEncoder.cs b/src/Lucene.Net.Core/Util/Packed/EliasFanoEncoder.cs
index 44f3b2f..1ef3f3f 100644
--- a/src/Lucene.Net.Core/Util/Packed/EliasFanoEncoder.cs
+++ b/src/Lucene.Net.Core/Util/Packed/EliasFanoEncoder.cs
@@ -381,12 +381,20 @@ namespace Lucene.Net.Util.Packed
}
EliasFanoEncoder oefs = (EliasFanoEncoder)other;
// no equality needed for upperBound
- return (this.numValues == oefs.numValues) && (this.numEncoded == oefs.numEncoded) && (this.numLowBits == oefs.numLowBits) && (this.numIndexEntries == oefs.numIndexEntries) && (this.indexInterval == oefs.indexInterval) && Arrays.Equals(this.upperLongs, oefs.upperLongs) && Arrays.Equals(this.lowerLongs, oefs.lowerLongs); // no need to check index content
+ return (this.numValues == oefs.numValues)
+ && (this.numEncoded == oefs.numEncoded)
+ && (this.numLowBits == oefs.numLowBits)
+ && (this.numIndexEntries == oefs.numIndexEntries)
+ && (this.indexInterval == oefs.indexInterval)
+ && Arrays.Equals(this.upperLongs, oefs.upperLongs)
+ && Arrays.Equals(this.lowerLongs, oefs.lowerLongs); // no need to check index content
}
public override int GetHashCode()
{
- int h = ((int)(31 * (numValues + 7 * (numEncoded + 5 * (numLowBits + 3 * (numIndexEntries + 11 * indexInterval)))))) ^ Arrays.GetHashCode(upperLongs) ^ Arrays.GetHashCode(lowerLongs);
+ int h = ((int)(31 * (numValues + 7 * (numEncoded + 5 * (numLowBits + 3 * (numIndexEntries + 11 * indexInterval))))))
+ ^ Arrays.GetHashCode(upperLongs)
+ ^ Arrays.GetHashCode(lowerLongs);
return h;
}
}
[15/50] lucenenet git commit:
Lucene.Net.Core.Search.Spans.SpanOrQuery: Replaced ValueList with
EquatableList
Posted by ni...@apache.org.
Lucene.Net.Core.Search.Spans.SpanOrQuery: Replaced ValueList<T> with EquatableList<T>
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/88012457
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/88012457
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/88012457
Branch: refs/heads/api-work
Commit: 88012457e0a38500fa0fd84d7d33e133401a9f8a
Parents: 4a4f402
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Mar 29 21:07:15 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:30 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Search/Spans/SpanOrQuery.cs | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/88012457/src/Lucene.Net.Core/Search/Spans/SpanOrQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Spans/SpanOrQuery.cs b/src/Lucene.Net.Core/Search/Spans/SpanOrQuery.cs
index e2c25c5..bafc9ad 100644
--- a/src/Lucene.Net.Core/Search/Spans/SpanOrQuery.cs
+++ b/src/Lucene.Net.Core/Search/Spans/SpanOrQuery.cs
@@ -1,6 +1,7 @@
using Lucene.Net.Support;
using System.Collections.Generic;
using System;
+using System.Linq;
using System.Text;
namespace Lucene.Net.Search.Spans
@@ -33,9 +34,7 @@ namespace Lucene.Net.Search.Spans
/// Matches the union of its clauses. </summary>
public class SpanOrQuery : SpanQuery
{
- // LUCENENET NOTE: The hash code needs to be made from the hash codes of all elements.
- // So, we force all subclasses to use ValueList<SpanQuery> instead of IList<SpanQuery> to ensure that logic is in place.
- private readonly ValueList<SpanQuery> clauses;
+ private readonly EquatableList<SpanQuery> clauses;
private string field;
/// <summary>
@@ -43,7 +42,7 @@ namespace Lucene.Net.Search.Spans
public SpanOrQuery(params SpanQuery[] clauses)
{
// copy clauses array into an ArrayList
- this.clauses = new ValueList<SpanQuery>(clauses.Length);
+ this.clauses = new EquatableList<SpanQuery>(clauses.Length);
for (int i = 0; i < clauses.Length; i++)
{
AddClause(clauses[i]);
[47/50] lucenenet git commit:
Lucene.Net.TestFramework.Store.MockDirectoryWrapper: added
DirectoryNotFoundException to the random errors that are thrown
Posted by ni...@apache.org.
Lucene.Net.TestFramework.Store.MockDirectoryWrapper: added DirectoryNotFoundException to the random errors that are thrown
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/cce500f7
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/cce500f7
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/cce500f7
Branch: refs/heads/api-work
Commit: cce500f759ffa9718ede859e9910f5dd8f0e9e6c
Parents: 76efed0
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 20:01:47 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 20:01:47 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/cce500f7/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
index 43e6005..1c6eb46 100644
--- a/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
+++ b/src/Lucene.Net.TestFramework/Store/MockDirectoryWrapper.cs
@@ -531,7 +531,7 @@ namespace Lucene.Net.Store
}
else
{
- throw RandomState.NextBoolean() ? new FileNotFoundException("a randomSystem.IO.IOException (" + name + ")") : new FileNotFoundException("a randomSystem.IO.IOException (" + name + ")");
+ throw RandomState.NextBoolean() ? (IOException)new FileNotFoundException("a randomSystem.IO.IOException (" + name + ")") : new DirectoryNotFoundException("a randomSystem.IO.IOException (" + name + ")");
}
}
}
@@ -1318,7 +1318,7 @@ namespace Lucene.Net.Store
MaybeYield();
if (!LuceneTestCase.SlowFileExists(m_input, name))
{
- throw RandomState.NextBoolean() ? new FileNotFoundException(name) : new FileNotFoundException(name);
+ throw RandomState.NextBoolean() ? (IOException)new FileNotFoundException(name) : new DirectoryNotFoundException(name);
}
// cannot open a file for input if it's still open for
// output, except for segments.gen and segments_N
[08/50] lucenenet git commit: Lucene.Net.Core.Search.Spans
(SpanNearPayloadCheckQuery + SpanPayloadCheckQuery): Changed SequenceEqual()
and GetValueHashCode() to Collections.Equals() and Collections.GetHashCode()
(which both change their algorithm accord
Posted by ni...@apache.org.
Lucene.Net.Core.Search.Spans (SpanNearPayloadCheckQuery + SpanPayloadCheckQuery): Changed SequenceEqual() and GetValueHashCode() to Collections.Equals() and Collections.GetHashCode() (which both change their algorithm according to the type of collection that is used, just like in Lucene)
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/476b2895
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/476b2895
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/476b2895
Branch: refs/heads/api-work
Commit: 476b2895d9aba56703fd123c45d6d839bb65904d
Parents: a4a5f1c
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Mar 29 20:04:43 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:28 2017 +0700
----------------------------------------------------------------------
.../Search/Spans/SpanNearPayloadCheckQuery.cs | 8 +++++---
src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs | 8 +++++---
2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/476b2895/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs b/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs
index d46d737..a523fb6 100644
--- a/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs
+++ b/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs
@@ -118,8 +118,10 @@ namespace Lucene.Net.Search.Spans
}
SpanNearPayloadCheckQuery other = (SpanNearPayloadCheckQuery)o;
- // LUCENENET NOTE: Need to call SequenceEqual() to compare equality of all contained values
- return this.m_payloadToMatch.SequenceEqual(other.m_payloadToMatch) && this.m_match.Equals(other.m_match) && this.Boost == other.Boost;
+ // LUCENENET NOTE: Need to call Collections.Equals() to compare equality of all contained values
+ return Collections.Equals(this.m_payloadToMatch, other.m_payloadToMatch)
+ && this.m_match.Equals(other.m_match)
+ && this.Boost == other.Boost;
}
public override int GetHashCode()
@@ -127,7 +129,7 @@ namespace Lucene.Net.Search.Spans
int h = m_match.GetHashCode();
h ^= (h << 8) | ((int)((uint)h >> 25)); // reversible
//TODO: is this right?
- h ^= m_payloadToMatch.GetValueHashCode(); // LUCENENET NOTE: Need to call GetValueHashCode() to combine the hash codes of all contained values
+ h ^= Collections.GetHashCode(m_payloadToMatch); // LUCENENET NOTE: Need to call Collections.GetHashCode() to combine the hash codes of all contained values
h ^= Number.SingleToRawInt32Bits(Boost);
return h;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/476b2895/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs b/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs
index 1564d25..466d894 100644
--- a/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs
+++ b/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs
@@ -118,8 +118,10 @@ namespace Lucene.Net.Search.Spans
}
SpanPayloadCheckQuery other = (SpanPayloadCheckQuery)o;
- // LUCENENET NOTE: Need to call SequenceEqual() to compare equality of all contained values
- return this.m_payloadToMatch.SequenceEqual(other.m_payloadToMatch) && this.m_match.Equals(other.m_match) && this.Boost == other.Boost;
+ // LUCENENET NOTE: Need to call Collections.Equals() to compare equality of all contained values
+ return Collections.Equals(this.m_payloadToMatch, other.m_payloadToMatch)
+ && this.m_match.Equals(other.m_match)
+ && this.Boost == other.Boost;
}
public override int GetHashCode()
@@ -127,7 +129,7 @@ namespace Lucene.Net.Search.Spans
int h = m_match.GetHashCode();
h ^= (h << 8) | ((int)((uint)h >> 25)); // reversible
//TODO: is this right?
- h ^= m_payloadToMatch.GetValueHashCode(); // LUCENENET NOTE: Need to call GetValueHashCode() to combine the hash codes of all contained values
+ h ^= Collections.GetHashCode(m_payloadToMatch); // LUCENENET NOTE: Need to call Collections.GetHashCode() to combine the hash codes of all contained values
h ^= Number.SingleToRawInt32Bits(Boost);
return h;
}
[45/50] lucenenet git commit: Lucene.Net.Core.Store.FSDirectory:
passed original exception through for debugging purposes
Posted by ni...@apache.org.
Lucene.Net.Core.Store.FSDirectory: passed original exception through for debugging purposes
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/362133a2
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/362133a2
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/362133a2
Branch: refs/heads/api-work
Commit: 362133a2a73a424697ea96efe998fa42ec02ac1b
Parents: a966d9a
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 19:59:07 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 19:59:07 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Store/FSDirectory.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/362133a2/src/Lucene.Net.Core/Store/FSDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/FSDirectory.cs b/src/Lucene.Net.Core/Store/FSDirectory.cs
index b66e535..41334b3 100644
--- a/src/Lucene.Net.Core/Store/FSDirectory.cs
+++ b/src/Lucene.Net.Core/Store/FSDirectory.cs
@@ -305,9 +305,9 @@ namespace Lucene.Net.Store
throw new IOException("Cannot delete " + file);
}
}
- catch (Exception)
+ catch (Exception e)
{
- throw new IOException("Cannot delete " + file);
+ throw new IOException("Cannot delete " + file, e);
}
m_staleFiles.Remove(name);
}
[32/50] lucenenet git commit: Lucene.Net.Core.Support.Arrays: Removed
unused GetHashCode() overload
Posted by ni...@apache.org.
Lucene.Net.Core.Support.Arrays: Removed unused GetHashCode() overload
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/d072fc77
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/d072fc77
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/d072fc77
Branch: refs/heads/api-work
Commit: d072fc7736c297c51ffa7f5f53e707bb19edb825
Parents: 92b7d0b
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 09:31:33 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:31:33 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Support/Arrays.cs | 23 -----------------------
1 file changed, 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d072fc77/src/Lucene.Net.Core/Support/Arrays.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/Arrays.cs b/src/Lucene.Net.Core/Support/Arrays.cs
index d810e17..8a83f22 100644
--- a/src/Lucene.Net.Core/Support/Arrays.cs
+++ b/src/Lucene.Net.Core/Support/Arrays.cs
@@ -142,29 +142,6 @@ namespace Lucene.Net.Support
return string.Join(", ", values);
}
- public static int GetHashCode<T>(IEnumerable<T> values)
- {
- if (values == null)
- return 0;
-
- const int prime = 17;
-
- int hashCode = 23;
-
- unchecked
- {
- foreach (var value in values)
- {
- if (value == null)
- continue;
-
- hashCode = hashCode * prime + value.GetHashCode();
- }
- }
-
- return hashCode;
- }
-
public static List<T> AsList<T>(params T[] objects)
{
return objects.ToList();
[36/50] lucenenet git commit: Lucene.Net.Core.Util.Fst.NodeHash:
Fixed GetHashCode() calls to use Collections.GetHashCode() on reference types
Posted by ni...@apache.org.
Lucene.Net.Core.Util.Fst.NodeHash: Fixed GetHashCode() calls to use Collections.GetHashCode() on reference types
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/7fd381b4
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/7fd381b4
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/7fd381b4
Branch: refs/heads/api-work
Commit: 7fd381b444beaf038e2abb341175fc1e2a81a9bd
Parents: 6c9a3c6
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 13:08:25 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 13:08:25 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Util/Fst/NodeHash.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/7fd381b4/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
index 0a3104d..207fa04 100644
--- a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
+++ b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
@@ -95,10 +95,10 @@ namespace Lucene.Net.Util.Fst
h = PRIME * h + arc.Label;
long n = ((Builder.CompiledNode)arc.Target).Node;
h = PRIME * h + (int)(n ^ (n >> 32));
- h = PRIME * h + arc.Output.GetHashCode();
// LUCENENET specific - optimize the Hash methods
// by only calling Collections.GetHashCode() if the value is a reference type
+ h = PRIME * h + (tIsValueType ? arc.Output.GetHashCode() : Collections.GetHashCode(arc.Output));
h = PRIME * h + (tIsValueType ? arc.NextFinalOutput.GetHashCode() : Collections.GetHashCode(arc.NextFinalOutput));
if (arc.IsFinal)
{
@@ -123,10 +123,10 @@ namespace Lucene.Net.Util.Fst
//System.out.println(" label=" + scratchArc.label + " target=" + scratchArc.target + " h=" + h + " output=" + fst.outputs.outputToString(scratchArc.output) + " next?=" + scratchArc.flag(4) + " final?=" + scratchArc.isFinal() + " pos=" + in.getPosition());
h = PRIME * h + scratchArc.Label;
h = PRIME * h + (int)(scratchArc.Target ^ (scratchArc.Target >> 32));
- h = PRIME * h + scratchArc.Output.GetHashCode();
// LUCENENET specific - optimize the Hash methods
// by only calling Collections.GetHashCode() if the value is a reference type
+ h = PRIME * h + (tIsValueType ? scratchArc.Output.GetHashCode() : Collections.GetHashCode(scratchArc.Output));
h = PRIME * h + (tIsValueType ? scratchArc.NextFinalOutput.GetHashCode() : Collections.GetHashCode(scratchArc.NextFinalOutput));
if (scratchArc.IsFinal)
{
[26/50] lucenenet git commit:
Lucene.Net.Queries.Function.ValueSources.MultiFunction: Use Equatable.Wrap()
to wrap the provided list in EquatableList for Equals() and GetHashCode()
comparisons
Posted by ni...@apache.org.
Lucene.Net.Queries.Function.ValueSources.MultiFunction: Use Equatable.Wrap() to wrap the provided list in EquatableList for Equals() and GetHashCode() comparisons
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/1c751a25
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/1c751a25
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/1c751a25
Branch: refs/heads/api-work
Commit: 1c751a2506dc50fc35df05366a47e22bcef42748
Parents: ebfca98
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 08:40:24 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:51 2017 +0700
----------------------------------------------------------------------
.../Function/ValueSources/MultiFunction.cs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1c751a25/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs
index 23d909a..55cd79c 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs
@@ -1,5 +1,6 @@
\ufeffusing Lucene.Net.Index;
using Lucene.Net.Search;
+using Lucene.Net.Support;
using System.Collections;
using System.Collections.Generic;
using System.Text;
@@ -125,7 +126,9 @@ namespace Lucene.Net.Queries.Function.ValueSources
public override int GetHashCode()
{
- return m_sources.GetHashCode() + Name.GetHashCode();
+ // LUCENENET specific: ensure our passed in list is equatable by
+ // wrapping it in an EquatableList if it is not one already
+ return Equatable.Wrap(m_sources).GetHashCode() + Name.GetHashCode();
}
public override bool Equals(object o)
@@ -135,7 +138,10 @@ namespace Lucene.Net.Queries.Function.ValueSources
return false;
}
var other = (MultiFunction)o;
- return this.m_sources.Equals(other.m_sources);
+
+ // LUCENENET specific: ensure our passed in list is equatable by
+ // wrapping it in an EquatableList if it is not one already
+ return Equatable.Wrap(this.m_sources).Equals(other.m_sources);
}
}
}
\ No newline at end of file
[48/50] lucenenet git commit: Lucene.Net.Core.Index (Types starting
with A-C): Fixed documentation comments
Posted by ni...@apache.org.
Lucene.Net.Core.Index (Types starting with A-C): Fixed documentation comments
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/05c8b585
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/05c8b585
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/05c8b585
Branch: refs/heads/api-work
Commit: 05c8b5851fa671e56996869488000418005c5f82
Parents: cce500f
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 23:43:50 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 23:43:50 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Index/AutomatonTermsEnum.cs | 59 +++----
.../Index/BaseCompositeReader.cs | 30 ++--
src/Lucene.Net.Core/Index/BinaryDocValues.cs | 2 +-
.../Index/BinaryDocValuesFieldUpdates.cs | 6 +-
.../Index/BinaryDocValuesWriter.cs | 4 +-
src/Lucene.Net.Core/Index/BitsSlice.cs | 4 +-
src/Lucene.Net.Core/Index/BufferedUpdates.cs | 20 ++-
.../Index/BufferedUpdatesStream.cs | 49 +++---
src/Lucene.Net.Core/Index/ByteSliceReader.cs | 13 +-
src/Lucene.Net.Core/Index/ByteSliceWriter.cs | 3 +-
src/Lucene.Net.Core/Index/CheckIndex.cs | 164 ++++++++++---------
src/Lucene.Net.Core/Index/CompositeReader.cs | 45 +++--
.../Index/CompositeReaderContext.cs | 6 +-
.../Index/ConcurrentMergeScheduler.cs | 97 +++++------
.../Index/CorruptIndexException.cs | 6 +-
15 files changed, 264 insertions(+), 244 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05c8b585/src/Lucene.Net.Core/Index/AutomatonTermsEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/AutomatonTermsEnum.cs b/src/Lucene.Net.Core/Index/AutomatonTermsEnum.cs
index b6ba1b4..39b2458 100644
--- a/src/Lucene.Net.Core/Index/AutomatonTermsEnum.cs
+++ b/src/Lucene.Net.Core/Index/AutomatonTermsEnum.cs
@@ -29,20 +29,20 @@ namespace Lucene.Net.Index
using Transition = Lucene.Net.Util.Automaton.Transition;
/// <summary>
- /// A FilteredTermsEnum that enumerates terms based upon what is accepted by a
+ /// A <see cref="FilteredTermsEnum"/> that enumerates terms based upon what is accepted by a
/// DFA.
- /// <p>
+ /// <para/>
/// The algorithm is such:
- /// <ol>
- /// <li>As long as matches are successful, keep reading sequentially.
- /// <li>When a match fails, skip to the next string in lexicographic order that
- /// does not enter a reject state.
- /// </ol>
- /// <p>
+ /// <list type="number">
+ /// <item>As long as matches are successful, keep reading sequentially.</item>
+ /// <item>When a match fails, skip to the next string in lexicographic order that
+ /// does not enter a reject state.</item>
+ /// </list>
+ /// <para>
/// The algorithm does not attempt to actually skip to the next string that is
/// completely accepted. this is not possible when the language accepted by the
/// FSM is not finite (i.e. * operator).
- /// </p>
+ /// </para>
/// @lucene.experimental
/// </summary>
internal class AutomatonTermsEnum : FilteredTermsEnum
@@ -79,10 +79,11 @@ namespace Lucene.Net.Index
/// <summary>
/// Construct an enumerator based upon an automaton, enumerating the specified
- /// field, working on a supplied TermsEnum
- /// <p>
+ /// field, working on a supplied <see cref="TermsEnum"/>
+ /// <para/>
/// @lucene.experimental
- /// <p> </summary>
+ /// </summary>
+ /// <param name="tenum"> TermsEnum </param>
/// <param name="compiled"> CompiledAutomaton </param>
public AutomatonTermsEnum(TermsEnum tenum, CompiledAutomaton compiled)
: base(tenum)
@@ -100,7 +101,7 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// Returns true if the term matches the automaton. Also stashes away the term
+ /// Returns <c>true</c> if the term matches the automaton. Also stashes away the term
/// to assist with smart enumeration.
/// </summary>
protected override AcceptStatus Accept(BytesRef term)
@@ -153,7 +154,7 @@ namespace Lucene.Net.Index
/// <summary>
/// Sets the enum to operate in linear fashion, as we have found
/// a looping transition at position: we set an upper bound and
- /// act like a TermRangeQuery for this portion of the term space.
+ /// act like a <see cref="Search.TermRangeQuery"/> for this portion of the term space.
/// </summary>
private void SetLinear(int position)
{
@@ -195,14 +196,14 @@ namespace Lucene.Net.Index
private readonly Int32sRef savedStates = new Int32sRef(10);
/// <summary>
- /// Increments the byte buffer to the next String in binary order after s that will not put
+ /// Increments the byte buffer to the next string in binary order after s that will not put
/// the machine into a reject state. If such a string does not exist, returns
- /// false.
- ///
+ /// <c>false</c>.
+ /// <para/>
/// The correctness of this method depends upon the automaton being deterministic,
/// and having no transitions to dead states.
/// </summary>
- /// <returns> true if more possible solutions exist for the DFA </returns>
+ /// <returns> <c>true</c> if more possible solutions exist for the DFA </returns>
private bool NextString()
{
int state;
@@ -263,21 +264,21 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// Returns the next String in lexicographic order that will not put
+ /// Returns the next string in lexicographic order that will not put
/// the machine into a reject state.
- ///
- /// this method traverses the DFA from the given position in the String,
+ /// <para/>
+ /// This method traverses the DFA from the given position in the string,
/// starting at the given state.
- ///
- /// If this cannot satisfy the machine, returns false. this method will
+ /// <para/>
+ /// If this cannot satisfy the machine, returns <c>false</c>. This method will
/// walk the minimal path, in lexicographic order, as long as possible.
- ///
- /// If this method returns false, then there might still be more solutions,
+ /// <para/>
+ /// If this method returns <c>false</c>, then there might still be more solutions,
/// it is necessary to backtrack to find out.
/// </summary>
/// <param name="state"> current non-reject state </param>
/// <param name="position"> useful portion of the string </param>
- /// <returns> true if more possible solutions exist for the DFA from this
+ /// <returns> <c>true</c> if more possible solutions exist for the DFA from this
/// position </returns>
private bool NextString(int state, int position)
{
@@ -350,11 +351,11 @@ namespace Lucene.Net.Index
/// <summary>
/// Attempts to backtrack thru the string after encountering a dead end
- /// at some given position. Returns false if no more possible strings
+ /// at some given position. Returns <c>false</c> if no more possible strings
/// can match.
/// </summary>
- /// <param name="position"> current position in the input String </param>
- /// <returns> position >=0 if more possible solutions exist for the DFA </returns>
+ /// <param name="position"> current position in the input string </param>
+ /// <returns> position >=0 if more possible solutions exist for the DFA </returns>
private int Backtrack(int position)
{
while (position-- > 0)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05c8b585/src/Lucene.Net.Core/Index/BaseCompositeReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/BaseCompositeReader.cs b/src/Lucene.Net.Core/Index/BaseCompositeReader.cs
index c33c3cf..90da6c8 100644
--- a/src/Lucene.Net.Core/Index/BaseCompositeReader.cs
+++ b/src/Lucene.Net.Core/Index/BaseCompositeReader.cs
@@ -22,29 +22,31 @@ namespace Lucene.Net.Index
*/
/// <summary>
- /// Base class for implementing <seealso cref="CompositeReader"/>s based on an array
+ /// Base class for implementing <see cref="CompositeReader"/>s based on an array
/// of sub-readers. The implementing class has to add code for
/// correctly refcounting and closing the sub-readers.
///
- /// <p>User code will most likely use <seealso cref="MultiReader"/> to build a
+ /// <para/>User code will most likely use <see cref="MultiReader"/> to build a
/// composite reader on a set of sub-readers (like several
- /// <seealso cref="DirectoryReader"/>s).
+ /// <see cref="DirectoryReader"/>s).
///
- /// <p> For efficiency, in this API documents are often referred to via
+ /// <para/> For efficiency, in this API documents are often referred to via
/// <i>document numbers</i>, non-negative integers which each name a unique
/// document in the index. These document numbers are ephemeral -- they may change
/// as documents are added to and deleted from an index. Clients should thus not
/// rely on a given document having the same number between sessions.
///
- /// <p><a name="thread-safety"></a><p><b>NOTE</b>: {@link
- /// IndexReader} instances are completely thread
+ /// <para/><b>NOTE</b>:
+ /// <see cref="IndexReader"/> instances are completely thread
/// safe, meaning multiple threads can call any of its methods,
/// concurrently. If your application requires external
/// synchronization, you should <b>not</b> synchronize on the
- /// <code>IndexReader</code> instance; use your own
- /// (non-Lucene) objects instead. </summary>
- /// <seealso cref= MultiReader
- /// @lucene.internal </seealso>
+ /// <see cref="IndexReader"/> instance; use your own
+ /// (non-Lucene) objects instead.
+ /// <para/>
+ /// @lucene.internal
+ /// </summary>
+ /// <seealso cref="MultiReader"/>
public abstract class BaseCompositeReader<R> : CompositeReader
where R : IndexReader
{
@@ -54,15 +56,15 @@ namespace Lucene.Net.Index
private readonly int numDocs;
/// <summary>
- /// List view solely for <seealso cref="#getSequentialSubReaders()"/>,
+ /// List view solely for <see cref="GetSequentialSubReaders()"/>,
/// for effectiveness the array is used internally.
/// </summary>
private readonly IList<R> subReadersList;
/// <summary>
- /// Constructs a {@code BaseCompositeReader} on the given subReaders. </summary>
- /// <param name="subReaders"> the wrapped sub-readers. this array is returned by
- /// <seealso cref="#getSequentialSubReaders"/> and used to resolve the correct
+ /// Constructs a <see cref="BaseCompositeReader{R}"/> on the given <paramref name="subReaders"/>. </summary>
+ /// <param name="subReaders"> the wrapped sub-readers. This array is returned by
+ /// <see cref="GetSequentialSubReaders()"/> and used to resolve the correct
/// subreader for docID-based methods. <b>Please note:</b> this array is <b>not</b>
/// cloned and not protected for modification, the subclass is responsible
/// to do this. </param>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05c8b585/src/Lucene.Net.Core/Index/BinaryDocValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/BinaryDocValues.cs b/src/Lucene.Net.Core/Index/BinaryDocValues.cs
index 2c2ecbd..196ab7e 100644
--- a/src/Lucene.Net.Core/Index/BinaryDocValues.cs
+++ b/src/Lucene.Net.Core/Index/BinaryDocValues.cs
@@ -20,7 +20,7 @@ namespace Lucene.Net.Index
using BytesRef = Lucene.Net.Util.BytesRef;
/// <summary>
- /// A per-document byte[]
+ /// A per-document <see cref="T:byte[]"/>
/// </summary>
public abstract class BinaryDocValues
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05c8b585/src/Lucene.Net.Core/Index/BinaryDocValuesFieldUpdates.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/BinaryDocValuesFieldUpdates.cs b/src/Lucene.Net.Core/Index/BinaryDocValuesFieldUpdates.cs
index d8648cf..43357b0 100644
--- a/src/Lucene.Net.Core/Index/BinaryDocValuesFieldUpdates.cs
+++ b/src/Lucene.Net.Core/Index/BinaryDocValuesFieldUpdates.cs
@@ -31,9 +31,9 @@ namespace Lucene.Net.Index
using PagedMutable = Lucene.Net.Util.Packed.PagedMutable;
/// <summary>
- /// A <seealso cref="DocValuesFieldUpdates"/> which holds updates of documents, of a single
- /// <seealso cref="BinaryDocValuesField"/>.
- ///
+ /// A <see cref="DocValuesFieldUpdates"/> which holds updates of documents, of a single
+ /// <see cref="BinaryDocValuesField"/>.
+ /// <para/>
/// @lucene.experimental
/// </summary>
internal class BinaryDocValuesFieldUpdates : DocValuesFieldUpdates
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05c8b585/src/Lucene.Net.Core/Index/BinaryDocValuesWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/BinaryDocValuesWriter.cs b/src/Lucene.Net.Core/Index/BinaryDocValuesWriter.cs
index 5c6be34..19c783e 100644
--- a/src/Lucene.Net.Core/Index/BinaryDocValuesWriter.cs
+++ b/src/Lucene.Net.Core/Index/BinaryDocValuesWriter.cs
@@ -33,8 +33,8 @@ namespace Lucene.Net.Index
using RamUsageEstimator = Lucene.Net.Util.RamUsageEstimator;
/// <summary>
- /// Buffers up pending byte[] per doc, then flushes when
- /// segment flushes.
+ /// Buffers up pending <see cref="T:byte[]"/> per doc, then flushes when
+ /// segment flushes.
/// </summary>
internal class BinaryDocValuesWriter : DocValuesWriter
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05c8b585/src/Lucene.Net.Core/Index/BitsSlice.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/BitsSlice.cs b/src/Lucene.Net.Core/Index/BitsSlice.cs
index 781ad34..91c8b24 100644
--- a/src/Lucene.Net.Core/Index/BitsSlice.cs
+++ b/src/Lucene.Net.Core/Index/BitsSlice.cs
@@ -23,8 +23,8 @@ namespace Lucene.Net.Index
using IBits = Lucene.Net.Util.IBits;
/// <summary>
- /// Exposes a slice of an existing Bits as a new Bits.
- ///
+ /// Exposes a slice of an existing <see cref="IBits"/> as a new <see cref="IBits"/>.
+ /// <para/>
/// @lucene.internal
/// </summary>
internal sealed class BitsSlice : IBits
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05c8b585/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 a069fb4..cdc5ff4 100644
--- a/src/Lucene.Net.Core/Index/BufferedUpdates.cs
+++ b/src/Lucene.Net.Core/Index/BufferedUpdates.cs
@@ -27,16 +27,18 @@ namespace Lucene.Net.Index
using Query = Lucene.Net.Search.Query;
using RamUsageEstimator = Lucene.Net.Util.RamUsageEstimator;
- /* Holds buffered deletes and updates, by docID, term or query for a
- * single segment. this is used to hold buffered pending
- * deletes and updates against the to-be-flushed segment. Once the
- * deletes and updates are pushed (on flush in DocumentsWriter), they
- * are converted to a FrozenDeletes instance. */
-
- // NOTE: instances of this class are accessed either via a private
- // instance on DocumentWriterPerThread, or via sync'd code by
- // DocumentsWriterDeleteQueue
+ /// <summary>
+ /// Holds buffered deletes and updates, by docID, term or query for a
+ /// single segment. this is used to hold buffered pending
+ /// deletes and updates against the to-be-flushed segment. Once the
+ /// deletes and updates are pushed (on flush in <see cref="DocumentsWriter"/>), they
+ /// are converted to a FrozenDeletes instance.
+ /// <para/>
+ /// NOTE: instances of this class are accessed either via a private
+ /// instance on <see cref="DocumentsWriterPerThread"/>, or via sync'd code by
+ /// <see cref="DocumentsWriterDeleteQueue"/>
+ /// </summary>
public class BufferedUpdates // LUCENENET NOTE: Made public rather than internal because it is available through a public API
{
/* Rough logic: HashMap has an array[Entry] w/ varying
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05c8b585/src/Lucene.Net.Core/Index/BufferedUpdatesStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/BufferedUpdatesStream.cs b/src/Lucene.Net.Core/Index/BufferedUpdatesStream.cs
index 4aad5f3..ffce501 100644
--- a/src/Lucene.Net.Core/Index/BufferedUpdatesStream.cs
+++ b/src/Lucene.Net.Core/Index/BufferedUpdatesStream.cs
@@ -30,21 +30,22 @@ namespace Lucene.Net.Index
using Query = Lucene.Net.Search.Query;
using QueryWrapperFilter = Lucene.Net.Search.QueryWrapperFilter;
- /* Tracks the stream of {@link BufferedDeletes}.
- * When DocumentsWriterPerThread flushes, its buffered
- * deletes and updates are appended to this stream. We later
- * apply them (resolve them to the actual
- * docIDs, per segment) when a merge is started
- * (only to the to-be-merged segments). We
- * also apply to all segments when NRT reader is pulled,
- * commit/close is called, or when too many deletes or updates are
- * buffered and must be flushed (by RAM usage or by count).
- *
- * Each packet is assigned a generation, and each flushed or
- * merged segment is also assigned a generation, so we can
- * track which BufferedDeletes packets to apply to any given
- * segment. */
-
+ /// <summary>
+ /// Tracks the stream of BufferedDeletes.
+ /// When <see cref="DocumentsWriterPerThread"/> flushes, its buffered
+ /// deletes and updates are appended to this stream. We later
+ /// apply them (resolve them to the actual
+ /// docIDs, per segment) when a merge is started
+ /// (only to the to-be-merged segments). We
+ /// also apply to all segments when NRT reader is pulled,
+ /// commit/close is called, or when too many deletes or updates are
+ /// buffered and must be flushed (by RAM usage or by count).
+ /// <para/>
+ /// Each packet is assigned a generation, and each flushed or
+ /// merged segment is also assigned a generation, so we can
+ /// track which BufferedDeletes packets to apply to any given
+ /// segment.
+ /// </summary>
internal class BufferedUpdatesStream
{
// TODO: maybe linked list?
@@ -67,8 +68,10 @@ namespace Lucene.Net.Index
this.infoStream = infoStream;
}
- // Appends a new packet of buffered deletes to the stream,
- // setting its generation:
+ /// <summary>
+ /// Appends a new packet of buffered deletes to the stream,
+ /// setting its generation:
+ /// </summary>
public virtual long Push(FrozenBufferedUpdates packet)
{
lock (this)
@@ -171,8 +174,8 @@ namespace Lucene.Net.Index
/// <summary>
/// Resolves the buffered deleted Term/Query/docIDs, into
- /// actual deleted docIDs in the liveDocs MutableBits for
- /// each SegmentReader.
+ /// actual deleted docIDs in the liveDocs <see cref="Util.IMutableBits"/> for
+ /// each <see cref="SegmentReader"/>.
/// </summary>
public virtual ApplyDeletesResult ApplyDeletesAndUpdates(IndexWriter.ReaderPool readerPool, IList<SegmentCommitInfo> infos)
{
@@ -389,10 +392,12 @@ namespace Lucene.Net.Index
}
// Lock order IW -> BD
- /* Removes any BufferedDeletes that we no longer need to
- * store because all segments in the index have had the
- * deletes applied. */
+ /// <summary>
+ /// Removes any BufferedDeletes that we no longer need to
+ /// store because all segments in the index have had the
+ /// deletes applied.
+ /// </summary>
public virtual void Prune(SegmentInfos segmentInfos)
{
lock (this)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05c8b585/src/Lucene.Net.Core/Index/ByteSliceReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/ByteSliceReader.cs b/src/Lucene.Net.Core/Index/ByteSliceReader.cs
index f0ba110..47061ec 100644
--- a/src/Lucene.Net.Core/Index/ByteSliceReader.cs
+++ b/src/Lucene.Net.Core/Index/ByteSliceReader.cs
@@ -24,12 +24,13 @@ namespace Lucene.Net.Index
using DataInput = Lucene.Net.Store.DataInput;
using DataOutput = Lucene.Net.Store.DataOutput;
- /* IndexInput that knows how to read the byte slices written
- * by Posting and PostingVector. We read the bytes in
- * each slice until we hit the end of that slice at which
- * point we read the forwarding address of the next slice
- * and then jump to it.*/
-
+ /// <summary>
+ /// <see cref="Store.IndexInput"/> that knows how to read the byte slices written
+ /// by Posting and PostingVector. We read the bytes in
+ /// each slice until we hit the end of that slice at which
+ /// point we read the forwarding address of the next slice
+ /// and then jump to it.
+ /// </summary>
public sealed class ByteSliceReader : DataInput // LUCENENET specific - changed from internal to public because returned from public API
{
private ByteBlockPool pool;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05c8b585/src/Lucene.Net.Core/Index/ByteSliceWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/ByteSliceWriter.cs b/src/Lucene.Net.Core/Index/ByteSliceWriter.cs
index e7b65be..f9fe770 100644
--- a/src/Lucene.Net.Core/Index/ByteSliceWriter.cs
+++ b/src/Lucene.Net.Core/Index/ByteSliceWriter.cs
@@ -24,10 +24,9 @@ namespace Lucene.Net.Index
/// <summary>
/// Class to write byte streams into slices of shared
- /// byte[]. this is used by DocumentsWriter to hold the
+ /// <see cref="T:byte[]"/>. This is used by <see cref="DocumentsWriter"/> to hold the
/// posting list for many terms in RAM.
/// </summary>
-
internal sealed class ByteSliceWriter : DataOutput
{
private byte[] slice;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05c8b585/src/Lucene.Net.Core/Index/CheckIndex.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/CheckIndex.cs b/src/Lucene.Net.Core/Index/CheckIndex.cs
index 84657e1..4356273 100644
--- a/src/Lucene.Net.Core/Index/CheckIndex.cs
+++ b/src/Lucene.Net.Core/Index/CheckIndex.cs
@@ -45,11 +45,14 @@ namespace Lucene.Net.Index
/// write a new segments file that removes reference to
/// problematic segments.
///
- /// <p>As this tool checks every byte in the index, on a large
+ /// <para/>As this tool checks every byte in the index, on a large
/// index it can take quite a long time to run.
///
- /// @lucene.experimental Please make a complete backup of your
+ /// <para/>
+ /// Please make a complete backup of your
/// index before using this to fix your index!
+ /// <para/>
+ /// @lucene.experimental
/// </summary>
public class CheckIndex
{
@@ -57,12 +60,10 @@ namespace Lucene.Net.Index
private Directory dir;
/// <summary>
- /// Returned from <seealso cref="#checkIndex()"/> detailing the health and status of the index.
- ///
+ /// Returned from <see cref="CheckIndex.DoCheckIndex()"/> detailing the health and status of the index.
+ /// <para/>
/// @lucene.experimental
- ///
/// </summary>
-
public class Status
{
internal Status()
@@ -88,9 +89,9 @@ namespace Lucene.Net.Index
/// True if we were unable to read the version number from segments_N file. </summary>
public bool MissingSegmentVersion { get; internal set; } // LUCENENET specific - made setter internal
- /// <summary>
- /// Name of latest segments_N file in the index. </summary>
- public string SegmentsFileName { get; internal set; } // LUCENENET specific - made setter internal
+ /// <summary>
+ /// Name of latest segments_N file in the index. </summary>
+ public string SegmentsFileName { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
/// Number of segments in the index. </summary>
@@ -98,24 +99,24 @@ namespace Lucene.Net.Index
/// <summary>
/// Empty unless you passed specific segments list to check as optional 3rd argument. </summary>
- /// <seealso cref= CheckIndex#checkIndex(List) </seealso>
+ /// <seealso cref="CheckIndex.DoCheckIndex(IList{string})"/>
public IList<string> SegmentsChecked { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// True if the index was created with a newer version of Lucene than the CheckIndex tool. </summary>
+ /// True if the index was created with a newer version of Lucene than the <see cref="CheckIndex"/> tool. </summary>
public bool ToolOutOfDate { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// List of <seealso cref="SegmentInfoStatus"/> instances, detailing status of each segment. </summary>
+ /// List of <see cref="SegmentInfoStatus"/> instances, detailing status of each segment. </summary>
public IList<SegmentInfoStatus> SegmentInfos { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// Directory index is in. </summary>
+ /// <see cref="Directory"/> index is in. </summary>
public Directory Dir { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// SegmentInfos instance containing only segments that
- /// had no problems (this is used with the <seealso cref="CheckIndex#fixIndex"/>
+ /// <see cref="Index.SegmentInfos"/> instance containing only segments that
+ /// had no problems (this is used with the <see cref="CheckIndex.FixIndex(Status)"/>
/// method to repair the index.
/// </summary>
internal SegmentInfos NewSegments { get; set; }
@@ -129,8 +130,8 @@ namespace Lucene.Net.Index
public int NumBadSegments { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// True if we checked only specific segments ({@link
- /// #checkIndex(List)}) was called with non-null
+ /// True if we checked only specific segments
+ /// (<see cref="DoCheckIndex(IList{string})"/> was called with non-null
/// argument).
/// </summary>
public bool Partial { get; internal set; } // LUCENENET specific - made setter internal
@@ -140,7 +141,7 @@ namespace Lucene.Net.Index
public int MaxSegmentName { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// Whether the SegmentInfos.counter is greater than any of the segments' names. </summary>
+ /// Whether the <see cref="SegmentInfos.Counter"/> is greater than any of the segments' names. </summary>
public bool ValidCounter { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
@@ -149,8 +150,8 @@ namespace Lucene.Net.Index
/// <summary>
/// Holds the status of each segment in the index.
- /// See <seealso cref="#segmentInfos"/>.
- ///
+ /// See <see cref="SegmentInfos"/>.
+ /// <para/>
/// @lucene.experimental
/// </summary>
public class SegmentInfoStatus
@@ -183,26 +184,26 @@ namespace Lucene.Net.Index
/// <summary>
/// Net size (MB) of the files referenced by this
- /// segment.
+ /// segment.
/// </summary>
public double SizeMB { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
/// Doc store offset, if this segment shares the doc
- /// store files (stored fields and term vectors) with
- /// other segments. this is -1 if it does not share.
+ /// store files (stored fields and term vectors) with
+ /// other segments. This is -1 if it does not share.
/// </summary>
public int DocStoreOffset { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// String of the shared doc store segment, or null if
- /// this segment does not share the doc store files.
+ /// String of the shared doc store segment, or <c>null</c> if
+ /// this segment does not share the doc store files.
/// </summary>
public string DocStoreSegment { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
/// True if the shared doc store files are compound file
- /// format.
+ /// format.
/// </summary>
public bool DocStoreCompoundFile { get; internal set; } // LUCENENET specific - made setter internal
@@ -219,8 +220,8 @@ namespace Lucene.Net.Index
public int NumDeleted { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// True if we were able to open an AtomicReader on this
- /// segment.
+ /// True if we were able to open an <see cref="AtomicReader"/> on this
+ /// segment.
/// </summary>
public bool OpenReaderPassed { get; internal set; } // LUCENENET specific - made setter internal
@@ -230,29 +231,29 @@ namespace Lucene.Net.Index
/// <summary>
/// Map that includes certain
- /// debugging details that IndexWriter records into
- /// each segment it creates
+ /// debugging details that <see cref="IndexWriter"/> records into
+ /// each segment it creates
/// </summary>
public IDictionary<string, string> Diagnostics { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// Status for testing of field norms (null if field norms could not be tested). </summary>
+ /// Status for testing of field norms (<c>null</c> if field norms could not be tested). </summary>
public FieldNormStatus FieldNormStatus { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// Status for testing of indexed terms (null if indexed terms could not be tested). </summary>
+ /// Status for testing of indexed terms (<c>null</c> if indexed terms could not be tested). </summary>
public TermIndexStatus TermIndexStatus { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// Status for testing of stored fields (null if stored fields could not be tested). </summary>
+ /// Status for testing of stored fields (<c>null</c> if stored fields could not be tested). </summary>
public StoredFieldStatus StoredFieldStatus { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// Status for testing of term vectors (null if term vectors could not be tested). </summary>
+ /// Status for testing of term vectors (<c>null</c> if term vectors could not be tested). </summary>
public TermVectorStatus TermVectorStatus { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// Status for testing of DocValues (null if DocValues could not be tested). </summary>
+ /// Status for testing of <see cref="DocValues"/> (<c>null</c> if <see cref="DocValues"/> could not be tested). </summary>
public DocValuesStatus DocValuesStatus { get; internal set; } // LUCENENET specific - made setter internal
}
@@ -273,7 +274,7 @@ namespace Lucene.Net.Index
public long TotFields { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// Exception thrown during term index test (null on success) </summary>
+ /// Exception thrown during term index test (<c>null</c> on success) </summary>
public Exception Error { get; internal set; } // LUCENENET specific - made setter internal
}
@@ -310,14 +311,14 @@ namespace Lucene.Net.Index
public long TotPos { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// Exception thrown during term index test (null on success) </summary>
+ /// Exception thrown during term index test (<c>null</c> on success) </summary>
public Exception Error { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
/// Holds details of block allocations in the block
- /// tree terms dictionary (this is only set if the
- /// <seealso cref="PostingsFormat"/> for this segment uses block
- /// tree.
+ /// tree terms dictionary (this is only set if the
+ /// <see cref="PostingsFormat"/> for this segment uses block
+ /// tree.
/// </summary>
public IDictionary<string, BlockTreeTermsReader.Stats> BlockTreeStats { get; internal set; } // LUCENENET specific - made setter internal
}
@@ -344,7 +345,7 @@ namespace Lucene.Net.Index
public long TotFields { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// Exception thrown during stored fields test (null on success) </summary>
+ /// Exception thrown during stored fields test (<c>null</c> on success) </summary>
public Exception Error { get; internal set; } // LUCENENET specific - made setter internal
}
@@ -370,12 +371,12 @@ namespace Lucene.Net.Index
public long TotVectors { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// Exception thrown during term vector test (null on success) </summary>
+ /// Exception thrown during term vector test (<c>null</c> on success) </summary>
public Exception Error { get; internal set; } // LUCENENET specific - made setter internal
}
/// <summary>
- /// Status from testing DocValues
+ /// Status from testing <see cref="DocValues"/>
/// </summary>
public sealed class DocValuesStatus
{
@@ -406,13 +407,13 @@ namespace Lucene.Net.Index
public long TotalSortedSetFields { get; internal set; } // LUCENENET specific - made setter internal
/// <summary>
- /// Exception thrown during doc values test (null on success) </summary>
+ /// Exception thrown during doc values test (<c>null</c> on success) </summary>
public Exception Error { get; internal set; } // LUCENENET specific - made setter internal
}
}
/// <summary>
- /// Create a new CheckIndex on the directory. </summary>
+ /// Create a new <see cref="CheckIndex"/> on the directory. </summary>
public CheckIndex(Directory dir)
{
this.dir = dir;
@@ -422,9 +423,9 @@ namespace Lucene.Net.Index
private bool crossCheckTermVectors;
/// <summary>
- /// If true, term vectors are compared against postings to
- /// make sure they are the same. this will likely
- /// drastically increase time it takes to run CheckIndex!
+ /// If <c>true</c>, term vectors are compared against postings to
+ /// make sure they are the same. This will likely
+ /// drastically increase time it takes to run <see cref="CheckIndex"/>!
/// </summary>
public virtual bool CrossCheckTermVectors
{
@@ -443,7 +444,7 @@ namespace Lucene.Net.Index
// LUCENENET specific - added getter so we don't need to keep a reference outside of this class to dispose
/// <summary>
/// Gets or Sets infoStream where messages should go. If null, no
- /// messages are printed. If <see cref="InfoStreamIsVerbose"/> is true then more
+ /// messages are printed. If <see cref="InfoStreamIsVerbose"/> is <c>true</c> then more
/// details are printed.
/// </summary>
public virtual TextWriter InfoStream
@@ -461,7 +462,7 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// If true, prints more details to the <see cref="InfoStream"/>, if set.
+ /// If <c>true</c>, prints more details to the <see cref="InfoStream"/>, if set.
/// </summary>
public virtual bool InfoStreamIsVerbose // LUCENENET specific (replaced overload of SetInfoStream with property)
{
@@ -483,15 +484,15 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// Returns a <seealso cref="Status"/> instance detailing
- /// the state of the index.
+ /// Returns a <see cref="Status"/> instance detailing
+ /// the state of the index.
///
- /// <p>As this method checks every byte in the index, on a large
- /// index it can take quite a long time to run.
+ /// <para/>As this method checks every byte in the index, on a large
+ /// index it can take quite a long time to run.
///
- /// <p><b>WARNING</b>: make sure
- /// you only call this when the index is not opened by any
- /// writer.
+ /// <para/><b>WARNING</b>: make sure
+ /// you only call this when the index is not opened by any
+ /// writer.
/// </summary>
public virtual Status DoCheckIndex()
{
@@ -499,18 +500,18 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// Returns a <seealso cref="Status"/> instance detailing
- /// the state of the index.
+ /// Returns a <see cref="Status"/> instance detailing
+ /// the state of the index.
/// </summary>
- /// <param name="onlySegments"> list of specific segment names to check
+ /// <param name="onlySegments"> list of specific segment names to check
///
- /// <p>As this method checks every byte in the specified
- /// segments, on a large index it can take quite a long
- /// time to run.
+ /// <para/>As this method checks every byte in the specified
+ /// segments, on a large index it can take quite a long
+ /// time to run.
///
- /// <p><b>WARNING</b>: make sure
- /// you only call this when the index is not opened by any
- /// writer. </param>
+ /// <para/><b>WARNING</b>: make sure
+ /// you only call this when the index is not opened by any
+ /// writer. </param>
public virtual Status DoCheckIndex(IList<string> onlySegments)
{
NumberFormatInfo nf = CultureInfo.CurrentCulture.NumberFormat;
@@ -933,6 +934,7 @@ namespace Lucene.Net.Index
/// <summary>
/// Test field norms.
+ /// <para/>
/// @lucene.experimental
/// </summary>
public static Status.FieldNormStatus TestFieldNorms(AtomicReader reader, TextWriter infoStream)
@@ -988,8 +990,8 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// checks Fields api is consistent with itself.
- /// searcher is optional, to verify with queries. Can be null.
+ /// Checks <see cref="Fields"/> api is consistent with itself.
+ /// Searcher is optional, to verify with queries. Can be <c>null</c>.
/// </summary>
private static Status.TermIndexStatus CheckFields(Fields fields, IBits liveDocs, int maxDoc, FieldInfos fieldInfos, bool doPrint, bool isVectors, TextWriter infoStream, bool verbose)
{
@@ -1644,6 +1646,7 @@ namespace Lucene.Net.Index
/// <summary>
/// Test the term index.
+ /// <para/>
/// @lucene.experimental
/// </summary>
public static Status.TermIndexStatus TestPostings(AtomicReader reader, TextWriter infoStream)
@@ -1653,6 +1656,7 @@ namespace Lucene.Net.Index
/// <summary>
/// Test the term index.
+ /// <para/>
/// @lucene.experimental
/// </summary>
public static Status.TermIndexStatus TestPostings(AtomicReader reader, TextWriter infoStream, bool verbose)
@@ -1703,6 +1707,7 @@ namespace Lucene.Net.Index
/// <summary>
/// Test stored fields.
+ /// <para/>
/// @lucene.experimental
/// </summary>
public static Status.StoredFieldStatus TestStoredFields(AtomicReader reader, TextWriter infoStream)
@@ -1757,6 +1762,7 @@ namespace Lucene.Net.Index
/// <summary>
/// Test docvalues.
+ /// <para/>
/// @lucene.experimental
/// </summary>
public static Status.DocValuesStatus TestDocValues(AtomicReader reader, TextWriter infoStream)
@@ -2044,6 +2050,7 @@ namespace Lucene.Net.Index
/// <summary>
/// Test term vectors.
+ /// <para/>
/// @lucene.experimental
/// </summary>
public static Status.TermVectorStatus TestTermVectors(AtomicReader reader, TextWriter infoStream)
@@ -2053,6 +2060,7 @@ namespace Lucene.Net.Index
/// <summary>
/// Test term vectors.
+ /// <para/>
/// @lucene.experimental
/// </summary>
public static Status.TermVectorStatus TestTermVectors(AtomicReader reader, TextWriter infoStream, bool verbose, bool crossCheckTermVectors)
@@ -2329,18 +2337,18 @@ namespace Lucene.Net.Index
/// <summary>
/// Repairs the index using previously returned result
- /// from <seealso cref="#checkIndex"/>. Note that this does not
- /// remove any of the unreferenced files after it's done;
- /// you must separately open an <seealso cref="IndexWriter"/>, which
- /// deletes unreferenced files when it's created.
+ /// from <see cref="DoCheckIndex()"/>. Note that this does not
+ /// remove any of the unreferenced files after it's done;
+ /// you must separately open an <see cref="IndexWriter"/>, which
+ /// deletes unreferenced files when it's created.
///
- /// <p><b>WARNING</b>: this writes a
- /// new segments file into the index, effectively removing
- /// all documents in broken segments from the index.
- /// BE CAREFUL.
+ /// <para/><b>WARNING</b>: this writes a
+ /// new segments file into the index, effectively removing
+ /// all documents in broken segments from the index.
+ /// BE CAREFUL.
///
- /// <p><b>WARNING</b>: Make sure you only call this when the
- /// index is not opened by any writer.
+ /// <para/><b>WARNING</b>: Make sure you only call this when the
+ /// index is not opened by any writer.
/// </summary>
public virtual void FixIndex(Status result)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05c8b585/src/Lucene.Net.Core/Index/CompositeReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/CompositeReader.cs b/src/Lucene.Net.Core/Index/CompositeReader.cs
index 71016c5..de5ef2c 100644
--- a/src/Lucene.Net.Core/Index/CompositeReader.cs
+++ b/src/Lucene.Net.Core/Index/CompositeReader.cs
@@ -27,33 +27,32 @@ namespace Lucene.Net.Index
/// <summary>
/// Instances of this reader type can only
- /// be used to get stored fields from the underlying AtomicReaders,
+ /// be used to get stored fields from the underlying <see cref="AtomicReader"/>s,
/// but it is not possible to directly retrieve postings. To do that, get
- /// the <seealso cref="AtomicReaderContext"/> for all sub-readers via <seealso cref="#leaves()"/>.
- /// Alternatively, you can mimic an <seealso cref="AtomicReader"/> (with a serious slowdown),
- /// by wrapping composite readers with <seealso cref="SlowCompositeReaderWrapper"/>.
+ /// the <see cref="AtomicReaderContext"/> for all sub-readers via <see cref="AtomicReaderContext.Leaves"/>.
+ /// Alternatively, you can mimic an <see cref="AtomicReader"/> (with a serious slowdown),
+ /// by wrapping composite readers with <see cref="SlowCompositeReaderWrapper"/>.
///
- /// <p>IndexReader instances for indexes on disk are usually constructed
- /// with a call to one of the static <code>DirectoryReader.open()</code> methods,
- /// e.g. <seealso cref="DirectoryReader#open(Directory)"/>. <seealso cref="DirectoryReader"/> implements
- /// the {@code CompositeReader} interface, it is not possible to directly get postings.
- /// <p> Concrete subclasses of IndexReader are usually constructed with a call to
- /// one of the static <code>open()</code> methods, e.g. {@link
- /// DirectoryReader#open(Directory)}.
+ /// <para/><see cref="IndexReader"/> instances for indexes on disk are usually constructed
+ /// with a call to one of the static <c>DirectoryReader.Open()</c> methods,
+ /// e.g. <see cref="DirectoryReader.Open(Store.Directory)"/>. <see cref="DirectoryReader"/> implements
+ /// the <see cref="CompositeReader"/> interface, it is not possible to directly get postings.
+ /// <para/> Concrete subclasses of <see cref="IndexReader"/> are usually constructed with a call to
+ /// one of the static <c>Open()</c> methods, e.g. <see cref="DirectoryReader.Open(Store.Directory)"/>.
///
- /// <p> For efficiency, in this API documents are often referred to via
+ /// <para/> For efficiency, in this API documents are often referred to via
/// <i>document numbers</i>, non-negative integers which each name a unique
/// document in the index. These document numbers are ephemeral -- they may change
/// as documents are added to and deleted from an index. Clients should thus not
/// rely on a given document having the same number between sessions.
///
- /// <p>
- /// <a name="thread-safety"></a><p><b>NOTE</b>: {@link
- /// IndexReader} instances are completely thread
+ /// <para/>
+ /// <b>NOTE</b>:
+ /// <see cref="IndexReader"/> instances are completely thread
/// safe, meaning multiple threads can call any of its methods,
/// concurrently. If your application requires external
/// synchronization, you should <b>not</b> synchronize on the
- /// <code>IndexReader</code> instance; use your own
+ /// <see cref="IndexReader"/> instance; use your own
/// (non-Lucene) objects instead.
/// </summary>
public abstract class CompositeReader : IndexReader
@@ -62,7 +61,7 @@ namespace Lucene.Net.Index
/// <summary>
/// Sole constructor. (For invocation by subclass
- /// constructors, typically implicit.)
+ /// constructors, typically implicit.)
/// </summary>
protected internal CompositeReader()
: base()
@@ -98,13 +97,13 @@ namespace Lucene.Net.Index
/// <summary>
/// Expert: returns the sequential sub readers that this
- /// reader is logically composed of. this method may not
- /// return {@code null}.
+ /// reader is logically composed of. This method may not
+ /// return <c>null</c>.
///
- /// <p><b>NOTE:</b> In contrast to previous Lucene versions this method
- /// is no longer public, code that wants to get all <seealso cref="AtomicReader"/>s
- /// this composite is composed of should use <seealso cref="IndexReader#leaves()"/>. </summary>
- /// <seealso cref= IndexReader#leaves() </seealso>
+ /// <para/><b>NOTE:</b> In contrast to previous Lucene versions this method
+ /// is no longer public, code that wants to get all <see cref="AtomicReader"/>s
+ /// this composite is composed of should use <see cref="IndexReader.Leaves"/>. </summary>
+ /// <seealso cref="IndexReader.Leaves"/>
protected internal abstract IList<IndexReader> GetSequentialSubReaders();
public override sealed IndexReaderContext Context
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05c8b585/src/Lucene.Net.Core/Index/CompositeReaderContext.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/CompositeReaderContext.cs b/src/Lucene.Net.Core/Index/CompositeReaderContext.cs
index 8013a55..846f213 100644
--- a/src/Lucene.Net.Core/Index/CompositeReaderContext.cs
+++ b/src/Lucene.Net.Core/Index/CompositeReaderContext.cs
@@ -22,7 +22,7 @@ namespace Lucene.Net.Index
*/
/// <summary>
- /// <seealso cref="IndexReaderContext"/> for <seealso cref="CompositeReader"/> instance.
+ /// <see cref="IndexReaderContext"/> for <see cref="CompositeReader"/> instance.
/// </summary>
public sealed class CompositeReaderContext : IndexReaderContext
{
@@ -36,7 +36,7 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// Creates a <seealso cref="CompositeReaderContext"/> for intermediate readers that aren't
+ /// Creates a <see cref="CompositeReaderContext"/> for intermediate readers that aren't
/// not top-level readers in the current context
/// </summary>
internal CompositeReaderContext(CompositeReaderContext parent, CompositeReader reader, int ordInParent, int docbaseInParent, IList<IndexReaderContext> children)
@@ -45,7 +45,7 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// Creates a <seealso cref="CompositeReaderContext"/> for top-level readers with parent set to <code>null</code>
+ /// Creates a <see cref="CompositeReaderContext"/> for top-level readers with parent set to <c>null</c>
/// </summary>
internal CompositeReaderContext(CompositeReader reader, IList<IndexReaderContext> children, IList<AtomicReaderContext> leaves)
: this(null, reader, 0, 0, children, leaves)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05c8b585/src/Lucene.Net.Core/Index/ConcurrentMergeScheduler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/ConcurrentMergeScheduler.cs b/src/Lucene.Net.Core/Index/ConcurrentMergeScheduler.cs
index 8cd99cd..8d24ac6 100644
--- a/src/Lucene.Net.Core/Index/ConcurrentMergeScheduler.cs
+++ b/src/Lucene.Net.Core/Index/ConcurrentMergeScheduler.cs
@@ -27,32 +27,32 @@ namespace Lucene.Net.Index
using Directory = Lucene.Net.Store.Directory;
/// <summary>
- /// A <seealso cref="MergeScheduler"/> that runs each merge using a
- /// separate thread.
+ /// A <see cref="MergeScheduler"/> that runs each merge using a
+ /// separate thread.
///
- /// <p>Specify the max number of threads that may run at
- /// once, and the maximum number of simultaneous merges
- /// with <seealso cref="#setMaxMergesAndThreads"/>.</p>
+ /// <para>Specify the max number of threads that may run at
+ /// once, and the maximum number of simultaneous merges
+ /// with <see cref="SetMaxMergesAndThreads"/>.</para>
///
- /// <p>If the number of merges exceeds the max number of threads
- /// then the largest merges are paused until one of the smaller
- /// merges completes.</p>
+ /// <para>If the number of merges exceeds the max number of threads
+ /// then the largest merges are paused until one of the smaller
+ /// merges completes.</para>
///
- /// <p>If more than <seealso cref="#getMaxMergeCount"/> merges are
- /// requested then this class will forcefully throttle the
- /// incoming threads by pausing until one more more merges
- /// complete.</p>
+ /// <para>If more than <see cref="MaxMergeCount"/> merges are
+ /// requested then this class will forcefully throttle the
+ /// incoming threads by pausing until one more more merges
+ /// complete.</para>
/// </summary>
public class ConcurrentMergeScheduler : MergeScheduler, IConcurrentMergeScheduler
{
private int mergeThreadPriority = -1;
/// <summary>
- /// List of currently active <seealso cref="MergeThread"/>s. </summary>
+ /// List of currently active <see cref="MergeThread"/>s. </summary>
protected internal IList<MergeThread> m_mergeThreads = new List<MergeThread>();
/// <summary>
- /// Default {@code maxThreadCount}.
+ /// Default <see cref="MaxThreadCount"/>.
/// We default to 1: tests on spinning-magnet drives showed slower
/// indexing performance if more than one merge thread runs at
/// once (though on an SSD it was faster)
@@ -60,7 +60,7 @@ namespace Lucene.Net.Index
public const int DEFAULT_MAX_THREAD_COUNT = 1;
/// <summary>
- /// Default {@code maxMergeCount}. </summary>
+ /// Default <see cref="MaxMergeCount"/>. </summary>
public const int DEFAULT_MAX_MERGE_COUNT = 2;
// Max number of merge threads allowed to be running at
@@ -76,22 +76,22 @@ namespace Lucene.Net.Index
private int maxMergeCount = DEFAULT_MAX_MERGE_COUNT;
/// <summary>
- /// <seealso cref="Directory"/> that holds the index. </summary>
+ /// <see cref="Directory"/> that holds the index. </summary>
protected internal Directory m_dir;
/// <summary>
- /// <seealso cref="IndexWriter"/> that owns this instance. </summary>
+ /// <see cref="IndexWriter"/> that owns this instance. </summary>
protected internal IndexWriter m_writer;
/// <summary>
- /// How many <seealso cref="MergeThread"/>s have kicked off (this is use
- /// to name them).
+ /// How many <see cref="MergeThread"/>s have kicked off (this is use
+ /// to name them).
/// </summary>
protected internal int m_mergeThreadCount;
/// <summary>
/// Sole constructor, with all settings set to default
- /// values.
+ /// values.
/// </summary>
public ConcurrentMergeScheduler()
{
@@ -105,9 +105,9 @@ namespace Lucene.Net.Index
/// threads running, the incoming thread (that is calling
/// add/updateDocument) will block until a merge thread
/// has completed. Note that we will only run the
- /// smallest <code>maxThreadCount</code> merges at a time. </param>
- /// <param name="maxThreadCount"> the max # simultaneous merge threads that should
- /// be running at once. this must be <= <code>maxMergeCount</code> </param>
+ /// smallest <paramref name="maxThreadCount"/> merges at a time. </param>
+ /// <param name="maxThreadCount"> The max # simultaneous merge threads that should
+ /// be running at once. This must be <= <paramref name="maxMergeCount"/> </param>
public virtual void SetMaxMergesAndThreads(int maxMergeCount, int maxThreadCount)
{
if (maxThreadCount < 1)
@@ -127,9 +127,9 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// Returns {@code maxThreadCount}.
+ /// Returns <see cref="maxThreadCount"/>.
/// </summary>
- /// <seealso cref= #setMaxMergesAndThreads(int, int) </seealso>
+ /// <seealso cref="SetMaxMergesAndThreads(int, int)"/>
public virtual int MaxThreadCount
{
get
@@ -139,7 +139,7 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// See <seealso cref="#setMaxMergesAndThreads"/>. </summary>
+ /// See <see cref="SetMaxMergesAndThreads(int, int)"/>. </summary>
public virtual int MaxMergeCount
{
get
@@ -150,9 +150,9 @@ namespace Lucene.Net.Index
/// <summary>
/// Return the priority that merge threads run at. By
- /// default the priority is 1 plus the priority of (ie,
- /// slightly higher priority than) the first thread that
- /// calls merge.
+ /// default the priority is 1 plus the priority of (ie,
+ /// slightly higher priority than) the first thread that
+ /// calls merge.
/// </summary>
public virtual int MergeThreadPriority
{
@@ -188,7 +188,7 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// Sorts <seealso cref="MergeThread"/>s; larger merges come first. </summary>
+ /// Sorts <see cref="MergeThread"/>s; larger merges come first. </summary>
protected internal static readonly IComparer<MergeThread> compareByMergeDocCount = new ComparerAnonymousInnerClassHelper();
private class ComparerAnonymousInnerClassHelper : IComparer<MergeThread>
@@ -210,8 +210,8 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// Called whenever the running merges have changed, to pause & unpause
- /// threads. this method sorts the merge threads by their merge size in
+ /// Called whenever the running merges have changed, to pause & unpause
+ /// threads. This method sorts the merge threads by their merge size in
/// descending order and then pauses/unpauses threads from first to last --
/// that way, smaller merges are guaranteed to run before larger ones.
/// </summary>
@@ -290,14 +290,15 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// Returns true if verbosing is enabled. this method is usually used in
- /// conjunction with <seealso cref="#message(String)"/>, like that:
+ /// Returns <c>true</c> if verbosing is enabled. This method is usually used in
+ /// conjunction with <see cref="Message(String)"/>, like that:
///
- /// <pre class="prettyprint">
- /// if (verbose()) {
- /// message("your message");
+ /// <code>
+ /// if (IsVerbose)
+ /// {
+ /// Message("your message");
/// }
- /// </pre>
+ /// </code>
/// </summary>
protected virtual bool IsVerbose
{
@@ -305,8 +306,8 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// Outputs the given message - this method assumes <seealso cref="#verbose()"/> was
- /// called and returned true.
+ /// Outputs the given message - this method assumes <see cref="IsVerbose"/> was
+ /// called and returned <c>true</c>.
/// </summary>
protected internal virtual void Message(string message)
{
@@ -336,7 +337,7 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// Wait for any running merge threads to finish. this call is not interruptible as used by <seealso cref="#close()"/>. </summary>
+ /// Wait for any running merge threads to finish. This call is not interruptible as used by <see cref="Dispose(bool)"/>. </summary>
public virtual void Sync()
{
bool interrupted = false;
@@ -388,7 +389,7 @@ namespace Lucene.Net.Index
/// <summary>
/// Returns the number of merge threads that are alive. Note that this number
- /// is <= <seealso cref="#mergeThreads"/> size.
+ /// is <= <see cref="m_mergeThreads"/> size.
/// </summary>
protected virtual int MergeThreadCount
{
@@ -521,14 +522,14 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// Does the actual merge, by calling <seealso cref="IndexWriter#merge"/> </summary>
+ /// Does the actual merge, by calling <see cref="IndexWriter.Merge(MergePolicy.OneMerge)"/> </summary>
protected virtual void DoMerge(MergePolicy.OneMerge merge)
{
m_writer.Merge(merge);
}
/// <summary>
- /// Create and return a new MergeThread </summary>
+ /// Create and return a new <see cref="MergeThread"/> </summary>
protected virtual MergeThread GetMergeThread(IndexWriter writer, MergePolicy.OneMerge merge)
{
lock (this)
@@ -543,7 +544,7 @@ namespace Lucene.Net.Index
/// <summary>
/// Runs a merge thread, which may run one or more merges
- /// in sequence.
+ /// in sequence.
/// </summary>
protected internal class MergeThread : ThreadClass//System.Threading.Thread
{
@@ -584,8 +585,8 @@ namespace Lucene.Net.Index
}
/// <summary>
- /// Return the current merge, or null if this {@code
- /// MergeThread} is done.
+ /// Return the current merge, or <c>null</c> if this
+ /// <see cref="MergeThread"/> is done.
/// </summary>
public virtual MergePolicy.OneMerge CurrentMerge
{
@@ -709,7 +710,7 @@ namespace Lucene.Net.Index
/// <summary>
/// Called when an exception is hit in a background merge
- /// thread
+ /// thread
/// </summary>
protected virtual void HandleMergeException(Exception exc)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05c8b585/src/Lucene.Net.Core/Index/CorruptIndexException.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/CorruptIndexException.cs b/src/Lucene.Net.Core/Index/CorruptIndexException.cs
index c8fcc5f..7a0c565 100644
--- a/src/Lucene.Net.Core/Index/CorruptIndexException.cs
+++ b/src/Lucene.Net.Core/Index/CorruptIndexException.cs
@@ -21,7 +21,7 @@ namespace Lucene.Net.Index
*/
/// <summary>
- /// this exception is thrown when Lucene detects
+ /// This exception is thrown when Lucene detects
/// an inconsistency in the index.
/// </summary>
// LUCENENET: All exeption classes should be marked serializable
@@ -31,12 +31,14 @@ namespace Lucene.Net.Index
public class CorruptIndexException : IOException // LUCENENENET specific - made public instead of internal because there are public subclasses
{
/// <summary>
- /// Sole constructor. </summary>
+ /// Constructor. </summary>
public CorruptIndexException(string message)
: base(message)
{
}
+ /// <summary>
+ /// Constructor. </summary>
public CorruptIndexException(string message, Exception ex)
: base(message, ex)
{
[04/50] lucenenet git commit:
Lucene.Net.Queries.Mlt.MoreLikeThisQuery: Replaced GetValueHashCode() and
SequenceEqual() with Equatable.Wrap(ISet).GetHashCode() and
Equatable.Wrap(ISet).Equals() (to allow for the user to supply their own
type, since
Posted by ni...@apache.org.
Lucene.Net.Queries.Mlt.MoreLikeThisQuery: Replaced GetValueHashCode() and SequenceEqual() with Equatable.Wrap(ISet<T>).GetHashCode() and Equatable.Wrap(ISet<T>).Equals() (to allow for the user to supply their own type, since it is set via a property).
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/8eb46167
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/8eb46167
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/8eb46167
Branch: refs/heads/api-work
Commit: 8eb46167c015c789032f798b841f95e7b26a1661
Parents: b30fda1
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 05:49:21 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:27 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8eb46167/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs b/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs
index 87296e4..999cc7a 100644
--- a/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs
+++ b/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs
@@ -146,7 +146,8 @@ namespace Lucene.Net.Queries.Mlt
result = prime * result + minTermFrequency;
result = prime * result + Arrays.GetHashCode(moreLikeFields);
result = prime * result + Number.SingleToInt32Bits(percentTermsToMatch);
- result = prime * result + ((stopWords == null) ? 0 : stopWords.GetValueHashCode());
+ // LUCENENET: wrap in Equatable to compare set contents
+ result = prime * result + ((stopWords == null) ? 0 : Equatable.Wrap(stopWords).GetHashCode());
return result;
}
@@ -225,7 +226,8 @@ namespace Lucene.Net.Queries.Mlt
return false;
}
}
- else if (!stopWords.SetEquals(other.stopWords))
+ // LUCENENET: wrap in Equatable to compare set contents
+ else if (!Equatable.Wrap(stopWords).Equals(other.stopWords))
{
return false;
}
[20/50] lucenenet git commit: Lucene.Net.Grouping.SearchGroup: Fixed
Equals() and GetHashCode() to use Collections.Equals() for the generic type
in case it is a collection that needs its values compared
Posted by ni...@apache.org.
Lucene.Net.Grouping.SearchGroup: Fixed Equals() and GetHashCode() to use Collections.Equals() for the generic type in case it is a collection that needs its values compared
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/5c512dd5
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/5c512dd5
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/5c512dd5
Branch: refs/heads/api-work
Commit: 5c512dd5d23692b07d5b310d63f2661964b30e2a
Parents: d747e7a
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 08:19:47 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:32 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Grouping/SearchGroup.cs | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5c512dd5/src/Lucene.Net.Grouping/SearchGroup.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Grouping/SearchGroup.cs b/src/Lucene.Net.Grouping/SearchGroup.cs
index a5e6cd5..f9772d9 100644
--- a/src/Lucene.Net.Grouping/SearchGroup.cs
+++ b/src/Lucene.Net.Grouping/SearchGroup.cs
@@ -180,9 +180,17 @@ namespace Lucene.Net.Search.Grouping
}
private bool inQueue;
+ // LUCENENET specific - store whether T is value type
+ // for optimization of GetHashCode() and Equals()
+ private readonly bool groupValueIsValueType;
+
public MergedGroup(T groupValue)
{
this.groupValue = groupValue;
+
+ // LUCENENET specific - store whether T is value type
+ // for optimization of GetHashCode() and Equals()
+ this.groupValueIsValueType = typeof(T).IsValueType;
}
// Only for assert
@@ -197,7 +205,13 @@ namespace Lucene.Net.Search.Grouping
}
else
{
- Debug.Assert(!groupValue.Equals(otherMergedGroup.groupValue));
+
+ Debug.Assert(!groupValueIsValueType
+ ? groupValue.Equals(otherMergedGroup.groupValue)
+
+ // LUCENENET specific - use Collections.Equals() if we have a reference type
+ // to ensure if it is a collection its contents are compared
+ : Collections.Equals(groupValue, otherMergedGroup.groupValue));
}
}
return true;
@@ -218,7 +232,9 @@ namespace Lucene.Net.Search.Grouping
}
else
{
- return groupValue.Equals(otherMergedGroup);
+ // LUCENENET specific - use Collections.Equals() if we have a reference type
+ // to ensure if it is a collection its contents are compared
+ return groupValueIsValueType ? groupValue.Equals(otherMergedGroup) : Collections.Equals(groupValue, otherMergedGroup);
}
}
else
@@ -235,7 +251,9 @@ namespace Lucene.Net.Search.Grouping
}
else
{
- return groupValue.GetHashCode();
+ // LUCENENET specific - use Collections.GetHashCode() if we have a reference type
+ // to ensure if it is a collection its contents are compared
+ return groupValueIsValueType ? groupValue.GetHashCode() : Collections.GetHashCode(groupValue);
}
}
}
[22/50] lucenenet git commit: Lucene.Net.Core.Util.Fst.PairOutputs:
If the generic type is a reference type,
we use Collections.Equals() and Collections.GetHashCode() so its values are
compared if it happens to be a collection
Posted by ni...@apache.org.
Lucene.Net.Core.Util.Fst.PairOutputs: If the generic type is a reference type, we use Collections.Equals() and Collections.GetHashCode() so its values are compared if it happens to be a collection
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/d48493df
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/d48493df
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/d48493df
Branch: refs/heads/api-work
Commit: d48493df8ffd9afded38a4ee4660289270cc2679
Parents: 5c512dd
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 08:36:05 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:32 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Util/Fst/PairOutputs.cs | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d48493df/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs b/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
index 7ba14ac..c308940 100644
--- a/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
@@ -40,11 +40,21 @@ namespace Lucene.Net.Util.Fst
public A Output1 { get; private set; }
public B Output2 { get; private set; }
+ // LUCENENET specific - track whether we have value or reference types
+ // for optimization of Equals and GetHashCode()
+ private readonly bool output1IsValueType;
+ private readonly bool output2IsValueType;
+
// use newPair
internal Pair(A output1, B output2)
{
this.Output1 = output1;
this.Output2 = output2;
+
+ // LUCENENET specific - track whether we have value or reference types
+ // for optimization of Equals and GetHashCode()
+ this.output1IsValueType = typeof(A).IsValueType;
+ this.output2IsValueType = typeof(B).IsValueType;
}
public override bool Equals(object other)
@@ -56,7 +66,11 @@ namespace Lucene.Net.Util.Fst
else if (other is Pair)
{
var pair = (Pair)other;
- return Output1.Equals(pair.Output1) && Output2.Equals(pair.Output2);
+
+ // LUCENENET specific - if we have reference types, they might be collections that need to be compared
+ // as sets of values.
+ return output1IsValueType ? Output1.Equals(pair.Output1) : Collections.Equals(Output1, pair.Output1)
+ && output2IsValueType ? Output2.Equals(pair.Output2) : Collections.Equals(Output2, pair.Output2);
}
else
{
@@ -66,7 +80,10 @@ namespace Lucene.Net.Util.Fst
public override int GetHashCode()
{
- return Output1.GetHashCode() + Output2.GetHashCode();
+ // LUCENENET specific - if we have reference types, they might be collections that need to be compared
+ // as sets of values.
+ return (output1IsValueType ? Output1.GetHashCode() : Collections.GetHashCode(Output1))
+ + (output2IsValueType ? Output2.GetHashCode() : Collections.GetHashCode(Output2));
}
}
[24/50] lucenenet git commit:
Lucene.Net.Queries.Function.ValueSources.VectorValueSource: Use
Equatable.Wrap() to wrap the provided list in EquatableList for Equals() and
GetHashCode() comparisons
Posted by ni...@apache.org.
Lucene.Net.Queries.Function.ValueSources.VectorValueSource: Use Equatable.Wrap() to wrap the provided list in EquatableList for Equals() and GetHashCode() comparisons
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/ebfca98b
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/ebfca98b
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/ebfca98b
Branch: refs/heads/api-work
Commit: ebfca98baf213971875cc190fae0a832c0297ea2
Parents: c0a9ae6
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 08:39:30 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:33 2017 +0700
----------------------------------------------------------------------
.../Function/ValueSources/VectorValueSource.cs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebfca98b/src/Lucene.Net.Queries/Function/ValueSources/VectorValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/VectorValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/VectorValueSource.cs
index 90850d2..7cb5c58 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/VectorValueSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/VectorValueSource.cs
@@ -1,5 +1,6 @@
\ufeffusing Lucene.Net.Index;
using Lucene.Net.Search;
+using Lucene.Net.Support;
using System.Collections;
using System.Collections.Generic;
using System.Text;
@@ -290,12 +291,17 @@ namespace Lucene.Net.Queries.Function.ValueSources
}
var that = (VectorValueSource)o;
- return m_sources.Equals(that.m_sources);
+
+ // LUCENENET specific: ensure our passed in list is equatable by
+ // wrapping it in an EquatableList if it is not one already
+ return Equatable.Wrap(m_sources).Equals(that.m_sources);
}
public override int GetHashCode()
{
- return m_sources.GetHashCode();
+ // LUCENENET specific: ensure our passed in list is equatable by
+ // wrapping it in an EquatableList if it is not one already
+ return Equatable.Wrap(m_sources).GetHashCode();
}
}
}
\ No newline at end of file
[30/50] lucenenet git commit: Lucene.Net.Core.Support: Deleted
ValueHashSet and ValueList,
since they have been consolidated into EquatableSet and EquatableList
Posted by ni...@apache.org.
Lucene.Net.Core.Support: Deleted ValueHashSet and ValueList, since they have been consolidated into EquatableSet and EquatableList
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/f25215f5
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/f25215f5
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/f25215f5
Branch: refs/heads/api-work
Commit: f25215f5a81ad851304cc35ed1cc73324fbb6e43
Parents: 62160cd
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 09:25:40 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:25:40 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Lucene.Net.csproj | 2 -
src/Lucene.Net.Core/Support/ValueHashSet.cs | 71 ------------------------
src/Lucene.Net.Core/Support/ValueList.cs | 68 -----------------------
3 files changed, 141 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f25215f5/src/Lucene.Net.Core/Lucene.Net.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Lucene.Net.csproj b/src/Lucene.Net.Core/Lucene.Net.csproj
index 57211e0..622d7b3 100644
--- a/src/Lucene.Net.Core/Lucene.Net.csproj
+++ b/src/Lucene.Net.Core/Lucene.Net.csproj
@@ -710,8 +710,6 @@
<Compile Include="Support\Util\IServiceListable.cs" />
<Compile Include="Support\Util\NamedServiceFactory.cs" />
<Compile Include="Support\Util\ServiceNameAttribute.cs" />
- <Compile Include="Support\ValueHashSet.cs" />
- <Compile Include="Support\ValueList.cs" />
<Compile Include="Support\WeakDictionary.cs" />
<Compile Include="Support\WritableArrayAttribute.cs" />
<Compile Include="Util\Accountable.cs" />
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f25215f5/src/Lucene.Net.Core/Support/ValueHashSet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/ValueHashSet.cs b/src/Lucene.Net.Core/Support/ValueHashSet.cs
deleted file mode 100644
index 6227ae7..0000000
--- a/src/Lucene.Net.Core/Support/ValueHashSet.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-\ufeffusing System.Collections.Generic;
-using System.Runtime.Serialization;
-
-namespace Lucene.Net.Support
-{
- /// <summary>
- /// Java's HashSet is unlike .NET's in that its equals() and hashcode() methods
- /// are setup to compare the values of the sets, where in .NET we only check that
- /// the references are the same. <see cref="ValueHashSet{T}"/> acts more like the
- /// HashSet type in Java by comparing the sets for value equality.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <seealso cref="ValueList{T}"/>
- public class ValueHashSet<T> : HashSet<T>
- {
- public ValueHashSet()
- : base()
- { }
-
- public ValueHashSet(IEnumerable<T> collection)
- : base(collection)
- { }
-
- public ValueHashSet(IEqualityComparer<T> comparer)
- : base(comparer)
- { }
-
-#if FEATURE_SERIALIZABLE
- public ValueHashSet(SerializationInfo info, StreamingContext context)
- : base(info, context)
- { }
-#endif
-
- public ValueHashSet(IEnumerable<T> collection, IEqualityComparer<T> comparer)
- : base(collection, comparer)
- { }
-
-
- public override bool Equals(object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (!(obj is ISet<T>))
- return false;
- ICollection<T> c = obj as ICollection<T>;
- if (c.Count != Count)
- return false;
-
- // Check to ensure the sets values are the same
- return SetEquals(c);
- }
-
- public override int GetHashCode()
- {
- int h = 0;
- var i = GetEnumerator();
- while (i.MoveNext())
- {
- T obj = i.Current;
- if (!EqualityComparer<T>.Default.Equals(obj, default(T)))
- {
- h += obj.GetHashCode();
- }
- }
- return h;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f25215f5/src/Lucene.Net.Core/Support/ValueList.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/ValueList.cs b/src/Lucene.Net.Core/Support/ValueList.cs
deleted file mode 100644
index d67ce5c..0000000
--- a/src/Lucene.Net.Core/Support/ValueList.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-\ufeffusing System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Lucene.Net.Support
-{
- /// <summary>
- /// Java's ArrayList is unlike .NET's <see cref="List{T}"/> in that its equals() and hashcode() methods
- /// are setup to compare the values of the sets, where in .NET we only check that
- /// the references are the same. <see cref="ValueList{T}"/> acts more like the
- /// HashSet type in Java by comparing the sets for value equality.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <seealso cref="ValueHashSet{T}"/>
- public class ValueList<T> : List<T>
- {
- public ValueList()
- : base()
- { }
-
- public ValueList(int capacity)
- : base(capacity)
- { }
-
- public ValueList(IEnumerable<T> collection)
- : base(collection)
- { }
-
- public object Clone()
- {
- return new ValueList<T>(this);
- }
-
- public override bool Equals(object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (!(obj is List<T>))
- return false;
- ICollection<T> c = obj as ICollection<T>;
- if (c.Count != Count)
- return false;
-
- // Check to ensure the sets values are the same
- return this.SequenceEqual(c);
- }
-
- public override int GetHashCode()
- {
- int h = 0;
- var i = GetEnumerator();
- while (i.MoveNext())
- {
- T obj = i.Current;
- if (!EqualityComparer<T>.Default.Equals(obj, default(T)))
- {
- h += obj.GetHashCode();
- }
- }
- return h;
- }
- }
-}
[06/50] lucenenet git commit:
Lucene.Net.Core.Search.NGramPhraseQuery: Added Equatable.Wrap() to arrays,
since by default they do not produce the same value even if the contents are
the same
Posted by ni...@apache.org.
Lucene.Net.Core.Search.NGramPhraseQuery: Added Equatable.Wrap() to arrays, since by default they do not produce the same value even if the contents are the same
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/71fab05e
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/71fab05e
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/71fab05e
Branch: refs/heads/api-work
Commit: 71fab05e696d4dd243a76e00ade11c1c176f73c6
Parents: 3489bd1
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Mar 29 20:25:08 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:28 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Search/NGramPhraseQuery.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/71fab05e/src/Lucene.Net.Core/Search/NGramPhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/NGramPhraseQuery.cs b/src/Lucene.Net.Core/Search/NGramPhraseQuery.cs
index 38d1865..6bdbd87 100644
--- a/src/Lucene.Net.Core/Search/NGramPhraseQuery.cs
+++ b/src/Lucene.Net.Core/Search/NGramPhraseQuery.cs
@@ -110,8 +110,8 @@ namespace Lucene.Net.Search
{
return Number.SingleToInt32Bits(Boost)
^ Slop
- ^ GetTerms().GetHashCode()
- ^ GetPositions().GetHashCode()
+ ^ Equatable.Wrap(GetTerms()).GetHashCode()
+ ^ Equatable.Wrap(GetPositions()).GetHashCode()
^ n;
}
}
[49/50] lucenenet git commit: Lucene.Net.Core/Lucene.Net.Grouping:
Fixed issues with compilation in .NET Core
Posted by ni...@apache.org.
Lucene.Net.Core/Lucene.Net.Grouping: Fixed issues with compilation in .NET Core
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/1697106c
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/1697106c
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/1697106c
Branch: refs/heads/api-work
Commit: 1697106c964b5fa6171b253d13b6d03133378096
Parents: 05c8b58
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Fri Mar 31 00:03:03 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Fri Mar 31 00:03:03 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Support/Arrays.cs | 5 ++--
src/Lucene.Net.Core/Support/Collections.cs | 37 +++++++++++++------------
src/Lucene.Net.Core/Util/Fst/FST.cs | 3 +-
src/Lucene.Net.Core/Util/Fst/NodeHash.cs | 3 +-
src/Lucene.Net.Grouping/SearchGroup.cs | 7 ++---
5 files changed, 28 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1697106c/src/Lucene.Net.Core/Support/Arrays.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/Arrays.cs b/src/Lucene.Net.Core/Support/Arrays.cs
index bea165d..2e08542 100644
--- a/src/Lucene.Net.Core/Support/Arrays.cs
+++ b/src/Lucene.Net.Core/Support/Arrays.cs
@@ -1,6 +1,7 @@
\ufeffusing System;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection;
namespace Lucene.Net.Support
{
@@ -12,7 +13,7 @@ namespace Lucene.Net.Support
return 0;
int result = 1;
- bool isValueType = typeof(T).IsValueType;
+ bool isValueType = typeof(T).GetTypeInfo().IsValueType;
foreach (var item in a)
{
@@ -99,7 +100,7 @@ namespace Lucene.Net.Support
{
return true;
}
- bool isValueType = typeof(T).IsValueType;
+ bool isValueType = typeof(T).GetTypeInfo().IsValueType;
if (!isValueType && a == null)
{
return b == null;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1697106c/src/Lucene.Net.Core/Support/Collections.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/Collections.cs b/src/Lucene.Net.Core/Support/Collections.cs
index 4abd26b..5e4affc 100644
--- a/src/Lucene.Net.Core/Support/Collections.cs
+++ b/src/Lucene.Net.Core/Support/Collections.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
+using System.Reflection;
using System.Runtime.Serialization;
using System.Text;
@@ -117,7 +118,7 @@ namespace Lucene.Net
public static int GetHashCode<T>(IList<T> list)
{
int hashCode = 1;
- bool isValueType = typeof(T).IsValueType;
+ bool isValueType = typeof(T).GetTypeInfo().IsValueType;
foreach (T e in list)
{
hashCode = 31 * hashCode +
@@ -141,7 +142,7 @@ namespace Lucene.Net
public static int GetHashCode<T>(ISet<T> set)
{
int h = 0;
- bool isValueType = typeof(T).IsValueType;
+ bool isValueType = typeof(T).GetTypeInfo().IsValueType;
using (var i = set.GetEnumerator())
{
while (i.MoveNext())
@@ -174,8 +175,8 @@ namespace Lucene.Net
public static int GetHashCode<TKey, TValue>(IDictionary<TKey, TValue> dictionary)
{
int h = 0;
- bool keyIsValueType = typeof(TKey).IsValueType;
- bool valueIsValueType = typeof(TValue).IsValueType;
+ bool keyIsValueType = typeof(TKey).GetTypeInfo().IsValueType;
+ bool valueIsValueType = typeof(TValue).GetTypeInfo().IsValueType;
using (var i = dictionary.GetEnumerator())
{
while (i.MoveNext())
@@ -211,7 +212,7 @@ namespace Lucene.Net
}
Type t = obj.GetType();
- if (t.IsGenericType
+ if (t.GetTypeInfo().IsGenericType
&& (t.ImplementsGenericInterface(typeof(IList<>))
|| t.ImplementsGenericInterface(typeof(ISet<>))
|| t.ImplementsGenericInterface(typeof(IDictionary<,>))))
@@ -241,7 +242,7 @@ namespace Lucene.Net
return true;
}
- bool isValueType = typeof(T).IsValueType;
+ bool isValueType = typeof(T).GetTypeInfo().IsValueType;
if (!isValueType && listA == null)
{
@@ -307,7 +308,7 @@ namespace Lucene.Net
return false;
}
- bool isValueType = typeof(T).IsValueType;
+ bool isValueType = typeof(T).GetTypeInfo().IsValueType;
// same operation as containsAll()
foreach (T eB in setB)
@@ -362,7 +363,7 @@ namespace Lucene.Net
return false;
}
- bool valueIsValueType = typeof(TValue).IsValueType;
+ bool valueIsValueType = typeof(TValue).GetTypeInfo().IsValueType;
using (var i = dictionaryB.GetEnumerator())
{
@@ -416,13 +417,13 @@ namespace Lucene.Net
Type tA = objA.GetType();
Type tB = objB.GetType();
- if (tA.IsGenericType)
+ if (tA.GetTypeInfo().IsGenericType)
{
bool shouldReturn = false;
if (tA.ImplementsGenericInterface(typeof(IList<>)))
{
- if (!(tB.IsGenericType && tB.ImplementsGenericInterface(typeof(IList<>))))
+ if (!(tB.GetTypeInfo().IsGenericType && tB.ImplementsGenericInterface(typeof(IList<>))))
{
return false; // type mismatch - must be a list
}
@@ -430,7 +431,7 @@ namespace Lucene.Net
}
else if (tA.ImplementsGenericInterface(typeof(ISet<>)))
{
- if (!(tB.IsGenericType && tB.ImplementsGenericInterface(typeof(ISet<>))))
+ if (!(tB.GetTypeInfo().IsGenericType && tB.ImplementsGenericInterface(typeof(ISet<>))))
{
return false; // type mismatch - must be a set
}
@@ -438,7 +439,7 @@ namespace Lucene.Net
}
else if (tA.ImplementsGenericInterface(typeof(IDictionary<,>)))
{
- if (!(tB.IsGenericType && tB.ImplementsGenericInterface(typeof(IDictionary<,>))))
+ if (!(tB.GetTypeInfo().IsGenericType && tB.ImplementsGenericInterface(typeof(IDictionary<,>))))
{
return false; // type mismatch - must be a dictionary
}
@@ -459,8 +460,8 @@ namespace Lucene.Net
// LUCENENET TODO: Move to a new TypeExtensions class
private static bool ImplementsGenericInterface(this Type target, Type interfaceType)
{
- return target.IsGenericType && target.GetGenericTypeDefinition().GetInterfaces().Any(
- x => x.IsGenericType && interfaceType.IsAssignableFrom(x.GetGenericTypeDefinition())
+ return target.GetTypeInfo().IsGenericType && target.GetGenericTypeDefinition().GetInterfaces().Any(
+ x => x.GetTypeInfo().IsGenericType && interfaceType.IsAssignableFrom(x.GetGenericTypeDefinition())
);
}
@@ -476,7 +477,7 @@ namespace Lucene.Net
return "[]";
}
- bool isValueType = typeof(T).IsValueType;
+ bool isValueType = typeof(T).GetTypeInfo().IsValueType;
using (var it = collection.GetEnumerator())
{
StringBuilder sb = new StringBuilder();
@@ -520,8 +521,8 @@ namespace Lucene.Net
return "{}";
}
- bool keyIsValueType = typeof(TKey).IsValueType;
- bool valueIsValueType = typeof(TValue).IsValueType;
+ bool keyIsValueType = typeof(TKey).GetTypeInfo().IsValueType;
+ bool valueIsValueType = typeof(TValue).GetTypeInfo().IsValueType;
using (var i = dictionary.GetEnumerator())
{
StringBuilder sb = new StringBuilder();
@@ -565,7 +566,7 @@ namespace Lucene.Net
public static string ToString(object obj)
{
Type t = obj.GetType();
- if (t.IsGenericType
+ if (t.GetTypeInfo().IsGenericType
&& (t.ImplementsGenericInterface(typeof(ICollection<>)))
|| t.ImplementsGenericInterface(typeof(IDictionary<,>)))
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1697106c/src/Lucene.Net.Core/Util/Fst/FST.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/FST.cs b/src/Lucene.Net.Core/Util/Fst/FST.cs
index 3319bc3..46a4966 100644
--- a/src/Lucene.Net.Core/Util/Fst/FST.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FST.cs
@@ -4,6 +4,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
+using System.Reflection;
using System.Text;
namespace Lucene.Net.Util.Fst
@@ -449,7 +450,7 @@ namespace Lucene.Net.Util.Fst
// LUCENENET NOTE: In .NET, IEnumerable will not equal another identical IEnumerable
// because it checks for reference equality, not that the list contents
// are the same. Collections.Equals() will make that check.
- Debug.Assert(typeof(T).IsValueType
+ Debug.Assert(typeof(T).GetTypeInfo().IsValueType
? root.NextFinalOutput.Equals(asserting.NextFinalOutput)
: Collections.Equals(root.NextFinalOutput, asserting.NextFinalOutput));
Debug.Assert(root.Node == asserting.Node);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1697106c/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
index 207fa04..ef8672c 100644
--- a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
+++ b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
@@ -1,5 +1,6 @@
using Lucene.Net.Support;
using System.Diagnostics;
+using System.Reflection;
namespace Lucene.Net.Util.Fst
{
@@ -37,7 +38,7 @@ namespace Lucene.Net.Util.Fst
// LUCENENET specific - optimize the Hash methods
// by only calling Collections.GetHashCode() if the value is a reference type
- private readonly bool tIsValueType = typeof(T).IsValueType;
+ private readonly static bool tIsValueType = typeof(T).GetTypeInfo().IsValueType;
public NodeHash(FST<T> fst, FST.BytesReader input)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1697106c/src/Lucene.Net.Grouping/SearchGroup.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Grouping/SearchGroup.cs b/src/Lucene.Net.Grouping/SearchGroup.cs
index f9772d9..b08d748 100644
--- a/src/Lucene.Net.Grouping/SearchGroup.cs
+++ b/src/Lucene.Net.Grouping/SearchGroup.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
+using System.Reflection;
namespace Lucene.Net.Search.Grouping
{
@@ -182,15 +183,11 @@ namespace Lucene.Net.Search.Grouping
// LUCENENET specific - store whether T is value type
// for optimization of GetHashCode() and Equals()
- private readonly bool groupValueIsValueType;
+ private readonly static bool groupValueIsValueType = typeof(T).GetTypeInfo().IsValueType;
public MergedGroup(T groupValue)
{
this.groupValue = groupValue;
-
- // LUCENENET specific - store whether T is value type
- // for optimization of GetHashCode() and Equals()
- this.groupValueIsValueType = typeof(T).IsValueType;
}
// Only for assert
[13/50] lucenenet git commit: Lucene.Net.Queries.BooleanFilter:
Changed clauses to use EquatableList
Posted by ni...@apache.org.
Lucene.Net.Queries.BooleanFilter: Changed clauses to use EquatableList<T>
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/cf3c6ecd
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/cf3c6ecd
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/cf3c6ecd
Branch: refs/heads/api-work
Commit: cf3c6ecdd864329baf21aebd6755f7b980696218
Parents: 46418a4
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Mar 29 21:38:04 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:30 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Queries/BooleanFilter.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/cf3c6ecd/src/Lucene.Net.Queries/BooleanFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/BooleanFilter.cs b/src/Lucene.Net.Queries/BooleanFilter.cs
index fdcc15f..da24d16 100644
--- a/src/Lucene.Net.Queries/BooleanFilter.cs
+++ b/src/Lucene.Net.Queries/BooleanFilter.cs
@@ -1,5 +1,6 @@
\ufeffusing Lucene.Net.Index;
using Lucene.Net.Search;
+using Lucene.Net.Support;
using Lucene.Net.Util;
using System.Collections;
using System.Collections.Generic;
@@ -36,7 +37,7 @@ namespace Lucene.Net.Queries
/// </summary>
public class BooleanFilter : Filter, IEnumerable<FilterClause>
{
- private readonly IList<FilterClause> clauses = new List<FilterClause>();
+ private readonly IList<FilterClause> clauses = new EquatableList<FilterClause>();
/// <summary>
/// Returns the a <see cref="DocIdSetIterator"/> representing the Boolean composition
[35/50] lucenenet git commit: Revert
"Lucene.Net.Core.Util.Fst.PairOutputs: If the generic type is a reference
type,
we use Collections.Equals() and Collections.GetHashCode() so its values are
compared if it happens to be a collection"
Posted by ni...@apache.org.
Revert "Lucene.Net.Core.Util.Fst.PairOutputs: If the generic type is a reference type, we use Collections.Equals() and Collections.GetHashCode() so its values are compared if it happens to be a collection"
This reverts commit d48493df8ffd9afded38a4ee4660289270cc2679.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/6c9a3c6b
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/6c9a3c6b
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/6c9a3c6b
Branch: refs/heads/api-work
Commit: 6c9a3c6b0ecc045bb2881e0b3c68492200d028bd
Parents: d0c2c10
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 13:04:58 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 13:04:58 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Util/Fst/PairOutputs.cs | 21 ++-------------------
1 file changed, 2 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6c9a3c6b/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs b/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
index c308940..7ba14ac 100644
--- a/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
@@ -40,21 +40,11 @@ namespace Lucene.Net.Util.Fst
public A Output1 { get; private set; }
public B Output2 { get; private set; }
- // LUCENENET specific - track whether we have value or reference types
- // for optimization of Equals and GetHashCode()
- private readonly bool output1IsValueType;
- private readonly bool output2IsValueType;
-
// use newPair
internal Pair(A output1, B output2)
{
this.Output1 = output1;
this.Output2 = output2;
-
- // LUCENENET specific - track whether we have value or reference types
- // for optimization of Equals and GetHashCode()
- this.output1IsValueType = typeof(A).IsValueType;
- this.output2IsValueType = typeof(B).IsValueType;
}
public override bool Equals(object other)
@@ -66,11 +56,7 @@ namespace Lucene.Net.Util.Fst
else if (other is Pair)
{
var pair = (Pair)other;
-
- // LUCENENET specific - if we have reference types, they might be collections that need to be compared
- // as sets of values.
- return output1IsValueType ? Output1.Equals(pair.Output1) : Collections.Equals(Output1, pair.Output1)
- && output2IsValueType ? Output2.Equals(pair.Output2) : Collections.Equals(Output2, pair.Output2);
+ return Output1.Equals(pair.Output1) && Output2.Equals(pair.Output2);
}
else
{
@@ -80,10 +66,7 @@ namespace Lucene.Net.Util.Fst
public override int GetHashCode()
{
- // LUCENENET specific - if we have reference types, they might be collections that need to be compared
- // as sets of values.
- return (output1IsValueType ? Output1.GetHashCode() : Collections.GetHashCode(Output1))
- + (output2IsValueType ? Output2.GetHashCode() : Collections.GetHashCode(Output2));
+ return Output1.GetHashCode() + Output2.GetHashCode();
}
}
[03/50] lucenenet git commit:
Lucene.Net.Sandbox.Queries.FuzzyLikeThisQuery: replaced weird iterator loop
with foreach to ensure Dispose() is called.
Posted by ni...@apache.org.
Lucene.Net.Sandbox.Queries.FuzzyLikeThisQuery: replaced weird iterator loop with foreach to ensure Dispose() is called.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/44bba1b5
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/44bba1b5
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/44bba1b5
Branch: refs/heads/api-work
Commit: 44bba1b584424d3a12efe71c0cb43979c4745f79
Parents: 8eb4616
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Mar 29 19:13:10 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:27 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/44bba1b5/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs b/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs
index f3e7ff0..d866954 100644
--- a/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs
+++ b/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs
@@ -276,9 +276,8 @@ namespace Lucene.Net.Sandbox.Queries
return rewrittenQuery;
}
//load up the list of possible terms
- for (IEnumerator<FieldVals> iter = fieldVals.GetEnumerator(); iter.MoveNext();)
+ foreach (var f in fieldVals)
{
- FieldVals f = iter.Current;
AddTerms(reader, f);
}
//clear the list of fields
[09/50] lucenenet git commit: Lucene.Net.Core.Search.SpanNearQuery:
Changed ValueList to EquatableList
Posted by ni...@apache.org.
Lucene.Net.Core.Search.SpanNearQuery: Changed ValueList<T> to EquatableList<T>
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/4a4f4020
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/4a4f4020
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/4a4f4020
Branch: refs/heads/api-work
Commit: 4a4f4020182714d7f08e749e08cd425971874c8a
Parents: 137e431
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Mar 29 21:04:06 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:29 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Search/Spans/SpanNearQuery.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4a4f4020/src/Lucene.Net.Core/Search/Spans/SpanNearQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Spans/SpanNearQuery.cs b/src/Lucene.Net.Core/Search/Spans/SpanNearQuery.cs
index 00b038a..630c478 100644
--- a/src/Lucene.Net.Core/Search/Spans/SpanNearQuery.cs
+++ b/src/Lucene.Net.Core/Search/Spans/SpanNearQuery.cs
@@ -61,7 +61,7 @@ namespace Lucene.Net.Search.Spans
public SpanNearQuery(SpanQuery[] clauses, int slop, bool inOrder, bool collectPayloads)
{
// copy clauses array into an ArrayList
- this.m_clauses = new ValueList<SpanQuery>(clauses.Length);
+ this.m_clauses = new EquatableList<SpanQuery>(clauses.Length);
for (int i = 0; i < clauses.Length; i++)
{
SpanQuery clause = clauses[i];
[21/50] lucenenet git commit: BUG:
Lucene.Net.Core.Util.FieldCacheSanityChecker: Corrected behavior to use
RuntimeHelpers.GetHashCode() to get the identity hash code of val
Posted by ni...@apache.org.
BUG: Lucene.Net.Core.Util.FieldCacheSanityChecker: Corrected behavior to use RuntimeHelpers.GetHashCode() to get the identity hash code of val
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/d747e7a4
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/d747e7a4
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/d747e7a4
Branch: refs/heads/api-work
Commit: d747e7a4d01c7a8ce8686b1c76478209b2707ca6
Parents: a701b99
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 08:17:43 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:32 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d747e7a4/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs b/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
index 9d3d6f4..f42d53a 100644
--- a/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
+++ b/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
@@ -144,7 +144,7 @@ namespace Lucene.Net.Util
ReaderField rf = new ReaderField(item.ReaderKey, item.FieldName);
- int valId = val.GetHashCode();
+ int valId = RuntimeHelpers.GetHashCode(val);
// indirect mapping, so the MapOfSet will dedup identical valIds for us
valIdToItems.Put(valId, item);
@@ -348,7 +348,8 @@ namespace Lucene.Net.Util
}
ReaderField other = (ReaderField)that;
- return (this.readerKey == other.readerKey && this.FieldName.Equals(other.FieldName, StringComparison.Ordinal));
+ return (object.ReferenceEquals(this.readerKey, other.readerKey)
+ && this.FieldName.Equals(other.FieldName, StringComparison.Ordinal));
}
public override string ToString()
[38/50] lucenenet git commit:
Lucene.Net.Analysis.Common.Analysis.Util.CharArraySet: Added Equals() and
GetHashCode() methods (that in Java were inherited from AbstractSet)
Posted by ni...@apache.org.
Lucene.Net.Analysis.Common.Analysis.Util.CharArraySet: Added Equals() and GetHashCode() methods (that in Java were inherited from AbstractSet<T>)
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/2fe688d2
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/2fe688d2
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/2fe688d2
Branch: refs/heads/api-work
Commit: 2fe688d2e7d1a3fbf0d9fa62bf5c3bb055ef65f0
Parents: 71318f0
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 16:27:32 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 16:27:32 2017 +0700
----------------------------------------------------------------------
.../Analysis/Util/CharArraySet.cs | 34 +++++++++++
.../Analysis/Util/TestCharArraySet.cs | 63 +++++++++++++++-----
2 files changed, 82 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2fe688d2/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs
index 97bab79..dab73b0 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArraySet.cs
@@ -324,6 +324,40 @@ namespace Lucene.Net.Analysis.Util
#region LUCENENET specific members
/// <summary>
+ /// Compares the specified object with this set for equality. Returns <c>true</c> if the
+ /// given object is also a set, the two sets have the same size, and every member of the
+ /// given set is contained in this set. This ensures that the equals method works properly
+ /// across different implementations of the <see cref="T:ISet{string}"/> interface.
+ /// <para/>
+ /// This implementation first checks if the specified object is this set; if so it
+ /// returns <c>true</c>. Then, it checks if the specified object is a set whose
+ /// size is identical to the size of this set; if not, it returns <c>false</c>. If so,
+ /// it uses the enumerator of this set and the specified object to determine if all of the
+ /// contained values are present (using <see cref="string.Equals(string)"/>).
+ /// </summary>
+ /// <param name="obj">object to be compared for equality with this set</param>
+ /// <returns><c>true</c> if the specified object is equal to this set</returns>
+ public override bool Equals(object obj)
+ {
+ return Collections.Equals(this, obj as ISet<string>);
+ }
+
+ /// <summary>
+ /// Returns the hash code value for this set. The hash code of a set
+ /// is defined to be the sum of the hash codes of the elements in the
+ /// set, where the hash code of a <c>null</c> element is defined to be zero.
+ /// This ensures that <c>s1.Equals(s2)</c> implies that
+ /// <c>s1.GetHashCode()==s2.GetHashCode()</c> for any two sets s1 and s2.
+ /// This implementation iterates over the set, calling the GetHashCode()
+ /// method on each element in the set, and adding up the results.
+ /// </summary>
+ /// <returns>the hash code value for this set</returns>
+ public override int GetHashCode()
+ {
+ return Collections.GetHashCode(this);
+ }
+
+ /// <summary>
/// Copies the entire <see cref="CharArraySet"/> to a one-dimensional <see cref="T:string[]"/> array,
/// starting at the specified index of the target array.
/// </summary>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2fe688d2/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArraySet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArraySet.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArraySet.cs
index 5e80536..df04154 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArraySet.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestCharArraySet.cs
@@ -1,4 +1,4 @@
-\ufeffusing Lucene.Net.Analysis.Util;
+\ufeffusing Lucene.Net.Attributes;
using Lucene.Net.Support;
using Lucene.Net.Util;
using NUnit.Framework;
@@ -643,7 +643,40 @@ namespace Lucene.Net.Analysis.Util
#region LUCENENET specific tests
- [Test]
+ [Test, LuceneNetSpecific]
+ public virtual void TestEquality()
+ {
+ var values = new List<string> { "sally", "sells", "seashells", "by", "the", "sea", "shore" };
+ var charArraySet = new CharArraySet(TEST_VERSION_CURRENT, values, false);
+ var charArraySetCopy = new CharArraySet(TEST_VERSION_CURRENT, values, false);
+ values.Reverse();
+ var charArraySetReverse = new CharArraySet(TEST_VERSION_CURRENT, values, false);
+ var equatableSetReverse = new EquatableSet<string>(values);
+
+ assertTrue(charArraySet.GetHashCode().Equals(charArraySetCopy.GetHashCode()));
+ assertTrue(charArraySet.Equals(charArraySetCopy));
+ assertTrue(charArraySet.GetHashCode().Equals(charArraySetReverse.GetHashCode()));
+ assertTrue(charArraySet.Equals(charArraySetReverse));
+ assertTrue(charArraySet.GetHashCode().Equals(equatableSetReverse.GetHashCode()));
+ assertTrue(charArraySet.Equals(equatableSetReverse));
+
+ values = new List<string> { "sally", "seashells", "by", "the", "sea", "shore" };
+ charArraySet.Clear();
+ charArraySet.AddAll(values);
+
+ assertFalse(charArraySet.GetHashCode().Equals(charArraySetCopy.GetHashCode()));
+ assertFalse(charArraySet.Equals(charArraySetCopy));
+ assertFalse(charArraySet.GetHashCode().Equals(charArraySetReverse.GetHashCode()));
+ assertFalse(charArraySet.Equals(charArraySetReverse));
+ assertFalse(charArraySet.GetHashCode().Equals(equatableSetReverse.GetHashCode()));
+ assertFalse(charArraySet.Equals(equatableSetReverse));
+
+ equatableSetReverse.Remove("sells");
+ assertTrue(charArraySet.GetHashCode().Equals(equatableSetReverse.GetHashCode()));
+ assertTrue(charArraySet.Equals(equatableSetReverse));
+ }
+
+ [Test, LuceneNetSpecific]
public virtual void TestUnionWithObject()
{
var originalValues = new string[] { "sally", "sells", "seashells", "by", "the", "sea", "shore" };
@@ -686,7 +719,7 @@ namespace Lucene.Net.Analysis.Util
assertTrue(target.Contains(new StringCharSequenceWrapper("testing")));
}
- [Test]
+ [Test, LuceneNetSpecific]
public virtual void TestUnionWithCharArray()
{
var originalValues = new string[] { "sally", "sells", "seashells", "by", "the", "sea", "shore" };
@@ -706,7 +739,7 @@ namespace Lucene.Net.Analysis.Util
"true", "set", "of", "unique", "values", "except"}, target);
}
- [Test]
+ [Test, LuceneNetSpecific]
public virtual void TestUnionWithString()
{
var originalValues = new string[] { "sally", "sells", "seashells", "by", "the", "sea", "shore" };
@@ -728,7 +761,7 @@ namespace Lucene.Net.Analysis.Util
"true", "set", "of", "unique", "values", "except"}, target);
}
- [Test]
+ [Test, LuceneNetSpecific]
public virtual void TestUnionWithCharSequence()
{
var originalValues = new string[] { "sally", "sells", "seashells", "by", "the", "sea", "shore" };
@@ -748,7 +781,7 @@ namespace Lucene.Net.Analysis.Util
"true", "set", "of", "unique", "values", "except"}, target);
}
- [Test]
+ [Test, LuceneNetSpecific]
public virtual void TestIsSubsetOfString()
{
var originalValues = new string[] { "sally", "sells", "seashells", "by", "the", "sea", "shore" };
@@ -761,7 +794,7 @@ namespace Lucene.Net.Analysis.Util
assertTrue(target.IsSubsetOf(originalValues));
}
- [Test]
+ [Test, LuceneNetSpecific]
public virtual void TestIsSubsetOfObject()
{
var originalValues = new string[] { "sally", "sells", "seashells", "by", "the", "sea", "shore" };
@@ -774,7 +807,7 @@ namespace Lucene.Net.Analysis.Util
assertTrue(target.IsSubsetOf(originalValues));
}
- [Test]
+ [Test, LuceneNetSpecific]
public virtual void TestIsProperSubsetOfString()
{
var originalValues = new string[] { "sally", "sells", "seashells", "by", "the", "sea", "shore" };
@@ -787,7 +820,7 @@ namespace Lucene.Net.Analysis.Util
assertFalse(target.IsProperSubsetOf(originalValues));
}
- [Test]
+ [Test, LuceneNetSpecific]
public virtual void TestIsProperSubsetOfObject()
{
var originalValues = new string[] { "sally", "sells", "seashells", "by", "the", "sea", "shore" };
@@ -800,7 +833,7 @@ namespace Lucene.Net.Analysis.Util
assertFalse(target.IsProperSubsetOf(originalValues));
}
- [Test]
+ [Test, LuceneNetSpecific]
public virtual void TestIsSupersetOfString()
{
var originalValues = new string[] { "sally", "sells", "seashells", "by", "the", "sea", "shore" };
@@ -813,7 +846,7 @@ namespace Lucene.Net.Analysis.Util
assertTrue(target.IsSupersetOf(originalValues));
}
- [Test]
+ [Test, LuceneNetSpecific]
public virtual void TestIsSupersetOfObject()
{
var originalValues = new string[] { "sally", "sells", "seashells", "by", "the", "sea", "shore" };
@@ -826,7 +859,7 @@ namespace Lucene.Net.Analysis.Util
assertTrue(target.IsSupersetOf(originalValues));
}
- [Test]
+ [Test, LuceneNetSpecific]
public virtual void TestIsProperSupersetOfString()
{
var originalValues = new string[] { "sally", "sells", "seashells", "by", "the", "sea", "shore" };
@@ -839,7 +872,7 @@ namespace Lucene.Net.Analysis.Util
assertFalse(target.IsProperSupersetOf(originalValues));
}
- [Test]
+ [Test, LuceneNetSpecific]
public virtual void TestIsProperSupersetOfObject()
{
var originalValues = new string[] { "sally", "sells", "seashells", "by", "the", "sea", "shore" };
@@ -852,7 +885,7 @@ namespace Lucene.Net.Analysis.Util
assertFalse(target.IsProperSupersetOf(originalValues));
}
- [Test]
+ [Test, LuceneNetSpecific]
public virtual void TestOverlapsString()
{
var originalValues = new string[] { "sally", "sells", "seashells", "by", "the", "sea", "shore" };
@@ -865,7 +898,7 @@ namespace Lucene.Net.Analysis.Util
assertTrue(target.Overlaps(originalValues));
}
- [Test]
+ [Test, LuceneNetSpecific]
public virtual void TestOverlapsObject()
{
var originalValues = new string[] { "sally", "sells", "seashells", "by", "the", "sea", "shore" };
[27/50] lucenenet git commit:
Lucene.Net.Queries.Function.ValueSources.EnumFieldSource: Use
Collections.Equals() and Collections.GetHashCode() to compare the
dictionaries
Posted by ni...@apache.org.
Lucene.Net.Queries.Function.ValueSources.EnumFieldSource: Use Collections.Equals() and Collections.GetHashCode() to compare the dictionaries
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/d21dd797
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/d21dd797
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/d21dd797
Branch: refs/heads/api-work
Commit: d21dd7971e9955305614d2fcb6154b64bbd0453b
Parents: 39333d0
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 09:09:06 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:52 2017 +0700
----------------------------------------------------------------------
.../Function/ValueSources/EnumFieldSource.cs | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d21dd797/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs
index 4dd4c02..532155c 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs
@@ -309,11 +309,14 @@ namespace Lucene.Net.Queries.Function.ValueSources
EnumFieldSource that = (EnumFieldSource)o;
- if (!enumIntToStringMap.Equals(that.enumIntToStringMap))
+ // LUCENENET TODO: Make an EquatableDictionary so we can use Equatable.Wrap() here ?
+ // LUCENENET specific: must use Collections.Equals() to ensure values
+ // contained within the dictionaries are compared for equality
+ if (!Collections.Equals(enumIntToStringMap, that.enumIntToStringMap))
{
return false;
}
- if (!enumStringToIntMap.Equals(that.enumStringToIntMap))
+ if (!Collections.Equals(enumStringToIntMap, that.enumStringToIntMap))
{
return false;
}
@@ -329,8 +332,11 @@ namespace Lucene.Net.Queries.Function.ValueSources
{
int result = base.GetHashCode();
result = 31 * result + parser.GetHashCode();
- result = 31 * result + enumIntToStringMap.GetHashCode();
- result = 31 * result + enumStringToIntMap.GetHashCode();
+ // LUCENENET TODO: Make an EquatableDictionary so we can use Equatable.Wrap() here ?
+ // LUCENENET specific: must use Collections.GetHashCode() to ensure values
+ // contained within the dictionaries are compared for equality
+ result = 31 * result + Collections.GetHashCode(enumIntToStringMap);
+ result = 31 * result + Collections.GetHashCode(enumStringToIntMap);
return result;
}
}
[46/50] lucenenet git commit: Lucene.Net.Tests.Index.TestAddIndexes:
added DirectoryNotFoundException to the exceptions to be checked for
Posted by ni...@apache.org.
Lucene.Net.Tests.Index.TestAddIndexes: added DirectoryNotFoundException to the exceptions to be checked for
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/76efed0d
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/76efed0d
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/76efed0d
Branch: refs/heads/api-work
Commit: 76efed0d3b036e3e810d35b8d320facb68a99a1b
Parents: 362133a
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 20:00:49 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 20:00:49 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Tests/Index/TestAddIndexes.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/76efed0d/src/Lucene.Net.Tests/Index/TestAddIndexes.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestAddIndexes.cs b/src/Lucene.Net.Tests/Index/TestAddIndexes.cs
index 8436220..27b87d4 100644
--- a/src/Lucene.Net.Tests/Index/TestAddIndexes.cs
+++ b/src/Lucene.Net.Tests/Index/TestAddIndexes.cs
@@ -955,7 +955,9 @@ namespace Lucene.Net.Index
{
report = !DidClose;
}
- else if (t is FileNotFoundException/* || t is NoSuchFileException*/)
+ // LUCENENET specific - since NoSuchDirectoryException subclasses FileNotFoundException
+ // in Lucene, we need to handle it here to be on the safe side.
+ else if (t is FileNotFoundException/* || t is NoSuchFileException*/ || t is DirectoryNotFoundException)
{
report = !DidClose;
}
[39/50] lucenenet git commit: Lucene.Net.Core.Store.Lock.With:
Changed return type to be generic instead of object
Posted by ni...@apache.org.
Lucene.Net.Core.Store.Lock.With: Changed return type to be generic instead of object
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/d850d553
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/d850d553
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/d850d553
Branch: refs/heads/api-work
Commit: d850d553f7617ce79ed35ffdf1b690f5aebb65b2
Parents: 2fe688d
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 16:40:39 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 16:40:39 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Store/Lock.cs | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d850d553/src/Lucene.Net.Core/Store/Lock.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/Lock.cs b/src/Lucene.Net.Core/Store/Lock.cs
index 2ad477b..c3c66f8 100644
--- a/src/Lucene.Net.Core/Store/Lock.cs
+++ b/src/Lucene.Net.Core/Store/Lock.cs
@@ -25,12 +25,13 @@ namespace Lucene.Net.Store
/// <para/>Typical use might look like:
///
/// <code>
- /// var result = Lock.With.NewAnonymous(
+ /// var result = Lock.With.NewAnonymous<string>(
/// @lock: directory.MakeLock("my.lock"),
/// lockWaitTimeout: Lock.LOCK_OBTAIN_WAIT_FOREVER,
/// doBody: () =>
/// {
/// //... code to execute while locked ...
+ /// return "the result";
/// }).Run();
/// </code>
/// </summary>
@@ -55,17 +56,19 @@ namespace Lucene.Net.Store
/// <para/>
/// Simple example:
/// <code>
- /// var result = Lock.With.NewAnonymous(
+ /// var result = Lock.With.NewAnonymous<string>(
/// @lock: directory.MakeLock("my.lock"),
/// lockWaitTimeout: Lock.LOCK_OBTAIN_WAIT_FOREVER,
/// doBody: () =>
/// {
/// //... code to execute while locked ...
+ /// return "the result";
/// }).Run();
/// </code>
/// <para/>
/// The result of the operation is the value that is returned from <paramref name="doBody"/>
- /// (i.e. () => { return theObject; }).
+ /// (i.e. () => { return "the result"; }). The type of <typeparam name="T"/> determines the
+ /// return type of the operation.
/// </summary>
/// <param name="lock"> the <see cref="Lock"/> instance to use </param>
/// <param name="lockWaitTimeout"> length of time to wait in
@@ -73,9 +76,9 @@ namespace Lucene.Net.Store
/// <see cref="LOCK_OBTAIN_WAIT_FOREVER"/> to retry forever </param>
/// <param name="doBody"> a delegate method that </param>
/// <returns>The value that is returned from the <paramref name="doBody"/> delegate method (i.e. () => { return theObject; })</returns>
- public static With NewAnonymous(Lock @lock, int lockWaitTimeout, Func<object> doBody)
+ public static With<T> NewAnonymous<T>(Lock @lock, int lockWaitTimeout, Func<T> doBody)
{
- return new AnonymousWith(@lock, lockWaitTimeout, doBody);
+ return new AnonymousWith<T>(@lock, lockWaitTimeout, doBody);
}
/// <summary>
@@ -171,7 +174,7 @@ namespace Lucene.Net.Store
/// <summary>
/// Utility class for executing code with exclusive access. </summary>
- public abstract class With // LUCENENET TODO: API Make generic so we don't have to return object?
+ public abstract class With<T> // LUCENENET specific - made generic so we don't need to deal with casting
{
private Lock @lock;
private long lockWaitTimeout;
@@ -190,7 +193,7 @@ namespace Lucene.Net.Store
/// <summary>
/// Code to execute with exclusive access. </summary>
- protected abstract object DoBody();
+ protected abstract T DoBody();
/// <summary>
/// Calls <see cref="DoBody"/> while <i>lock</i> is obtained. Blocks if lock
@@ -200,7 +203,7 @@ namespace Lucene.Net.Store
/// <exception cref="LockObtainFailedException"> if lock could not
/// be obtained </exception>
/// <exception cref="System.IO.IOException"> if <see cref="Lock.Obtain()"/> throws <see cref="System.IO.IOException"/> </exception>
- public virtual object Run()
+ public virtual T Run()
{
bool locked = false;
try
@@ -222,10 +225,10 @@ namespace Lucene.Net.Store
/// LUCENENET specific class to simulate the anonymous creation of a With class in Java
/// by using deletate methods.
/// </summary>
- private class AnonymousWith : With
+ private class AnonymousWith<T> : With<T>
{
- private readonly Func<object> doBody;
- public AnonymousWith(Lock @lock, int lockWaitTimeout, Func<object> doBody)
+ private readonly Func<T> doBody;
+ public AnonymousWith(Lock @lock, int lockWaitTimeout, Func<T> doBody)
: base(@lock, lockWaitTimeout)
{
if (doBody == null)
@@ -234,7 +237,7 @@ namespace Lucene.Net.Store
this.doBody = doBody;
}
- protected override object DoBody()
+ protected override T DoBody()
{
return doBody();
}
[18/50] lucenenet git commit: Lucene.Net.Core.Search.FuzzyTermsEnum:
Added TODO
Posted by ni...@apache.org.
Lucene.Net.Core.Search.FuzzyTermsEnum: Added TODO
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/3ffcd7f6
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/3ffcd7f6
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/3ffcd7f6
Branch: refs/heads/api-work
Commit: 3ffcd7f64ad4d57aee568815fcfb99872f1aa864
Parents: 595697e
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 08:03:16 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 09:12:31 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Search/FuzzyTermsEnum.cs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3ffcd7f6/src/Lucene.Net.Core/Search/FuzzyTermsEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FuzzyTermsEnum.cs b/src/Lucene.Net.Core/Search/FuzzyTermsEnum.cs
index 7c000a4..7159894 100644
--- a/src/Lucene.Net.Core/Search/FuzzyTermsEnum.cs
+++ b/src/Lucene.Net.Core/Search/FuzzyTermsEnum.cs
@@ -484,9 +484,10 @@ namespace Lucene.Net.Search
/// </summary>
public sealed class LevenshteinAutomataAttribute : Attribute, ILevenshteinAutomataAttribute
{
- private readonly IList<CompiledAutomaton> automata = new List<CompiledAutomaton>();
+ // LUCENENET NOTE: Must use EquatableList for Equals and GetHashCode()
+ private readonly IList<CompiledAutomaton> automata = new EquatableList<CompiledAutomaton>();
- public IList<CompiledAutomaton> Automata()
+ public IList<CompiledAutomaton> Automata() // LUCENENT TODO: API make property
{
return automata;
}
[43/50] lucenenet git commit: BUG:
Lucene.Net.Codecs.SimpleText.SimpleTextFieldsReader: assertion fails randomly
and when it does it causes an index out of range exception when building the
message, so the message has been commented for the time being
Posted by ni...@apache.org.
BUG: Lucene.Net.Codecs.SimpleText.SimpleTextFieldsReader: assertion fails randomly and when it does it causes an index out of range exception when building the message, so the message has been commented for the time being
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/291e3ae1
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/291e3ae1
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/291e3ae1
Branch: refs/heads/api-work
Commit: 291e3ae16ee96b6773b8640fdf1ec0ae9ee8a6ce
Parents: 43a270d
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 30 19:29:38 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 30 19:29:38 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/291e3ae1/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
index 731ef52..1650adb 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
@@ -337,7 +337,9 @@ namespace Lucene.Net.Codecs.SimpleText
{
Debug.Assert(
StringHelper.StartsWith(_scratch, SimpleTextFieldsWriter.TERM) || StringHelper.StartsWith(_scratch, SimpleTextFieldsWriter.FIELD) ||
- StringHelper.StartsWith(_scratch, SimpleTextFieldsWriter.END), "scratch=" + _scratch.Utf8ToString());
+ // LUCENENET TODO: This assert fails sometimes, which in turns causes _scratch.Utf8ToString() to throw an index out of range exception
+ StringHelper.StartsWith(_scratch, SimpleTextFieldsWriter.END) /*, "scratch=" + _scratch.Utf8ToString()*/);
+
if (!first && (_liveDocs == null || _liveDocs.Get(_docId)))
{
_in.Seek(lineStart);