http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Util/Packed/PackedInts.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Packed/PackedInts.cs b/src/Lucene.Net.Core/Util/Packed/PackedInts.cs index e04d916..6b2997a 100644 --- a/src/Lucene.Net.Core/Util/Packed/PackedInts.cs +++ b/src/Lucene.Net.Core/Util/Packed/PackedInts.cs @@ -248,7 +248,10 @@ namespace Lucene.Net.Util.Packed { } - public override int LongCount(int packedIntsVersion, int valueCount, int bitsPerValue) + /// <summary> + /// NOTE: This was longCount() in Lucene + /// </summary> + public override int Int64Count(int packedIntsVersion, int valueCount, int bitsPerValue) { int valuesPerBlock = 64 / bitsPerValue; return (int)Math.Ceiling((double)valueCount / valuesPerBlock); @@ -308,10 +311,13 @@ namespace Lucene.Net.Util.Packed public virtual long ByteCount(int packedIntsVersion, int valueCount, int bitsPerValue) { // assume long-aligned - return 8L * LongCount(packedIntsVersion, valueCount, bitsPerValue); + return 8L * Int64Count(packedIntsVersion, valueCount, bitsPerValue); } - public virtual int LongCount(int packedIntsVersion, int valueCount, int bitsPerValue) // LUCENENET TODO: Rename Int64Count ? + /// <summary> + /// NOTE: This was longCount() in Lucene + /// </summary> + public virtual int Int64Count(int packedIntsVersion, int valueCount, int bitsPerValue) { long byteCount = ByteCount(packedIntsVersion, valueCount, bitsPerValue); @@ -447,14 +453,18 @@ namespace Lucene.Net.Util.Packed /// <summary> /// The minimum number of long blocks to encode in a single iteration, when /// using long encoding. + /// <para/> + /// NOTE: This was longBlockCount() in Lucene /// </summary> - int LongBlockCount { get; } // LUCENENET TODO: Rename Int64BlockCount ? + int Int64BlockCount { get; } /// <summary> /// The number of values that can be stored in <seealso cref="#longBlockCount()"/> long /// blocks. + /// <para/> + /// NOTE: This was longValueCount() in Lucene /// </summary> - int LongValueCount { get; } // LUCENENET TODO: Rename Int64ValueCount ? + int Int64ValueCount { get; } /// <summary> /// The minimum number of byte blocks to encode in a single iteration, when @@ -525,14 +535,18 @@ namespace Lucene.Net.Util.Packed /// <summary> /// The minimum number of long blocks to encode in a single iteration, when /// using long encoding. + /// <para/> + /// NOTE: This was longBlockCount() in Lucene /// </summary> - int LongBlockCount { get; } // LUCENENET TODO: Rename Int64BlockCount ? + int Int64BlockCount { get; } /// <summary> /// The number of values that can be stored in <seealso cref="#longBlockCount()"/> long /// blocks. + /// <para/> + /// NOTE: This was longValueCount() in Lucene /// </summary> - int LongValueCount { get; } // LUCENENET TODO: Rename Int64ValueCount ? + int Int64ValueCount { get; } /// <summary> /// The minimum number of byte blocks to encode in a single iteration, when @@ -711,7 +725,7 @@ namespace Lucene.Net.Util.Packed { LongsRef nextValues = Next(1); Debug.Assert(nextValues.Length > 0); - long result = nextValues.Longs[nextValues.Offset]; + long result = nextValues.Int64s[nextValues.Offset]; ++nextValues.Offset; --nextValues.Length; return result; @@ -943,9 +957,9 @@ namespace Lucene.Net.Util.Packed { Debug.Assert(m_valueCount != -1); CodecUtil.WriteHeader(m_out, CODEC_NAME, VERSION_CURRENT); - m_out.WriteVInt(m_bitsPerValue); - m_out.WriteVInt(m_valueCount); - m_out.WriteVInt(Format.Id); + m_out.WriteVInt32(m_bitsPerValue); + m_out.WriteVInt32(m_valueCount); + m_out.WriteVInt32(Format.Id); } /// <summary> @@ -1087,10 +1101,10 @@ namespace Lucene.Net.Util.Packed public static Reader GetReader(DataInput @in) { int version = CodecUtil.CheckHeader(@in, CODEC_NAME, VERSION_START, VERSION_CURRENT); - int bitsPerValue = @in.ReadVInt(); + int bitsPerValue = @in.ReadVInt32(); Debug.Assert(bitsPerValue > 0 && bitsPerValue <= 64, "bitsPerValue=" + bitsPerValue); - int valueCount = @in.ReadVInt(); - Format format = Format.ById(@in.ReadVInt()); + int valueCount = @in.ReadVInt32(); + Format format = Format.ById(@in.ReadVInt32()); return GetReaderNoHeader(@in, format, version, valueCount, bitsPerValue); } @@ -1126,10 +1140,10 @@ namespace Lucene.Net.Util.Packed public static IReaderIterator GetReaderIterator(DataInput @in, int mem) { int version = CodecUtil.CheckHeader(@in, CODEC_NAME, VERSION_START, VERSION_CURRENT); - int bitsPerValue = @in.ReadVInt(); + int bitsPerValue = @in.ReadVInt32(); Debug.Assert(bitsPerValue > 0 && bitsPerValue <= 64, "bitsPerValue=" + bitsPerValue); - int valueCount = @in.ReadVInt(); - Format format = Format.ById(@in.ReadVInt()); + int valueCount = @in.ReadVInt32(); + Format format = Format.ById(@in.ReadVInt32()); return GetReaderIteratorNoHeader(@in, format, version, valueCount, bitsPerValue, mem); } @@ -1246,10 +1260,10 @@ namespace Lucene.Net.Util.Packed public static Reader GetDirectReader(IndexInput @in) { int version = CodecUtil.CheckHeader(@in, CODEC_NAME, VERSION_START, VERSION_CURRENT); - int bitsPerValue = @in.ReadVInt(); + int bitsPerValue = @in.ReadVInt32(); Debug.Assert(bitsPerValue > 0 && bitsPerValue <= 64, "bitsPerValue=" + bitsPerValue); - int valueCount = @in.ReadVInt(); - Format format = Format.ById(@in.ReadVInt()); + int valueCount = @in.ReadVInt32(); + Format format = Format.ById(@in.ReadVInt32()); return GetDirectReaderNoHeader(@in, format, version, valueCount, bitsPerValue); } @@ -1512,10 +1526,10 @@ namespace Lucene.Net.Util.Packed public static Header ReadHeader(DataInput @in) { int version = CodecUtil.CheckHeader(@in, CODEC_NAME, VERSION_START, VERSION_CURRENT); - int bitsPerValue = @in.ReadVInt(); + int bitsPerValue = @in.ReadVInt32(); Debug.Assert(bitsPerValue > 0 && bitsPerValue <= 64, "bitsPerValue=" + bitsPerValue); - int valueCount = @in.ReadVInt(); - Format format = Format.ById(@in.ReadVInt()); + int valueCount = @in.ReadVInt32(); + Format format = Format.ById(@in.ReadVInt32()); return new Header(format, valueCount, bitsPerValue, version); }
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Util/Packed/PackedReaderIterator.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Packed/PackedReaderIterator.cs b/src/Lucene.Net.Core/Util/Packed/PackedReaderIterator.cs index 9dd90c9..27a0680 100644 --- a/src/Lucene.Net.Core/Util/Packed/PackedReaderIterator.cs +++ b/src/Lucene.Net.Core/Util/Packed/PackedReaderIterator.cs @@ -43,7 +43,7 @@ namespace Lucene.Net.Util.Packed Debug.Assert(valueCount == 0 || iterations > 0); nextBlocks = new byte[iterations * bulkOperation.ByteBlockCount]; nextValues = new LongsRef(new long[iterations * bulkOperation.ByteValueCount], 0, 0); - nextValues.Offset = nextValues.Longs.Length; + nextValues.Offset = nextValues.Int64s.Length; position = -1; } @@ -62,7 +62,7 @@ namespace Lucene.Net.Util.Packed { Debug.Assert(nextValues.Length >= 0); Debug.Assert(count > 0); - Debug.Assert(nextValues.Offset + nextValues.Length <= nextValues.Longs.Length); + Debug.Assert(nextValues.Offset + nextValues.Length <= nextValues.Int64s.Length); nextValues.Offset += nextValues.Length; @@ -73,7 +73,7 @@ namespace Lucene.Net.Util.Packed } count = Math.Min(remaining, count); - if (nextValues.Offset == nextValues.Longs.Length) + if (nextValues.Offset == nextValues.Int64s.Length) { long remainingBlocks = format.ByteCount(packedIntsVersion, remaining, m_bitsPerValue); int blocksToRead = (int)Math.Min(remainingBlocks, nextBlocks.Length); @@ -83,11 +83,11 @@ namespace Lucene.Net.Util.Packed Arrays.Fill(nextBlocks, blocksToRead, nextBlocks.Length, (byte)0); } - bulkOperation.Decode(nextBlocks, 0, nextValues.Longs, 0, iterations); + bulkOperation.Decode(nextBlocks, 0, nextValues.Int64s, 0, iterations); nextValues.Offset = 0; } - nextValues.Length = Math.Min(nextValues.Longs.Length - nextValues.Offset, count); + nextValues.Length = Math.Min(nextValues.Int64s.Length - nextValues.Offset, count); position += nextValues.Length; return nextValues; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Util/RecyclingIntBlockAllocator.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/RecyclingIntBlockAllocator.cs b/src/Lucene.Net.Core/Util/RecyclingIntBlockAllocator.cs index b2b3648..19e7537 100644 --- a/src/Lucene.Net.Core/Util/RecyclingIntBlockAllocator.cs +++ b/src/Lucene.Net.Core/Util/RecyclingIntBlockAllocator.cs @@ -79,7 +79,10 @@ namespace Lucene.Net.Util { } - public override int[] GetIntBlock() // LUCENENET TODO: Rename GetInt32Block() ? + /// <summary> + /// NOTE: This was getIntBlock() in Lucene + /// </summary> + public override int[] GetInt32Block() { if (freeBlocks == 0) { @@ -91,7 +94,10 @@ namespace Lucene.Net.Util return b; } - public override void RecycleIntBlocks(int[][] blocks, int start, int end) // LUCENENET TODO: Rename RecycleInt32Blocks ? + /// <summary> + /// NOTE: This was recycleIntBlocks in Lucene + /// </summary> + public override void RecycleInt32Blocks(int[][] blocks, int start, int end) { int numBlocks = Math.Min(maxBufferedBlocks - freeBlocks, end - start); int size = freeBlocks + numBlocks; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Util/SmallFloat.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/SmallFloat.cs b/src/Lucene.Net.Core/Util/SmallFloat.cs index 5053bcf..ca87e46 100644 --- a/src/Lucene.Net.Core/Util/SmallFloat.cs +++ b/src/Lucene.Net.Core/Util/SmallFloat.cs @@ -37,13 +37,15 @@ namespace Lucene.Net.Util /// <br>Values less than zero are all mapped to zero. /// <br>Values are truncated (rounded down) to the nearest 8 bit value. /// <br>Values between zero and the smallest representable value - /// are rounded up. + /// are rounded up. + /// <para/> + /// NOTE: This was floatToByte() in Lucene /// </summary> /// <param name="f"> the 32 bit float to be converted to an 8 bit float (byte) </param> /// <param name="numMantissaBits"> the number of mantissa bits to use in the byte, with the remainder to be used in the exponent </param> /// <param name="zeroExp"> the zero-point in the range of exponent values </param> /// <returns> the 8 bit float representation </returns> - public static sbyte FloatToByte(float f, int numMantissaBits, int zeroExp) // LUCENENET TODO: rename SingleToByte ? can we remove the sbyte? + public static sbyte SingleToByte(float f, int numMantissaBits, int zeroExp) // LUCENENET TODO: can we remove the sbyte? { // Adjustment from a float zero exponent to our zero exponent, // shifted over to our exponent position. @@ -65,8 +67,11 @@ namespace Lucene.Net.Util } /// <summary> - /// Converts an 8 bit float to a 32 bit float. </summary> - public static float ByteToFloat(sbyte b, int numMantissaBits, int zeroExp) // LUCENENET TODO: rename ByteToSingle ? can we remove the sbyte? + /// Converts an 8 bit float to a 32 bit float. + /// <para/> + /// NOTE: This was byteToFloat() in Lucene + /// </summary> + public static float ByteToSingle(sbyte b, int numMantissaBits, int zeroExp) // LUCENENET TODO: can we remove the sbyte? { // on Java1.5 & 1.6 JVMs, prebuilding a decoding array and doing a lookup // is only a little bit faster (anywhere from 0% to 7%) @@ -90,8 +95,10 @@ namespace Lucene.Net.Util /// <br>smallest non-zero value = 5.820766E-10 /// <br>largest value = 7.5161928E9 /// <br>epsilon = 0.125 + /// <para/> + /// NOTE: This was floatToByte315() in Lucene /// </summary> - public static sbyte FloatToByte315(float f) // LUCENENET TODO: rename SingleToByte315 ? can we remove the sbyte? + public static sbyte SingleToByte315(float f) // LUCENENET TODO: can we remove the sbyte? { int bits = BitConverter.ToInt32(BitConverter.GetBytes(f), 0); int smallfloat = bits >> (24 - 3); @@ -107,8 +114,11 @@ namespace Lucene.Net.Util } /// <summary> - /// byteToFloat(b, mantissaBits=3, zeroExponent=15) </summary> - public static float Byte315ToFloat(sbyte b) // LUCENENET TODO: rename Byte315ToSingle ? can we remove the sbyte? + /// byteToFloat(b, mantissaBits=3, zeroExponent=15) + /// <para/> + /// NOTE: This was byte315ToFloat() in Lucene + /// </summary> + public static float Byte315ToSingle(sbyte b) // LUCENENET TODO: can we remove the sbyte? { // on Java1.5 & 1.6 JVMs, prebuilding a decoding array and doing a lookup // is only a little bit faster (anywhere from 0% to 7%) @@ -126,8 +136,10 @@ namespace Lucene.Net.Util /// <br>smallest nonzero value = 0.033203125 /// <br>largest value = 1984.0 /// <br>epsilon = 0.03125 + /// <para/> + /// NOTE: This was floatToByte52() in Lucene /// </summary> - public static sbyte FloatToByte52(float f) // LUCENENET TODO: rename SingleToByte52 ? can we remove the sbyte? + public static sbyte SingleToByte52(float f) // LUCENENET TODO: can we remove the sbyte? { int bits = BitConverter.ToInt32(BitConverter.GetBytes(f), 0); int smallfloat = bits >> (24 - 5); @@ -143,8 +155,11 @@ namespace Lucene.Net.Util } /// <summary> - /// byteToFloat(b, mantissaBits=5, zeroExponent=2) </summary> - public static float Byte52ToFloat(sbyte b) // LUCENENET TODO: rename Byte52ToSingle ? can we remove the sbyte? + /// byteToFloat(b, mantissaBits=5, zeroExponent=2) + /// <para/> + /// NOTE: This was byte52ToFloat() in Lucene + /// </summary> + public static float Byte52ToSingle(sbyte b) // LUCENENET TODO: can we remove the sbyte? { // on Java1.5 & 1.6 JVMs, prebuilding a decoding array and doing a lookup // is only a little bit faster (anywhere from 0% to 7%) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Util/ToStringUtils.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/ToStringUtils.cs b/src/Lucene.Net.Core/Util/ToStringUtils.cs index 0cce51d..af1e127 100644 --- a/src/Lucene.Net.Core/Util/ToStringUtils.cs +++ b/src/Lucene.Net.Core/Util/ToStringUtils.cs @@ -57,7 +57,10 @@ namespace Lucene.Net.Util private static readonly char[] HEX = "0123456789abcdef".ToCharArray(); - public static string LongHex(long x) + /// <summary> + /// NOTE: This was longHex() in Lucene + /// </summary> + public static string Int64Hex(long x) { char[] asHex = new char[16]; for (int i = 16; --i >= 0; x = (long)((ulong)x >> 4)) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Util/UnicodeUtil.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/UnicodeUtil.cs b/src/Lucene.Net.Core/Util/UnicodeUtil.cs index 797d5e1..a9d1e34 100644 --- a/src/Lucene.Net.Core/Util/UnicodeUtil.cs +++ b/src/Lucene.Net.Core/Util/UnicodeUtil.cs @@ -539,13 +539,13 @@ namespace Lucene.Net.Util // TODO: broken if incoming result.offset != 0 // pre-alloc for worst case // TODO: ints cannot be null, should be an assert - if (utf32.Ints == null || utf32.Ints.Length < utf8.Length) + if (utf32.Int32s == null || utf32.Int32s.Length < utf8.Length) { - utf32.Ints = new int[utf8.Length]; + utf32.Int32s = new int[utf8.Length]; } int utf32Count = 0; int utf8Upto = utf8.Offset; - int[] ints = utf32.Ints; + int[] ints = utf32.Int32s; var bytes = utf8.Bytes; int utf8Limit = utf8.Offset + utf8.Length; while (utf8Upto < utf8Limit) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Util/WAH8DocIdSet.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/WAH8DocIdSet.cs b/src/Lucene.Net.Core/Util/WAH8DocIdSet.cs index 3540399..f6ac44a 100644 --- a/src/Lucene.Net.Core/Util/WAH8DocIdSet.cs +++ b/src/Lucene.Net.Core/Util/WAH8DocIdSet.cs @@ -330,11 +330,11 @@ namespace Lucene.Net.Util @out.WriteByte((byte)(sbyte)token); if (cleanLengthMinus2 > 0x03) { - @out.WriteVInt((int)((uint)cleanLengthMinus2 >> 2)); + @out.WriteVInt32((int)((uint)cleanLengthMinus2 >> 2)); } if (dirtyLength > 0x07) { - @out.WriteVInt((int)((uint)dirtyLength >> 3)); + @out.WriteVInt32((int)((uint)dirtyLength >> 3)); } } @@ -616,7 +616,7 @@ namespace Lucene.Net.Util int startPosition = @in.Position; if ((len & 0x04) != 0) { - len = (len & 0x03) | (@in.ReadVInt() << 2); + len = (len & 0x03) | (@in.ReadVInt32() << 2); } if (startPosition != 1) { @@ -630,7 +630,7 @@ namespace Lucene.Net.Util int len = token & 0x0F; if ((len & 0x08) != 0) { - len = (len & 0x07) | (@in.ReadVInt() << 3); + len = (len & 0x07) | (@in.ReadVInt32() << 3); } return len; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Facet/FacetsConfig.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Facet/FacetsConfig.cs b/src/Lucene.Net.Facet/FacetsConfig.cs index 1d5cb52..adb1af0 100644 --- a/src/Lucene.Net.Facet/FacetsConfig.cs +++ b/src/Lucene.Net.Facet/FacetsConfig.cs @@ -425,11 +425,11 @@ namespace Lucene.Net.Facet CheckTaxoWriter(taxoWriter); int ordinal = taxoWriter.AddCategory(cp); - if (ordinals.Length == ordinals.Ints.Length) + if (ordinals.Length == ordinals.Int32s.Length) { ordinals.Grow(ordinals.Length + 1); } - ordinals.Ints[ordinals.Length++] = ordinal; + ordinals.Int32s[ordinals.Length++] = ordinal; //System.out.println("ords[" + (ordinals.length-1) + "]=" + ordinal); //System.out.println(" add cp=" + cp); @@ -440,11 +440,11 @@ namespace Lucene.Net.Facet int parent = taxoWriter.GetParent(ordinal); while (parent > 0) { - if (ordinals.Ints.Length == ordinals.Length) + if (ordinals.Int32s.Length == ordinals.Length) { ordinals.Grow(ordinals.Length + 1); } - ordinals.Ints[ordinals.Length++] = parent; + ordinals.Int32s[ordinals.Length++] = parent; parent = taxoWriter.GetParent(parent); } @@ -538,13 +538,13 @@ namespace Lucene.Net.Facet /// </summary> protected virtual BytesRef DedupAndEncode(IntsRef ordinals) { - Array.Sort(ordinals.Ints, ordinals.Offset, ordinals.Length); + Array.Sort(ordinals.Int32s, ordinals.Offset, ordinals.Length); byte[] bytes = new byte[5 * ordinals.Length]; int lastOrd = -1; int upto = 0; for (int i = 0; i < ordinals.Length; i++) { - int ord = ordinals.Ints[ordinals.Offset + i]; + int ord = ordinals.Int32s[ordinals.Offset + i]; // ord could be == lastOrd, so we must dedup: if (ord > lastOrd) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Facet/Range/DoubleRange.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Facet/Range/DoubleRange.cs b/src/Lucene.Net.Facet/Range/DoubleRange.cs index 3bdb9fc..3f3d034 100644 --- a/src/Lucene.Net.Facet/Range/DoubleRange.cs +++ b/src/Lucene.Net.Facet/Range/DoubleRange.cs @@ -107,7 +107,7 @@ namespace Lucene.Net.Facet.Range internal LongRange ToLongRange() { - return new LongRange(Label, NumericUtils.DoubleToSortableLong(minIncl), true, NumericUtils.DoubleToSortableLong(maxIncl), true); + return new LongRange(Label, NumericUtils.DoubleToSortableInt64(minIncl), true, NumericUtils.DoubleToSortableInt64(maxIncl), true); } public override string ToString() http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Facet/Range/DoubleRangeFacetCounts.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Facet/Range/DoubleRangeFacetCounts.cs b/src/Lucene.Net.Facet/Range/DoubleRangeFacetCounts.cs index b5ba376..c37f999 100644 --- a/src/Lucene.Net.Facet/Range/DoubleRangeFacetCounts.cs +++ b/src/Lucene.Net.Facet/Range/DoubleRangeFacetCounts.cs @@ -91,7 +91,7 @@ namespace Lucene.Net.Facet.Range for (int i = 0; i < ranges.Length; i++) { DoubleRange range = ranges[i]; - longRanges[i] = new LongRange(range.Label, NumericUtils.DoubleToSortableLong(range.minIncl), true, NumericUtils.DoubleToSortableLong(range.maxIncl), true); + longRanges[i] = new LongRange(range.Label, NumericUtils.DoubleToSortableInt64(range.minIncl), true, NumericUtils.DoubleToSortableInt64(range.maxIncl), true); } LongRangeCounter counter = new LongRangeCounter(longRanges); @@ -135,7 +135,7 @@ namespace Lucene.Net.Facet.Range // Skip missing docs: if (fv.Exists(doc)) { - counter.Add(NumericUtils.DoubleToSortableLong(fv.DoubleVal(doc))); + counter.Add(NumericUtils.DoubleToSortableInt64(fv.DoubleVal(doc))); } else { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Facet/Taxonomy/CachedOrdinalsReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Facet/Taxonomy/CachedOrdinalsReader.cs b/src/Lucene.Net.Facet/Taxonomy/CachedOrdinalsReader.cs index a63e5da..a3dd984 100644 --- a/src/Lucene.Net.Facet/Taxonomy/CachedOrdinalsReader.cs +++ b/src/Lucene.Net.Facet/Taxonomy/CachedOrdinalsReader.cs @@ -116,7 +116,7 @@ namespace Lucene.Net.Facet.Taxonomy public override void Get(int docID, IntsRef ordinals) { - ordinals.Ints = cachedOrds.Ordinals; + ordinals.Int32s = cachedOrds.Ordinals; ordinals.Offset = cachedOrds.Offsets[docID]; ordinals.Length = cachedOrds.Offsets[docID + 1] - ordinals.Offset; } @@ -166,7 +166,7 @@ namespace Lucene.Net.Facet.Taxonomy } ords = ArrayUtil.Grow(ords, (int)nextLength); } - Array.Copy(values.Ints, 0, ords, (int)totOrds, values.Length); + Array.Copy(values.Int32s, 0, ords, (int)totOrds, values.Length); totOrds = nextLength; } Offsets[maxDoc] = (int)totOrds; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs index 44bccb8..c8fcbd6 100644 --- a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs +++ b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs @@ -1047,13 +1047,13 @@ namespace Lucene.Net.Facet.Taxonomy.Directory public void AddMapping(int origOrdinal, int newOrdinal) { - @out.WriteInt(origOrdinal); - @out.WriteInt(newOrdinal); + @out.WriteInt32(origOrdinal); + @out.WriteInt32(newOrdinal); } public void SetSize(int taxonomySize) { - @out.WriteInt(taxonomySize); + @out.WriteInt32(taxonomySize); } public void AddDone() @@ -1077,14 +1077,14 @@ namespace Lucene.Net.Facet.Taxonomy.Directory var ifs = new FileStream(tmpfile, FileMode.OpenOrCreate, FileAccess.Read); var @in = new InputStreamDataInput(ifs); - map = new int[@in.ReadInt()]; + map = new int[@in.ReadInt32()]; // NOTE: The current code assumes here that the map is complete, // i.e., every ordinal gets one and exactly one value. Otherwise, // we may run into an EOF here, or vice versa, not read everything. for (int i = 0; i < map.Length; i++) { - int origordinal = @in.ReadInt(); - int newordinal = @in.ReadInt(); + int origordinal = @in.ReadInt32(); + int newordinal = @in.ReadInt32(); map[origordinal] = newordinal; } @in.Dispose(); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Facet/Taxonomy/DocValuesOrdinalsReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Facet/Taxonomy/DocValuesOrdinalsReader.cs b/src/Lucene.Net.Facet/Taxonomy/DocValuesOrdinalsReader.cs index cc8137c..22ac0e5 100644 --- a/src/Lucene.Net.Facet/Taxonomy/DocValuesOrdinalsReader.cs +++ b/src/Lucene.Net.Facet/Taxonomy/DocValuesOrdinalsReader.cs @@ -97,9 +97,9 @@ // grow the buffer up front, even if by a large number of values (buf.length) // that saves the need to check inside the loop for every decoded value if // the buffer needs to grow. - if (ordinals.Ints.Length < buf.Length) + if (ordinals.Int32s.Length < buf.Length) { - ordinals.Ints = ArrayUtil.Grow(ordinals.Ints, buf.Length); + ordinals.Int32s = ArrayUtil.Grow(ordinals.Int32s, buf.Length); } ordinals.Offset = 0; @@ -116,9 +116,9 @@ byte b = buf.Bytes[offset++]; if ((sbyte)b >= 0) { - ordinals.Ints[ordinals.Length] = ((value << 7) | b) + prev; + ordinals.Int32s[ordinals.Length] = ((value << 7) | b) + prev; value = 0; - prev = ordinals.Ints[ordinals.Length]; + prev = ordinals.Int32s[ordinals.Length]; ordinals.Length++; } else http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Facet/Taxonomy/FloatAssociationFacetField.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Facet/Taxonomy/FloatAssociationFacetField.cs b/src/Lucene.Net.Facet/Taxonomy/FloatAssociationFacetField.cs index dbcf615..67026cc 100644 --- a/src/Lucene.Net.Facet/Taxonomy/FloatAssociationFacetField.cs +++ b/src/Lucene.Net.Facet/Taxonomy/FloatAssociationFacetField.cs @@ -46,7 +46,7 @@ namespace Lucene.Net.Facet.Taxonomy /// </summary> public static BytesRef FloatToBytesRef(float v) { - return IntAssociationFacetField.IntToBytesRef(Number.FloatToIntBits(v)); + return IntAssociationFacetField.IntToBytesRef(Number.SingleToInt32Bits(v)); } /// <summary> @@ -54,7 +54,7 @@ namespace Lucene.Net.Facet.Taxonomy /// </summary> public static float BytesRefToFloat(BytesRef b) { - return Number.IntBitsToFloat(IntAssociationFacetField.BytesRefToInt(b)); + return Number.Int32BitsToSingle(IntAssociationFacetField.BytesRefToInt(b)); } public override string ToString() http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetCounts.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetCounts.cs b/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetCounts.cs index f6c4ca4..3c5ce9e 100644 --- a/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetCounts.cs +++ b/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetCounts.cs @@ -60,7 +60,7 @@ namespace Lucene.Net.Facet.Taxonomy ords.Get(doc, scratch); for (int i = 0; i < scratch.Length; i++) { - m_values[scratch.Ints[scratch.Offset + i]]++; + m_values[scratch.Int32s[scratch.Offset + i]]++; } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumFloatAssociations.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumFloatAssociations.cs b/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumFloatAssociations.cs index 9a4612a..b36474e 100644 --- a/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumFloatAssociations.cs +++ b/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumFloatAssociations.cs @@ -85,7 +85,7 @@ namespace Lucene.Net.Facet.Taxonomy int value = ((bytes[offset] & 0xFF) << 24) | ((bytes[offset + 1] & 0xFF) << 16) | ((bytes[offset + 2] & 0xFF) << 8) | (bytes[offset + 3] & 0xFF); offset += 4; - m_values[ord] += Number.IntBitsToFloat(value); + m_values[ord] += Number.Int32BitsToSingle(value); } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumValueSource.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumValueSource.cs b/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumValueSource.cs index eee089d..ae5c251 100644 --- a/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumValueSource.cs +++ b/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumValueSource.cs @@ -146,7 +146,7 @@ namespace Lucene.Net.Facet.Taxonomy float value = (float)functionValues.DoubleVal(doc); for (int i = 0; i < scratch.Length; i++) { - m_values[scratch.Ints[i]] += value; + m_values[scratch.Int32s[i]] += value; } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Highlighter/VectorHighlight/FieldPhraseList.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Highlighter/VectorHighlight/FieldPhraseList.cs b/src/Lucene.Net.Highlighter/VectorHighlight/FieldPhraseList.cs index a664b54..136cb82 100644 --- a/src/Lucene.Net.Highlighter/VectorHighlight/FieldPhraseList.cs +++ b/src/Lucene.Net.Highlighter/VectorHighlight/FieldPhraseList.cs @@ -418,7 +418,7 @@ namespace Lucene.Net.Search.VectorHighlight int result = 1; result = prime * result + StartOffset; result = prime * result + EndOffset; - long b = Number.DoubleToLongBits(Boost); + long b = Number.DoubleToInt64Bits(Boost); result = prime * result + (int)(b ^ TripleShift(b, 32)); return result; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs b/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs index 3553d01..2be3ad6 100644 --- a/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs +++ b/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs @@ -533,14 +533,14 @@ namespace Lucene.Net.Index.Memory Debug.Assert(!sliceReader.EndOfSlice(), " stores offsets : " + startOffset_Renamed); if (outerInstance.outerInstance.storeOffsets) { - int pos = sliceReader.ReadInt(); - startOffset_Renamed = sliceReader.ReadInt(); - endOffset_Renamed = sliceReader.ReadInt(); + int pos = sliceReader.ReadInt32(); + startOffset_Renamed = sliceReader.ReadInt32(); + endOffset_Renamed = sliceReader.ReadInt32(); return pos; } else { - return sliceReader.ReadInt(); + return sliceReader.ReadInt32(); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Memory/MemoryIndex.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Memory/MemoryIndex.cs b/src/Lucene.Net.Memory/MemoryIndex.cs index cd4a284..2923214 100644 --- a/src/Lucene.Net.Memory/MemoryIndex.cs +++ b/src/Lucene.Net.Memory/MemoryIndex.cs @@ -458,13 +458,13 @@ namespace Lucene.Net.Index.Memory sumTotalTermFreq++; if (!storeOffsets) { - postingsWriter.WriteInt(pos); + postingsWriter.WriteInt32(pos); } else { - postingsWriter.WriteInt(pos); - postingsWriter.WriteInt(offsetAtt.StartOffset + offset); - postingsWriter.WriteInt(offsetAtt.EndOffset + offset); + postingsWriter.WriteInt32(pos); + postingsWriter.WriteInt32(offsetAtt.StartOffset + offset); + postingsWriter.WriteInt32(offsetAtt.EndOffset + offset); } sliceArray.end[ord] = postingsWriter.CurrentOffset; } @@ -672,7 +672,7 @@ namespace Lucene.Net.Index.Memory for (int k = 0; k < iters; k++) { - result.Append(postingsReader.ReadInt()); + result.Append(postingsReader.ReadInt32()); if (k < iters - 1) { result.Append(", "); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs b/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs index 32e7783..6b4e60d 100644 --- a/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs +++ b/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs @@ -682,7 +682,7 @@ namespace Lucene.Net.Index.Sorter internal virtual void AddPositions(DocsAndPositionsEnum @in, IndexOutput @out) { int freq = @in.Freq; - @out.WriteVInt(freq); + @out.WriteVInt32(freq); int previousPosition = 0; int previousEndOffset = 0; for (int i = 0; i < freq; i++) @@ -692,19 +692,19 @@ namespace Lucene.Net.Index.Sorter // The low-order bit of token is set only if there is a payload, the // previous bits are the delta-encoded position. int token = (pos - previousPosition) << 1 | (payload == null ? 0 : 1); - @out.WriteVInt(token); + @out.WriteVInt32(token); previousPosition = pos; if (storeOffsets) // don't encode offsets if they are not stored { int startOffset = @in.StartOffset; int endOffset = @in.EndOffset; - @out.WriteVInt(startOffset - previousEndOffset); - @out.WriteVInt(endOffset - startOffset); + @out.WriteVInt32(startOffset - previousEndOffset); + @out.WriteVInt32(endOffset - startOffset); previousEndOffset = endOffset; } if (payload != null) { - @out.WriteVInt(payload.Length); + @out.WriteVInt32(payload.Length); @out.WriteBytes(payload.Bytes, payload.Offset, payload.Length); } } @@ -744,7 +744,7 @@ namespace Lucene.Net.Index.Sorter return DocIdSetIterator.NO_MORE_DOCS; } postingInput.Seek(offsets[docIt]); - currFreq = postingInput.ReadVInt(); + currFreq = postingInput.ReadVInt32(); // reset variables used in nextPosition pos = 0; endOffset = 0; @@ -753,17 +753,17 @@ namespace Lucene.Net.Index.Sorter public override int NextPosition() { - int token = postingInput.ReadVInt(); + int token = postingInput.ReadVInt32(); pos += (int)((uint)token >> 1); if (storeOffsets) { - startOffset = endOffset + postingInput.ReadVInt(); - endOffset = startOffset + postingInput.ReadVInt(); + startOffset = endOffset + postingInput.ReadVInt32(); + endOffset = startOffset + postingInput.ReadVInt32(); } if ((token & 1) != 0) { payload.Offset = 0; - payload.Length = postingInput.ReadVInt(); + payload.Length = postingInput.ReadVInt32(); if (payload.Length > payload.Bytes.Length) { payload.Bytes = new byte[ArrayUtil.Oversize(payload.Length, 1)]; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Misc/Util/Fst/ListOfOutputs.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Misc/Util/Fst/ListOfOutputs.cs b/src/Lucene.Net.Misc/Util/Fst/ListOfOutputs.cs index 851f7cb..bf5a057 100644 --- a/src/Lucene.Net.Misc/Util/Fst/ListOfOutputs.cs +++ b/src/Lucene.Net.Misc/Util/Fst/ListOfOutputs.cs @@ -112,13 +112,13 @@ namespace Lucene.Net.Util.Fst { if (!(output is IList)) { - @out.WriteVInt(1); + @out.WriteVInt32(1); outputs.Write((T)output, @out); } else { IList outputList = (IList)output; - @out.WriteVInt(outputList.Count); + @out.WriteVInt32(outputList.Count); foreach (var eachOutput in outputList) { outputs.Write((T)eachOutput, @out); @@ -133,7 +133,7 @@ namespace Lucene.Net.Util.Fst public override object ReadFinalOutput(DataInput @in) { - int count = @in.ReadVInt(); + int count = @in.ReadVInt32(); if (count == 1) { return outputs.Read(@in); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Misc/Util/Fst/UpToTwoPositiveIntOutputs.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Misc/Util/Fst/UpToTwoPositiveIntOutputs.cs b/src/Lucene.Net.Misc/Util/Fst/UpToTwoPositiveIntOutputs.cs index 1e4cb0f..c4db55a 100644 --- a/src/Lucene.Net.Misc/Util/Fst/UpToTwoPositiveIntOutputs.cs +++ b/src/Lucene.Net.Misc/Util/Fst/UpToTwoPositiveIntOutputs.cs @@ -215,19 +215,19 @@ namespace Lucene.Net.Util.Fst if (output is long?) { long? output2 = (long?)output; - @out.WriteVLong(output2.GetValueOrDefault() << 1); + @out.WriteVInt64(output2.GetValueOrDefault() << 1); } else { TwoLongs output3 = (TwoLongs)output; - @out.WriteVLong((output3.First << 1) | 1); - @out.WriteVLong(output3.Second); + @out.WriteVInt64((output3.First << 1) | 1); + @out.WriteVInt64(output3.Second); } } public override object Read(DataInput @in) { - long code = @in.ReadVLong(); + long code = @in.ReadVInt64(); if ((code & 1) == 0) { // single long @@ -245,7 +245,7 @@ namespace Lucene.Net.Util.Fst { // two longs long first = (long)((ulong)code >> 1); - long second = @in.ReadVLong(); + long second = @in.ReadVInt64(); return new TwoLongs(first, second); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/BoostingQuery.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/BoostingQuery.cs b/src/Lucene.Net.Queries/BoostingQuery.cs index 364bfc5..57c9bd9 100644 --- a/src/Lucene.Net.Queries/BoostingQuery.cs +++ b/src/Lucene.Net.Queries/BoostingQuery.cs @@ -107,7 +107,7 @@ namespace Lucene.Net.Queries { const int prime = 31; int result = base.GetHashCode(); - result = prime * result + Number.FloatToIntBits(boost); + result = prime * result + Number.SingleToInt32Bits(boost); result = prime * result + ((context == null) ? 0 : context.GetHashCode()); result = prime * result + ((match == null) ? 0 : match.GetHashCode()); return result; @@ -134,7 +134,7 @@ namespace Lucene.Net.Queries } var other = (BoostingQuery)obj; - if (Number.FloatToIntBits(boost) != Number.FloatToIntBits(other.boost)) + if (Number.SingleToInt32Bits(boost) != Number.SingleToInt32Bits(other.boost)) { return false; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/CommonTermsQuery.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/CommonTermsQuery.cs b/src/Lucene.Net.Queries/CommonTermsQuery.cs index de2382b..8735514 100644 --- a/src/Lucene.Net.Queries/CommonTermsQuery.cs +++ b/src/Lucene.Net.Queries/CommonTermsQuery.cs @@ -390,13 +390,13 @@ namespace Lucene.Net.Queries const int prime = 31; int result = base.GetHashCode(); result = prime * result + (m_disableCoord ? 1231 : 1237); - result = prime * result + Number.FloatToIntBits(m_highFreqBoost); + result = prime * result + Number.SingleToInt32Bits(m_highFreqBoost); result = prime * result + /*((highFreqOccur == null) ? 0 :*/ m_highFreqOccur.GetHashCode()/*)*/; - result = prime * result + Number.FloatToIntBits(m_lowFreqBoost); + result = prime * result + Number.SingleToInt32Bits(m_lowFreqBoost); result = prime * result + /*((lowFreqOccur == null) ? 0 :*/ m_lowFreqOccur.GetHashCode()/*)*/; - result = prime * result + Number.FloatToIntBits(m_maxTermFrequency); - result = prime * result + Number.FloatToIntBits(m_lowFreqMinNrShouldMatch); - result = prime * result + Number.FloatToIntBits(m_highFreqMinNrShouldMatch); + result = prime * result + Number.SingleToInt32Bits(m_maxTermFrequency); + result = prime * result + Number.SingleToInt32Bits(m_lowFreqMinNrShouldMatch); + result = prime * result + Number.SingleToInt32Bits(m_highFreqMinNrShouldMatch); result = prime * result + ((m_terms == null) ? 0 : m_terms.GetValueHashCode()); return result; } @@ -420,7 +420,7 @@ namespace Lucene.Net.Queries { return false; } - if (Number.FloatToIntBits(m_highFreqBoost) != Number.FloatToIntBits(other.m_highFreqBoost)) + if (Number.SingleToInt32Bits(m_highFreqBoost) != Number.SingleToInt32Bits(other.m_highFreqBoost)) { return false; } @@ -428,7 +428,7 @@ namespace Lucene.Net.Queries { return false; } - if (Number.FloatToIntBits(m_lowFreqBoost) != Number.FloatToIntBits(other.m_lowFreqBoost)) + if (Number.SingleToInt32Bits(m_lowFreqBoost) != Number.SingleToInt32Bits(other.m_lowFreqBoost)) { return false; } @@ -436,7 +436,7 @@ namespace Lucene.Net.Queries { return false; } - if (Number.FloatToIntBits(m_maxTermFrequency) != Number.FloatToIntBits(other.m_maxTermFrequency)) + if (Number.SingleToInt32Bits(m_maxTermFrequency) != Number.SingleToInt32Bits(other.m_maxTermFrequency)) { return false; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/CustomScoreQuery.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/CustomScoreQuery.cs b/src/Lucene.Net.Queries/CustomScoreQuery.cs index 2fef745..decceea 100644 --- a/src/Lucene.Net.Queries/CustomScoreQuery.cs +++ b/src/Lucene.Net.Queries/CustomScoreQuery.cs @@ -179,7 +179,7 @@ namespace Lucene.Net.Queries public override int GetHashCode() { return (this.GetType().GetHashCode() + subQuery.GetHashCode() + Arrays.GetHashCode(scoringQueries)) ^ - Number.FloatToIntBits(Boost) ^ (strict ? 1234 : 4321); + Number.SingleToInt32Bits(Boost) ^ (strict ? 1234 : 4321); } /// <summary> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/Function/BoostedQuery.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/Function/BoostedQuery.cs b/src/Lucene.Net.Queries/Function/BoostedQuery.cs index 7afdd5c..1cd591e 100644 --- a/src/Lucene.Net.Queries/Function/BoostedQuery.cs +++ b/src/Lucene.Net.Queries/Function/BoostedQuery.cs @@ -243,7 +243,7 @@ namespace Lucene.Net.Queries.Function h ^= (h << 17) | ((int)((uint)h >> 16)); h += boostVal.GetHashCode(); h ^= (h << 8) | ((int)((uint)h >> 25)); - h += Number.FloatToIntBits(Boost); + h += Number.SingleToInt32Bits(Boost); return h; } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/Function/FunctionQuery.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/Function/FunctionQuery.cs b/src/Lucene.Net.Queries/Function/FunctionQuery.cs index 0b088e2..a82ec72 100644 --- a/src/Lucene.Net.Queries/Function/FunctionQuery.cs +++ b/src/Lucene.Net.Queries/Function/FunctionQuery.cs @@ -231,7 +231,7 @@ namespace Lucene.Net.Queries.Function /// </summary> public override int GetHashCode() { - return func.GetHashCode() * 31 + Number.FloatToIntBits(Boost); + return func.GetHashCode() * 31 + Number.SingleToInt32Bits(Boost); } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs index b040454..e915d36 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs @@ -24,7 +24,7 @@ namespace Lucene.Net.Queries.Function.ValueSources /// <summary> /// Obtains <see cref="int"/> field values from the <see cref="Search.FieldCache"/> - /// using <see cref="IFieldCache.GetInts"/> + /// using <see cref="IFieldCache.GetInt32s"/> /// and makes those values available as other numeric types, casting as needed. * /// </summary> [Obsolete] http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs index 1aee2db..bd9a8aa 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/ConstValueSource.cs @@ -88,7 +88,7 @@ namespace Lucene.Net.Queries.Function.ValueSources public override int GetHashCode() { - return Number.FloatToIntBits(constant) * 31; + return Number.SingleToInt32Bits(constant) * 31; } public override bool Equals(object o) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs index 2003dab..73407ae 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/DoubleConstValueSource.cs @@ -96,7 +96,7 @@ namespace Lucene.Net.Queries.Function.ValueSources public override int GetHashCode() { - long bits = Lucene.Net.Support.Number.DoubleToRawLongBits(constant); + long bits = Lucene.Net.Support.Number.DoubleToRawInt64Bits(constant); return (int)(bits ^ ((long)((ulong)bits >> 32))); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 4e4f32b..a642ab8 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs @@ -28,7 +28,7 @@ namespace Lucene.Net.Queries.Function.ValueSources */ /// <summary> - /// Obtains <see cref="int"/> field values from <see cref="IFieldCache.GetInts"/> and makes + /// Obtains <see cref="int"/> field values from <see cref="IFieldCache.GetInt32s"/> and makes /// those values available as other numeric types, casting as needed. /// StrVal of the value is not the <see cref="int"/> value, but its <see cref="string"/> (displayed) value /// </summary> @@ -114,7 +114,7 @@ namespace Lucene.Net.Queries.Function.ValueSources public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { - var arr = m_cache.GetInts(readerContext.AtomicReader, m_field, parser, true); + var arr = m_cache.GetInt32s(readerContext.AtomicReader, m_field, parser, true); var valid = m_cache.GetDocsWithField(readerContext.AtomicReader, m_field); return new IntDocValuesAnonymousInnerClassHelper(this, this, arr, valid); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/Function/ValueSources/FloatFieldSource.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/Function/ValueSources/FloatFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/FloatFieldSource.cs index 5143b5c..3207939 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/FloatFieldSource.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/FloatFieldSource.cs @@ -50,7 +50,7 @@ namespace Lucene.Net.Queries.Function.ValueSources public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { - var arr = m_cache.GetFloats(readerContext.AtomicReader, m_field, m_parser, true); + var arr = m_cache.GetSingles(readerContext.AtomicReader, m_field, m_parser, true); var valid = m_cache.GetDocsWithField(readerContext.AtomicReader, m_field); return new FloatDocValuesAnonymousInnerClassHelper(this, arr, valid); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/Function/ValueSources/IntFieldSource.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/Function/ValueSources/IntFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/IntFieldSource.cs index 5d13611..e4af2e0 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/IntFieldSource.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/IntFieldSource.cs @@ -26,7 +26,7 @@ namespace Lucene.Net.Queries.Function.ValueSources */ /// <summary> - /// Obtains <see cref="int"/> field values from <see cref="IFieldCache.GetInts"/> and makes those + /// Obtains <see cref="int"/> field values from <see cref="IFieldCache.GetInt32s"/> and makes those /// values available as other numeric types, casting as needed. /// </summary> public class IntFieldSource : FieldCacheSource @@ -51,7 +51,7 @@ namespace Lucene.Net.Queries.Function.ValueSources public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { - FieldCache.Ints arr = m_cache.GetInts(readerContext.AtomicReader, m_field, parser, true); + FieldCache.Ints arr = m_cache.GetInt32s(readerContext.AtomicReader, m_field, parser, true); IBits valid = m_cache.GetDocsWithField(readerContext.AtomicReader, m_field); return new IntDocValuesAnonymousInnerClassHelper(this, this, arr, valid); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/Function/ValueSources/LinearFloatFunction.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/Function/ValueSources/LinearFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/LinearFloatFunction.cs index d7cf53f..df56910 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/LinearFloatFunction.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/LinearFloatFunction.cs @@ -82,9 +82,9 @@ namespace Lucene.Net.Queries.Function.ValueSources public override int GetHashCode() { - int h = Number.FloatToIntBits(m_slope); + int h = Number.SingleToInt32Bits(m_slope); h = ((int)((uint)h >> 2)) | (h << 30); - h += Number.FloatToIntBits(m_intercept); + h += Number.SingleToInt32Bits(m_intercept); h ^= (h << 14) | ((int)((uint)h >> 19)); return h + m_source.GetHashCode(); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/Function/ValueSources/LongFieldSource.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/Function/ValueSources/LongFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/LongFieldSource.cs index d13862a..c057651 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/LongFieldSource.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/LongFieldSource.cs @@ -26,7 +26,7 @@ namespace Lucene.Net.Queries.Function.ValueSources */ /// <summary> - /// Obtains <see cref="long"/> field values from <see cref="IFieldCache.GetLongs"/> and makes those + /// Obtains <see cref="long"/> field values from <see cref="IFieldCache.GetInt64s"/> and makes those /// values available as other numeric types, casting as needed. /// </summary> public class LongFieldSource : FieldCacheSource @@ -66,7 +66,7 @@ namespace Lucene.Net.Queries.Function.ValueSources public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { - var arr = m_cache.GetLongs(readerContext.AtomicReader, m_field, m_parser, true); + var arr = m_cache.GetInt64s(readerContext.AtomicReader, m_field, m_parser, true); var valid = m_cache.GetDocsWithField(readerContext.AtomicReader, m_field); return new LongDocValuesAnonymousInnerClassHelper(this, this, arr, valid); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/Function/ValueSources/RangeMapFloatFunction.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/Function/ValueSources/RangeMapFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/RangeMapFloatFunction.cs index d510257..a3f1f19 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/RangeMapFloatFunction.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/RangeMapFloatFunction.cs @@ -101,9 +101,9 @@ namespace Lucene.Net.Queries.Function.ValueSources { int h = m_source.GetHashCode(); h ^= (h << 10) | ((int)((uint)h >> 23)); - h += Number.FloatToIntBits(m_min); + h += Number.SingleToInt32Bits(m_min); h ^= (h << 14) | ((int)((uint)h >> 19)); - h += Number.FloatToIntBits(m_max); + h += Number.SingleToInt32Bits(m_max); h += m_target.GetHashCode(); if (m_defaultVal != null) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/Function/ValueSources/ReciprocalFloatFunction.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ReciprocalFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/ReciprocalFloatFunction.cs index 70032c8..02de918 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/ReciprocalFloatFunction.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/ReciprocalFloatFunction.cs @@ -96,9 +96,9 @@ namespace Lucene.Net.Queries.Function.ValueSources public override int GetHashCode() { - int h = Number.FloatToIntBits(m_a) + Number.FloatToIntBits(m_m); + int h = Number.SingleToInt32Bits(m_a) + Number.SingleToInt32Bits(m_m); h ^= (h << 13) | ((int)((uint)h >> 20)); - return h + (Number.FloatToIntBits(m_b)) + m_source.GetHashCode(); + return h + (Number.SingleToInt32Bits(m_b)) + m_source.GetHashCode(); } public override bool Equals(object o) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs index a321258..2be917d 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/ScaleFloatFunction.cs @@ -73,7 +73,7 @@ namespace Lucene.Net.Queries.Function.ValueSources { float val = vals.FloatVal(i); - if ((Number.FloatToRawIntBits(val) & (0xff << 23)) == 0xff << 23) + if ((Number.SingleToRawInt32Bits(val) & (0xff << 23)) == 0xff << 23) { // if the exponent in the float is all ones, then this is +Inf, -Inf or NaN // which don't make sense to factor into the scale function @@ -154,9 +154,9 @@ namespace Lucene.Net.Queries.Function.ValueSources public override int GetHashCode() { - int h = Number.FloatToIntBits(m_min); + int h = Number.SingleToInt32Bits(m_min); h = h * 29; - h += Number.FloatToIntBits(m_max); + h += Number.SingleToInt32Bits(m_max); h = h * 29; h += m_source.GetHashCode(); return h; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Queries/Function/ValueSources/ShortFieldSource.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ShortFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ShortFieldSource.cs index d2d7c23..7419010 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/ShortFieldSource.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/ShortFieldSource.cs @@ -50,7 +50,7 @@ namespace Lucene.Net.Queries.Function.ValueSources public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext) { - var arr = m_cache.GetShorts(readerContext.AtomicReader, m_field, parser, false); + var arr = m_cache.GetInt16s(readerContext.AtomicReader, m_field, parser, false); return new FunctionValuesAnonymousInnerClassHelper(this, arr); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 0aaa4de..62fd903 100644 --- a/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs +++ b/src/Lucene.Net.Queries/Mlt/MoreLikeThisQuery.cs @@ -145,7 +145,7 @@ namespace Lucene.Net.Queries.Mlt result = prime * result + minDocFreq; result = prime * result + minTermFrequency; result = prime * result + Arrays.GetHashCode(moreLikeFields); - result = prime * result + Number.FloatToIntBits(percentTermsToMatch); + result = prime * result + Number.SingleToInt32Bits(percentTermsToMatch); result = prime * result + ((stopWords == null) ? 0 : stopWords.GetValueHashCode()); return result; } @@ -214,7 +214,7 @@ namespace Lucene.Net.Queries.Mlt { return false; } - if (Number.FloatToIntBits(percentTermsToMatch) != Number.FloatToIntBits(other.percentTermsToMatch)) + if (Number.SingleToInt32Bits(percentTermsToMatch) != Number.SingleToInt32Bits(other.percentTermsToMatch)) { return false; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs b/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs index f2a9798..0f0521d 100644 --- a/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs +++ b/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs @@ -544,7 +544,7 @@ namespace Lucene.Net.QueryParsers.Classic // FuzzyQuery doesn't yet allow constant score rewrite string text = term.Text(); #pragma warning disable 612, 618 - int numEdits = FuzzyQuery.FloatToEdits(minimumSimilarity, + int numEdits = FuzzyQuery.SingleToEdits(minimumSimilarity, text.CodePointCount(0, text.Length)); #pragma warning restore 612, 618 return new FuzzyQuery(term, numEdits, prefixLength); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/FuzzyQueryNodeBuilder.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/FuzzyQueryNodeBuilder.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/FuzzyQueryNodeBuilder.cs index 3fa9c06..6ae4c99 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/FuzzyQueryNodeBuilder.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/FuzzyQueryNodeBuilder.cs @@ -38,7 +38,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders string text = fuzzyNode.GetTextAsString(); #pragma warning disable 612, 618 - int numEdits = FuzzyQuery.FloatToEdits(fuzzyNode.Similarity, + int numEdits = FuzzyQuery.SingleToEdits(fuzzyNode.Similarity, text.CodePointCount(0, text.Length)); #pragma warning restore 612, 618 http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/NumericRangeQueryNodeBuilder.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/NumericRangeQueryNodeBuilder.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/NumericRangeQueryNodeBuilder.cs index 52a8eb0..dffcd8b 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/NumericRangeQueryNodeBuilder.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Builders/NumericRangeQueryNodeBuilder.cs @@ -64,16 +64,16 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard.Builders switch (numberType) { case NumericType.LONG: - return NumericRangeQuery.NewLongRange(field, precisionStep, + return NumericRangeQuery.NewInt64Range(field, precisionStep, (long?)lowerNumber, (long?)upperNumber, minInclusive, maxInclusive); case NumericType.INT: - return NumericRangeQuery.NewIntRange(field, precisionStep, + return NumericRangeQuery.NewInt32Range(field, precisionStep, (int?)lowerNumber, (int?)upperNumber, minInclusive, maxInclusive); case NumericType.FLOAT: - return NumericRangeQuery.NewFloatRange(field, precisionStep, + return NumericRangeQuery.NewSingleRange(field, precisionStep, (float?)lowerNumber, (float?)upperNumber, minInclusive, maxInclusive); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.QueryParser/Xml/Builders/NumericRangeFilterBuilder.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.QueryParser/Xml/Builders/NumericRangeFilterBuilder.cs b/src/Lucene.Net.QueryParser/Xml/Builders/NumericRangeFilterBuilder.cs index d7d4130..d37193b 100644 --- a/src/Lucene.Net.QueryParser/Xml/Builders/NumericRangeFilterBuilder.cs +++ b/src/Lucene.Net.QueryParser/Xml/Builders/NumericRangeFilterBuilder.cs @@ -121,12 +121,12 @@ namespace Lucene.Net.QueryParsers.Xml.Builders Filter filter; if (type.Equals("int", StringComparison.OrdinalIgnoreCase)) { - filter = NumericRangeFilter.NewIntRange(field, precisionStep, Convert.ToInt32(lowerTerm), Convert.ToInt32(upperTerm), lowerInclusive, + filter = NumericRangeFilter.NewInt32Range(field, precisionStep, Convert.ToInt32(lowerTerm), Convert.ToInt32(upperTerm), lowerInclusive, upperInclusive); } else if (type.Equals("long", StringComparison.OrdinalIgnoreCase)) { - filter = NumericRangeFilter.NewLongRange(field, precisionStep, Convert + filter = NumericRangeFilter.NewInt64Range(field, precisionStep, Convert .ToInt64(lowerTerm), Convert.ToInt64(upperTerm), lowerInclusive, upperInclusive); } @@ -138,7 +138,7 @@ namespace Lucene.Net.QueryParsers.Xml.Builders } else if (type.Equals("float", StringComparison.OrdinalIgnoreCase)) { - filter = NumericRangeFilter.NewFloatRange(field, precisionStep, Convert + filter = NumericRangeFilter.NewSingleRange(field, precisionStep, Convert .ToSingle(lowerTerm), Convert.ToSingle(upperTerm), lowerInclusive, upperInclusive); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.QueryParser/Xml/Builders/NumericRangeQueryBuilder.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.QueryParser/Xml/Builders/NumericRangeQueryBuilder.cs b/src/Lucene.Net.QueryParser/Xml/Builders/NumericRangeQueryBuilder.cs index 4b4b128..668f56e 100644 --- a/src/Lucene.Net.QueryParser/Xml/Builders/NumericRangeQueryBuilder.cs +++ b/src/Lucene.Net.QueryParser/Xml/Builders/NumericRangeQueryBuilder.cs @@ -99,13 +99,13 @@ namespace Lucene.Net.QueryParsers.Xml.Builders Query filter; if (type.Equals("int", StringComparison.OrdinalIgnoreCase)) { - filter = NumericRangeQuery.NewIntRange(field, precisionStep, Convert + filter = NumericRangeQuery.NewInt32Range(field, precisionStep, Convert .ToInt32(lowerTerm), Convert.ToInt32(upperTerm), lowerInclusive, upperInclusive); } else if (type.Equals("long", StringComparison.OrdinalIgnoreCase)) { - filter = NumericRangeQuery.NewLongRange(field, precisionStep, Convert + filter = NumericRangeQuery.NewInt64Range(field, precisionStep, Convert .ToInt64(lowerTerm), Convert.ToInt64(upperTerm), lowerInclusive, upperInclusive); } @@ -117,7 +117,7 @@ namespace Lucene.Net.QueryParsers.Xml.Builders } else if (type.Equals("float", StringComparison.OrdinalIgnoreCase)) { - filter = NumericRangeQuery.NewFloatRange(field, precisionStep, Convert + filter = NumericRangeQuery.NewSingleRange(field, precisionStep, Convert .ToSingle(lowerTerm), Convert.ToSingle(upperTerm), lowerInclusive, upperInclusive); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 48c2b3e..b833083 100644 --- a/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs +++ b/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs @@ -136,7 +136,7 @@ namespace Lucene.Net.Sandbox.Queries int result = 1; result = prime * result + ((fieldName == null) ? 0 : fieldName.GetHashCode()); - result = prime * result + Number.FloatToIntBits(minSimilarity); + result = prime * result + Number.SingleToInt32Bits(minSimilarity); result = prime * result + prefixLength; result = prime * result + ((queryString == null) ? 0 : queryString.GetHashCode()); @@ -159,8 +159,8 @@ namespace Lucene.Net.Sandbox.Queries } else if (!fieldName.Equals(other.fieldName, StringComparison.Ordinal)) return false; - if (Number.FloatToIntBits(minSimilarity) != Number - .FloatToIntBits(other.minSimilarity)) + if (Number.SingleToInt32Bits(minSimilarity) != Number + .SingleToInt32Bits(other.minSimilarity)) return false; if (prefixLength != other.prefixLength) return false; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Sandbox/Queries/SlowFuzzyQuery.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Sandbox/Queries/SlowFuzzyQuery.cs b/src/Lucene.Net.Sandbox/Queries/SlowFuzzyQuery.cs index 77ec159..9a068f1 100644 --- a/src/Lucene.Net.Sandbox/Queries/SlowFuzzyQuery.cs +++ b/src/Lucene.Net.Sandbox/Queries/SlowFuzzyQuery.cs @@ -182,7 +182,7 @@ namespace Lucene.Net.Sandbox.Queries { int prime = 31; int result = base.GetHashCode(); - result = prime * result + Number.FloatToIntBits(minimumSimilarity); + result = prime * result + Number.SingleToInt32Bits(minimumSimilarity); result = prime * result + prefixLength; result = prime * result + ((m_term == null) ? 0 : m_term.GetHashCode()); return result; @@ -197,8 +197,8 @@ namespace Lucene.Net.Sandbox.Queries if (GetType() != obj.GetType()) return false; SlowFuzzyQuery other = (SlowFuzzyQuery)obj; - if (Number.FloatToIntBits(minimumSimilarity) != Number - .FloatToIntBits(other.minimumSimilarity)) + if (Number.SingleToInt32Bits(minimumSimilarity) != Number + .SingleToInt32Bits(other.minimumSimilarity)) return false; if (prefixLength != other.prefixLength) return false; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Sandbox/Queries/SlowFuzzyTermsEnum.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Sandbox/Queries/SlowFuzzyTermsEnum.cs b/src/Lucene.Net.Sandbox/Queries/SlowFuzzyTermsEnum.cs index 05121db..ef44345 100644 --- a/src/Lucene.Net.Sandbox/Queries/SlowFuzzyTermsEnum.cs +++ b/src/Lucene.Net.Sandbox/Queries/SlowFuzzyTermsEnum.cs @@ -124,7 +124,7 @@ namespace Lucene.Net.Sandbox.Queries if (StringHelper.StartsWith(term, prefixBytesRef)) { UnicodeUtil.UTF8toUTF32(term, utf32); - int distance = CalcDistance(utf32.Ints, outerInstance.m_realPrefixLength, utf32.Length - outerInstance.m_realPrefixLength); + int distance = CalcDistance(utf32.Int32s, outerInstance.m_realPrefixLength, utf32.Length - outerInstance.m_realPrefixLength); //Integer.MIN_VALUE is the sentinel that Levenshtein stopped early if (distance == int.MinValue) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Spatial/Util/DistanceToShapeValueSource.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Spatial/Util/DistanceToShapeValueSource.cs b/src/Lucene.Net.Spatial/Util/DistanceToShapeValueSource.cs index c5c0125..b0a6de1 100644 --- a/src/Lucene.Net.Spatial/Util/DistanceToShapeValueSource.cs +++ b/src/Lucene.Net.Spatial/Util/DistanceToShapeValueSource.cs @@ -122,7 +122,7 @@ namespace Lucene.Net.Spatial.Util long temp; result = shapeValueSource.GetHashCode(); result = 31 * result + queryPoint.GetHashCode(); - temp = Number.DoubleToLongBits(multiplier); + temp = Number.DoubleToInt64Bits(multiplier); result = 31 * result + (int)(temp ^ ((long)((ulong)temp) >> 32)); return result; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Suggest/Spell/JaroWinklerDistance.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Suggest/Spell/JaroWinklerDistance.cs b/src/Lucene.Net.Suggest/Spell/JaroWinklerDistance.cs index c17f7cd..bc29dc3 100644 --- a/src/Lucene.Net.Suggest/Spell/JaroWinklerDistance.cs +++ b/src/Lucene.Net.Suggest/Spell/JaroWinklerDistance.cs @@ -142,7 +142,7 @@ namespace Lucene.Net.Search.Spell public override int GetHashCode() { - return 113 * Number.FloatToIntBits(threshold) * this.GetType().GetHashCode(); + return 113 * Number.SingleToInt32Bits(threshold) * this.GetType().GetHashCode(); } public override bool Equals(object obj) @@ -157,7 +157,7 @@ namespace Lucene.Net.Search.Spell } JaroWinklerDistance o = (JaroWinklerDistance)obj; - return (Number.FloatToIntBits(o.threshold) == Number.FloatToIntBits(this.threshold)); + return (Number.SingleToInt32Bits(o.threshold) == Number.SingleToInt32Bits(this.threshold)); } public override string ToString() http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Suggest/Spell/LuceneLevenshteinDistance.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Suggest/Spell/LuceneLevenshteinDistance.cs b/src/Lucene.Net.Suggest/Spell/LuceneLevenshteinDistance.cs index 2867150..ab0c9b7 100644 --- a/src/Lucene.Net.Suggest/Spell/LuceneLevenshteinDistance.cs +++ b/src/Lucene.Net.Suggest/Spell/LuceneLevenshteinDistance.cs @@ -103,15 +103,15 @@ namespace Lucene.Net.Search.Spell for (j = 1; j <= m; j++) { - t_j = otherPoints.Ints[j - 1]; + t_j = otherPoints.Int32s[j - 1]; for (i = 1; i <= n; i++) { - cost = targetPoints.Ints[i - 1] == t_j ? 0 : 1; + cost = targetPoints.Int32s[i - 1] == t_j ? 0 : 1; // minimum of cell to the left+1, to the top+1, diagonally left and up +cost d[i][j] = Math.Min(Math.Min(d[i - 1][j] + 1, d[i][j - 1] + 1), d[i - 1][j - 1] + cost); // transposition - if (i > 1 && j > 1 && targetPoints.Ints[i - 1] == otherPoints.Ints[j - 2] && targetPoints.Ints[i - 2] == otherPoints.Ints[j - 1]) + if (i > 1 && j > 1 && targetPoints.Int32s[i - 1] == otherPoints.Int32s[j - 2] && targetPoints.Int32s[i - 2] == otherPoints.Int32s[j - 1]) { d[i][j] = Math.Min(d[i][j], d[i - 2][j - 2] + cost); } @@ -127,7 +127,7 @@ namespace Lucene.Net.Search.Spell int utf16Len = s.Length; for (int i = 0, cp = 0; i < utf16Len; i += Character.CharCount(cp)) { - cp = @ref.Ints[@ref.Length++] = Character.CodePointAt(s, i); + cp = @ref.Int32s[@ref.Length++] = Character.CodePointAt(s, i); } return @ref; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 8eef805..be3d918 100644 --- a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs +++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingSuggester.cs @@ -339,13 +339,13 @@ namespace Lucene.Net.Search.Suggest.Analyzing // First by analyzed form: readerA.Reset(a.Bytes, a.Offset, a.Length); - scratchA.Length = (ushort)readerA.ReadShort(); + scratchA.Length = (ushort)readerA.ReadInt16(); scratchA.Bytes = a.Bytes; scratchA.Offset = readerA.Position; readerB.Reset(b.Bytes, b.Offset, b.Length); scratchB.Bytes = b.Bytes; - scratchB.Length = (ushort)readerB.ReadShort(); + scratchB.Length = (ushort)readerB.ReadInt16(); scratchB.Offset = readerB.Position; int cmp = scratchA.CompareTo(scratchB); @@ -357,8 +357,8 @@ namespace Lucene.Net.Search.Suggest.Analyzing readerB.SkipBytes(scratchB.Length); // Next by cost: - long aCost = readerA.ReadInt(); - long bCost = readerB.ReadInt(); + long aCost = readerA.ReadInt32(); + long bCost = readerB.ReadInt32(); Debug.Assert(DecodeWeight(aCost) >= 0); Debug.Assert(DecodeWeight(bCost) >= 0); if (aCost < bCost) @@ -373,8 +373,8 @@ namespace Lucene.Net.Search.Suggest.Analyzing // Finally by surface form: if (hasPayloads) { - scratchA.Length = (ushort)readerA.ReadShort(); - scratchB.Length = (ushort)readerB.ReadShort(); + scratchA.Length = (ushort)readerA.ReadInt16(); + scratchB.Length = (ushort)readerB.ReadInt16(); scratchA.Offset = readerA.Position; scratchB.Offset = readerB.Position; } @@ -462,11 +462,11 @@ namespace Lucene.Net.Search.Suggest.Analyzing output.Reset(buffer); - output.WriteShort((short)analyzedLength); + output.WriteInt16((short)analyzedLength); output.WriteBytes(scratch.Bytes, scratch.Offset, scratch.Length); - output.WriteInt(EncodeWeight(iterator.Weight)); + output.WriteInt32(EncodeWeight(iterator.Weight)); if (hasPayloads) { @@ -478,7 +478,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing "surface form cannot contain unit separator character U+001F; this character is reserved"); } } - output.WriteShort((short)surfaceForm.Length); + output.WriteInt16((short)surfaceForm.Length); output.WriteBytes(surfaceForm.Bytes, surfaceForm.Offset, surfaceForm.Length); output.WriteBytes(payload.Bytes, payload.Offset, payload.Length); } @@ -524,17 +524,17 @@ namespace Lucene.Net.Search.Suggest.Analyzing while (reader.Read(scratch)) { input.Reset(scratch.Bytes, scratch.Offset, scratch.Length); - ushort analyzedLength = (ushort)input.ReadShort(); + ushort analyzedLength = (ushort)input.ReadInt16(); analyzed.Grow(analyzedLength + 2); input.ReadBytes(analyzed.Bytes, 0, analyzedLength); analyzed.Length = analyzedLength; - long cost = input.ReadInt(); + long cost = input.ReadInt32(); surface.Bytes = scratch.Bytes; if (hasPayloads) { - surface.Length = (ushort)input.ReadShort(); + surface.Length = (ushort)input.ReadInt16(); surface.Offset = input.Position; } else @@ -584,7 +584,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing analyzed.Bytes[analyzed.Offset + analyzed.Length + 1] = (byte)dedup; analyzed.Length += 2; - Util.Fst.Util.ToIntsRef(analyzed, scratchInts); + Util.Fst.Util.ToInt32sRef(analyzed, scratchInts); //System.out.println("ADD: " + scratchInts + " -> " + cost + ": " + surface.utf8ToString()); if (!hasPayloads) { @@ -626,23 +626,23 @@ namespace Lucene.Net.Search.Suggest.Analyzing public override bool Store(DataOutput output) { - output.WriteVLong(count); + output.WriteVInt64(count); if (fst == null) { return false; } fst.Save(output); - output.WriteVInt(maxAnalyzedPathsForOneInput); + output.WriteVInt32(maxAnalyzedPathsForOneInput); output.WriteByte((byte)(hasPayloads ? 1 : 0)); return true; } public override bool Load(DataInput input) { - count = input.ReadVLong(); + count = input.ReadVInt64(); this.fst = new FST<PairOutputs<long?, BytesRef>.Pair>(input, new PairOutputs<long?, BytesRef>(PositiveIntOutputs.Singleton, ByteSequenceOutputs.Singleton)); - maxAnalyzedPathsForOneInput = input.ReadVInt(); + maxAnalyzedPathsForOneInput = input.ReadVInt32(); hasPayloads = input.ReadByte() == 1; return true; }
