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/02 01:10:45 UTC
[02/27] lucenenet git commit:
Lucene.Net.Core.Search.Similarities.SimilarityBase: Changed sbyte to byte for
CLS compliance.
Lucene.Net.Core.Search.Similarities.SimilarityBase: Changed sbyte to byte for CLS compliance.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/36494afd
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/36494afd
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/36494afd
Branch: refs/heads/api-work
Commit: 36494afd2c4c3cf1698371890680b0d135ce8067
Parents: a6c6e5d
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Mar 1 12:29:45 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Wed Mar 1 22:47:27 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/36494afd/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs b/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs
index d0c4e18..ced7acb 100644
--- a/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs
+++ b/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs
@@ -259,16 +259,16 @@ namespace Lucene.Net.Search.Similarities
/// <summary>
/// Decodes a normalization factor (document length) stored in an index. </summary>
/// <seealso cref= #encodeNormValue(float,float) </seealso>
- protected internal virtual float DecodeNormValue(sbyte norm) // LUCENENET TODO: Can this be byte?
+ protected internal virtual float DecodeNormValue(byte norm)
{
return NORM_TABLE[norm & 0xFF]; // & 0xFF maps negative bytes to positive above 127
}
/// <summary>
/// Encodes the length to a byte via SmallFloat. </summary>
- protected internal virtual sbyte EncodeNormValue(float boost, float length) // LUCENENET TODO: Can this be byte?
+ protected internal virtual byte EncodeNormValue(float boost, float length)
{
- return SmallSingle.SingleToSByte315((boost / (float)Math.Sqrt(length)));
+ return SmallSingle.SingleToByte315((boost / (float)Math.Sqrt(length)));
}
// ----------------------------- Static methods ------------------------------
@@ -307,12 +307,12 @@ namespace Lucene.Net.Search.Similarities
public override float Score(int doc, float freq)
{
// We have to supply something in case norms are omitted
- return outerInstance.Score(stats, freq, norms == null ? 1F : outerInstance.DecodeNormValue((sbyte)norms.Get(doc)));
+ return outerInstance.Score(stats, freq, norms == null ? 1F : outerInstance.DecodeNormValue((byte)norms.Get(doc)));
}
public override Explanation Explain(int doc, Explanation freq)
{
- return outerInstance.Explain(stats, doc, freq, norms == null ? 1F : outerInstance.DecodeNormValue((sbyte)norms.Get(doc)));
+ return outerInstance.Explain(stats, doc, freq, norms == null ? 1F : outerInstance.DecodeNormValue((byte)norms.Get(doc)));
}
public override float ComputeSlopFactor(int distance)