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/02/08 14:31:46 UTC
[07/53] [abbrv] lucenenet git commit: Lucene.Net.Core: Renamed all
type-derived properties and methods from Short, Int, Long,
and Float to match CLR types Int16, Int32, Int64, and Single, respectively.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/Spans/FieldMaskingSpanQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Spans/FieldMaskingSpanQuery.cs b/src/Lucene.Net.Core/Search/Spans/FieldMaskingSpanQuery.cs
index 357dc4b..52d8905 100644
--- a/src/Lucene.Net.Core/Search/Spans/FieldMaskingSpanQuery.cs
+++ b/src/Lucene.Net.Core/Search/Spans/FieldMaskingSpanQuery.cs
@@ -161,7 +161,7 @@ namespace Lucene.Net.Search.Spans
public override int GetHashCode()
{
- return MaskedQuery.GetHashCode() ^ Field.GetHashCode() ^ Number.FloatToIntBits(Boost);
+ return MaskedQuery.GetHashCode() ^ Field.GetHashCode() ^ Number.SingleToInt32Bits(Boost);
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/Spans/SpanFirstQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Spans/SpanFirstQuery.cs b/src/Lucene.Net.Core/Search/Spans/SpanFirstQuery.cs
index 2f0cd56..93d0d93 100644
--- a/src/Lucene.Net.Core/Search/Spans/SpanFirstQuery.cs
+++ b/src/Lucene.Net.Core/Search/Spans/SpanFirstQuery.cs
@@ -98,7 +98,7 @@ namespace Lucene.Net.Search.Spans
{
int h = m_match.GetHashCode();
h ^= (h << 8) | ((int)((uint)h >> 25)); // reversible
- h ^= Number.FloatToIntBits(Boost) ^ m_end; // LUCENENET TODO: This was FloatToRawIntBits in the original
+ h ^= Number.SingleToInt32Bits(Boost) ^ m_end; // LUCENENET TODO: This was FloatToRawIntBits in the original
return h;
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 82cf4e9..411daa9 100644
--- a/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs
+++ b/src/Lucene.Net.Core/Search/Spans/SpanNearPayloadCheckQuery.cs
@@ -126,7 +126,7 @@ namespace Lucene.Net.Search.Spans
h ^= (h << 8) | ((int)((uint)h >> 25)); // reversible
//TODO: is this right?
h ^= m_payloadToMatch.GetHashCode();
- h ^= Number.FloatToIntBits(Boost); // LUCENENET TODO: This was FloatToRawIntBits in the original
+ h ^= Number.SingleToInt32Bits(Boost); // LUCENENET TODO: This was FloatToRawIntBits in the original
return h;
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 af3757f..eac1aa2 100644
--- a/src/Lucene.Net.Core/Search/Spans/SpanNearQuery.cs
+++ b/src/Lucene.Net.Core/Search/Spans/SpanNearQuery.cs
@@ -242,7 +242,7 @@ namespace Lucene.Net.Search.Spans
// last element of clauses. this particular mix also serves to
// differentiate SpanNearQuery hashcodes from others.
result ^= (result << 14) | ((int)((uint)result >> 19)); // reversible
- result += Number.FloatToIntBits(Boost); // LUCENENET TODO: This was FloatToRawIntBits in the original
+ result += Number.SingleToInt32Bits(Boost); // LUCENENET TODO: This was FloatToRawIntBits in the original
result += m_slop;
result ^= (m_inOrder ? unchecked((int)0x99AFD3BD) : 0);
return result;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 2d1758a..29f2c5e 100644
--- a/src/Lucene.Net.Core/Search/Spans/SpanOrQuery.cs
+++ b/src/Lucene.Net.Core/Search/Spans/SpanOrQuery.cs
@@ -170,7 +170,7 @@ namespace Lucene.Net.Search.Spans
//If this doesn't work, hash all elemnts together instead. This version was used to reduce time complexity
int h = clauses.Count == 0 ? 0 : HashHelpers.CombineHashCodes(clauses.First().GetHashCode(), clauses.Last().GetHashCode(), clauses.Count);
h ^= (h << 10) | ((int)(((uint)h) >> 23));
- h ^= Number.FloatToIntBits(Boost);
+ h ^= Number.SingleToInt32Bits(Boost);
return h;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 a7a024e..12f61da 100644
--- a/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs
+++ b/src/Lucene.Net.Core/Search/Spans/SpanPayloadCheckQuery.cs
@@ -126,7 +126,7 @@ namespace Lucene.Net.Search.Spans
h ^= (h << 8) | ((int)((uint)h >> 25)); // reversible
//TODO: is this right?
h ^= m_payloadToMatch.GetHashCode();
- h ^= Number.FloatToIntBits(Boost); // LUCENENET TODO: This was FloatToRawIntBits in the original
+ h ^= Number.SingleToInt32Bits(Boost); // LUCENENET TODO: This was FloatToRawIntBits in the original
return h;
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/Spans/SpanPositionRangeQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Spans/SpanPositionRangeQuery.cs b/src/Lucene.Net.Core/Search/Spans/SpanPositionRangeQuery.cs
index 557ec16..b8c5ae0 100644
--- a/src/Lucene.Net.Core/Search/Spans/SpanPositionRangeQuery.cs
+++ b/src/Lucene.Net.Core/Search/Spans/SpanPositionRangeQuery.cs
@@ -112,7 +112,7 @@ namespace Lucene.Net.Search.Spans
{
int h = m_match.GetHashCode();
h ^= (h << 8) | ((int)((uint)h >> 25)); // reversible
- h ^= Number.FloatToIntBits(Boost) ^ m_end ^ m_start; // LUCENENET TODO: This was FloatToRawIntBits in the original
+ h ^= Number.SingleToInt32Bits(Boost) ^ m_end ^ m_start; // LUCENENET TODO: This was FloatToRawIntBits in the original
return h;
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/TermQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/TermQuery.cs b/src/Lucene.Net.Core/Search/TermQuery.cs
index e2e3ec7..a8b548f 100644
--- a/src/Lucene.Net.Core/Search/TermQuery.cs
+++ b/src/Lucene.Net.Core/Search/TermQuery.cs
@@ -249,7 +249,7 @@ namespace Lucene.Net.Search
/// Returns a hash code value for this object. </summary>
public override int GetHashCode()
{
- return Number.FloatToIntBits(Boost) ^ term.GetHashCode();
+ return Number.SingleToInt32Bits(Boost) ^ term.GetHashCode();
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Store/BufferedIndexInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/BufferedIndexInput.cs b/src/Lucene.Net.Core/Store/BufferedIndexInput.cs
index 93cf2c5..4a22bae 100644
--- a/src/Lucene.Net.Core/Store/BufferedIndexInput.cs
+++ b/src/Lucene.Net.Core/Store/BufferedIndexInput.cs
@@ -204,7 +204,10 @@ namespace Lucene.Net.Store
}
}
- public override sealed short ReadShort()
+ /// <summary>
+ /// NOTE: this was readShort() in Lucene
+ /// </summary>
+ public override sealed short ReadInt16()
{
if (2 <= (bufferLength - bufferPosition))
{
@@ -212,11 +215,11 @@ namespace Lucene.Net.Store
}
else
{
- return base.ReadShort();
+ return base.ReadInt16();
}
}
- public override sealed int ReadInt()
+ public override sealed int ReadInt32()
{
if (4 <= (bufferLength - bufferPosition))
{
@@ -224,11 +227,11 @@ namespace Lucene.Net.Store
}
else
{
- return base.ReadInt();
+ return base.ReadInt32();
}
}
- public override sealed long ReadLong()
+ public override sealed long ReadInt64()
{
if (8 <= (bufferLength - bufferPosition))
{
@@ -238,11 +241,11 @@ namespace Lucene.Net.Store
}
else
{
- return base.ReadLong();
+ return base.ReadInt64();
}
}
- public override sealed int ReadVInt()
+ public override sealed int ReadVInt32()
{
if (5 <= (bufferLength - bufferPosition))
{
@@ -281,11 +284,11 @@ namespace Lucene.Net.Store
}
else
{
- return base.ReadVInt();
+ return base.ReadVInt32();
}
}
- public override sealed long ReadVLong()
+ public override sealed long ReadVInt64()
{
if (9 <= bufferLength - bufferPosition)
{
@@ -347,7 +350,7 @@ namespace Lucene.Net.Store
}
else
{
- return base.ReadVLong();
+ return base.ReadVInt64();
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Store/ByteArrayDataInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/ByteArrayDataInput.cs b/src/Lucene.Net.Core/Store/ByteArrayDataInput.cs
index e237867..f966460 100644
--- a/src/Lucene.Net.Core/Store/ByteArrayDataInput.cs
+++ b/src/Lucene.Net.Core/Store/ByteArrayDataInput.cs
@@ -97,25 +97,36 @@ namespace Lucene.Net.Store
/// <summary>
/// LUCENENET NOTE: Important - always cast to ushort (System.UInt16) before using to ensure
/// the value is positive!
+ /// <para/>
+ /// NOTE: this was readShort() in Lucene
/// </summary>
- public override short ReadShort()
+ public override short ReadInt16()
{
return (short)(ushort)(((bytes[pos++] & 0xFF) << 8) | (bytes[pos++] & 0xFF));
}
- public override int ReadInt()
+ /// <summary>
+ /// NOTE: this was readInt() in Lucene
+ /// </summary>
+ public override int ReadInt32()
{
return ((bytes[pos++] & 0xFF) << 24) | ((bytes[pos++] & 0xFF) << 16) | ((bytes[pos++] & 0xFF) << 8) | (bytes[pos++] & 0xFF);
}
- public override long ReadLong()
+ /// <summary>
+ /// NOTE: this was readLong() in Lucene
+ /// </summary>
+ public override long ReadInt64()
{
int i1 = ((bytes[pos++] & 0xff) << 24) | ((bytes[pos++] & 0xff) << 16) | ((bytes[pos++] & 0xff) << 8) | (bytes[pos++] & 0xff);
int i2 = ((bytes[pos++] & 0xff) << 24) | ((bytes[pos++] & 0xff) << 16) | ((bytes[pos++] & 0xff) << 8) | (bytes[pos++] & 0xff);
return (((long)i1) << 32) | (i2 & 0xFFFFFFFFL);
}
- public override int ReadVInt()
+ /// <summary>
+ /// NOTE: this was readVInt() in Lucene
+ /// </summary>
+ public override int ReadVInt32()
{
// .NET Port: going back to original style code instead of Java code below due to sbyte/byte diff
/*byte b = Bytes[Pos++];
@@ -161,7 +172,10 @@ namespace Lucene.Net.Store
throw new Exception("Invalid vInt detected (too many bits)");
}
- public override long ReadVLong()
+ /// <summary>
+ /// NOTE: this was readVLong() in Lucene
+ /// </summary>
+ public override long ReadVInt64()
{
// .NET Port: going back to old style code
/*byte b = Bytes[Pos++];
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs b/src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs
index d25e47c..5a27cd6 100644
--- a/src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs
+++ b/src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs
@@ -140,15 +140,18 @@ namespace Lucene.Net.Store
}
}
- public override sealed short ReadShort()
+ /// <summary>
+ /// NOTE: this was readShort() in Lucene
+ /// </summary>
+ public override sealed short ReadInt16()
{
try
{
- return curBuf.GetShort();
+ return curBuf.GetInt16();
}
catch (BufferUnderflowException)
{
- return base.ReadShort();
+ return base.ReadInt16();
}
catch (System.NullReferenceException)
{
@@ -156,15 +159,18 @@ namespace Lucene.Net.Store
}
}
- public override sealed int ReadInt()
+ /// <summary>
+ /// NOTE: this was readInt() in Lucene
+ /// </summary>
+ public override sealed int ReadInt32()
{
try
{
- return curBuf.GetInt();
+ return curBuf.GetInt32();
}
catch (BufferUnderflowException)
{
- return base.ReadInt();
+ return base.ReadInt32();
}
catch (System.NullReferenceException)
{
@@ -172,15 +178,18 @@ namespace Lucene.Net.Store
}
}
- public override sealed long ReadLong()
+ /// <summary>
+ /// NOTE: this was readLong() in Lucene
+ /// </summary>
+ public override sealed long ReadInt64()
{
try
{
- return curBuf.GetLong();
+ return curBuf.GetInt64();
}
catch (BufferUnderflowException)
{
- return base.ReadLong();
+ return base.ReadInt64();
}
catch (System.NullReferenceException)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Store/CompoundFileDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/CompoundFileDirectory.cs b/src/Lucene.Net.Core/Store/CompoundFileDirectory.cs
index 71436f8..d6049f8 100644
--- a/src/Lucene.Net.Core/Store/CompoundFileDirectory.cs
+++ b/src/Lucene.Net.Core/Store/CompoundFileDirectory.cs
@@ -147,7 +147,7 @@ namespace Lucene.Net.Store
#pragma warning disable 612, 618
stream = handle.OpenFullSlice();
#pragma warning restore 612, 618
- int firstInt = stream.ReadVInt();
+ int firstInt = stream.ReadVInt32();
// impossible for 3.0 to have 63 files in a .cfs, CFS writer was not visible
// and separate norms/etc are outside of cfs.
if (firstInt == CODEC_MAGIC_BYTE1)
@@ -163,7 +163,7 @@ namespace Lucene.Net.Store
string entriesFileName = IndexFileNames.SegmentFileName(IndexFileNames.StripExtension(name), "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION);
entriesStream = dir.OpenChecksumInput(entriesFileName, IOContext.READ_ONCE);
CodecUtil.CheckHeader(entriesStream, CompoundFileWriter.ENTRY_CODEC, CompoundFileWriter.VERSION_START, CompoundFileWriter.VERSION_CURRENT);
- int numEntries = entriesStream.ReadVInt();
+ int numEntries = entriesStream.ReadVInt32();
mapping = new Dictionary<string, FileEntry>(numEntries);
for (int i = 0; i < numEntries; i++)
{
@@ -179,8 +179,8 @@ namespace Lucene.Net.Store
{
mapping[id] = fileEntry;
}
- fileEntry.Offset = entriesStream.ReadLong();
- fileEntry.Length = entriesStream.ReadLong();
+ fileEntry.Offset = entriesStream.ReadInt64();
+ fileEntry.Length = entriesStream.ReadInt64();
}
if (version >= CompoundFileWriter.VERSION_CHECKSUM)
{
@@ -224,7 +224,7 @@ namespace Lucene.Net.Store
throw new CorruptIndexException("Incompatible format version: " + firstInt + " expected >= " + CompoundFileWriter.FORMAT_NO_SEGMENT_PREFIX + " (resource: " + stream + ")");
}
// It's a post-3.1 index, read the count.
- count = stream.ReadVInt();
+ count = stream.ReadVInt32();
stripSegmentName = false;
}
else
@@ -238,7 +238,7 @@ namespace Lucene.Net.Store
FileEntry entry = null;
for (int i = 0; i < count; i++)
{
- long offset = stream.ReadLong();
+ long offset = stream.ReadInt64();
if (offset < 0 || offset > streamLength)
{
throw new CorruptIndexException("Invalid CFS entry offset: " + offset + " (resource: " + stream + ")");
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Store/CompoundFileWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/CompoundFileWriter.cs b/src/Lucene.Net.Core/Store/CompoundFileWriter.cs
index 321e2aa..6287c12 100644
--- a/src/Lucene.Net.Core/Store/CompoundFileWriter.cs
+++ b/src/Lucene.Net.Core/Store/CompoundFileWriter.cs
@@ -247,12 +247,12 @@ namespace Lucene.Net.Store
private void WriteEntryTable(ICollection<FileEntry> entries, IndexOutput entryOut)
{
CodecUtil.WriteHeader(entryOut, ENTRY_CODEC, VERSION_CURRENT);
- entryOut.WriteVInt(entries.Count);
+ entryOut.WriteVInt32(entries.Count);
foreach (FileEntry fe in entries)
{
entryOut.WriteString(IndexFileNames.StripSegmentName(fe.File));
- entryOut.WriteLong(fe.Offset);
- entryOut.WriteLong(fe.Length);
+ entryOut.WriteInt64(fe.Offset);
+ entryOut.WriteInt64(fe.Length);
}
CodecUtil.WriteFooter(entryOut);
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Store/DataInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/DataInput.cs b/src/Lucene.Net.Core/Store/DataInput.cs
index 15738c3..8f13785 100644
--- a/src/Lucene.Net.Core/Store/DataInput.cs
+++ b/src/Lucene.Net.Core/Store/DataInput.cs
@@ -80,20 +80,25 @@ namespace Lucene.Net.Store
/// <summary>
/// Reads two bytes and returns a short.
- ///
+ /// <para/>
/// LUCENENET NOTE: Important - always cast to ushort (System.UInt16) before using to ensure
/// the value is positive!
+ /// <para/>
+ /// NOTE: this was readShort() in Lucene
/// </summary>
/// <seealso cref= DataOutput#writeByte(byte) </seealso>
- public virtual short ReadShort() // LUCENENET TODO: Rename ReadInt16() ?
+ public virtual short ReadInt16()
{
return (short)(ushort)(((ReadByte() & 0xFF) << 8) | (ReadByte() & 0xFF));
}
/// <summary>
- /// Reads four bytes and returns an int. </summary>
+ /// Reads four bytes and returns an int.
+ /// <para/>
+ /// NOTE: this was readInt() in Lucene
+ /// </summary>
/// <seealso cref= DataOutput#writeInt(int) </seealso>
- public virtual int ReadInt() // LUCENENET TODO: Rename ReadInt32() ?
+ public virtual int ReadInt32()
{
return ((ReadByte() & 0xFF) << 24) | ((ReadByte() & 0xFF) << 16) | ((ReadByte() & 0xFF) << 8) | (ReadByte() & 0xFF);
}
@@ -102,11 +107,13 @@ namespace Lucene.Net.Store
/// Reads an int stored in variable-length format. Reads between one and
/// five bytes. Smaller values take fewer bytes. Negative numbers are not
/// supported.
- /// <p>
+ /// <para/>
/// The format is described further in <seealso cref="DataOutput#writeVInt(int)"/>.
+ /// <para/>
+ /// NOTE: this was readVInt() in Lucene
/// </summary>
/// <seealso cref= DataOutput#writeVInt(int) </seealso>
- public virtual int ReadVInt() // LUCENENET TODO: Rename ReadVInt32() ?
+ public virtual int ReadVInt32()
{
// .NET Port: Going back to original code instead of Java code below due to sbyte/byte diff
/*byte b = ReadByte();
@@ -153,12 +160,15 @@ namespace Lucene.Net.Store
}
/// <summary>
- /// Reads eight bytes and returns a long. </summary>
+ /// Reads eight bytes and returns a long.
+ /// <para/>
+ /// NOTE: this was readLong() in Lucene
+ /// </summary>
/// <seealso cref= DataOutput#writeLong(long) </seealso>
- public virtual long ReadLong() // LUCENENET TODO: Rename ReadInt64() ?
+ public virtual long ReadInt64()
{
- long halfA = ((long)ReadInt()) << 32;
- long halfB = (ReadInt() & 0xFFFFFFFFL);
+ long halfA = ((long)ReadInt32()) << 32;
+ long halfB = (ReadInt32() & 0xFFFFFFFFL);
long ret = halfA | halfB;
return ret;
}
@@ -167,11 +177,13 @@ namespace Lucene.Net.Store
/// Reads a long stored in variable-length format. Reads between one and
/// nine bytes. Smaller values take fewer bytes. Negative numbers are not
/// supported.
- /// <p>
+ /// <para/>
/// The format is described further in <seealso cref="DataOutput#writeVInt(int)"/>.
+ /// <para/>
+ /// NOTE: this was readVLong() in Lucene
/// </summary>
/// <seealso cref= DataOutput#writeVLong(long) </seealso>
- public virtual long ReadVLong() // LUCENENET TODO: Rename ReadVInt64() ?
+ public virtual long ReadVInt64()
{
// .NET Port: going back to old style code
/*byte b = ReadByte();
@@ -245,7 +257,7 @@ namespace Lucene.Net.Store
/// <seealso cref= DataOutput#writeString(String) </seealso>
public virtual string ReadString()
{
- var length = ReadVInt();
+ var length = ReadVInt32();
var bytes = new byte[length];
ReadBytes(bytes, 0, length);
@@ -283,7 +295,7 @@ namespace Lucene.Net.Store
public virtual IDictionary<string, string> ReadStringStringMap()
{
IDictionary<string, string> map = new Dictionary<string, string>();
- int count = ReadInt();
+ int count = ReadInt32();
for (int i = 0; i < count; i++)
{
string key = ReadString();
@@ -301,7 +313,7 @@ namespace Lucene.Net.Store
public virtual ISet<string> ReadStringSet()
{
ISet<string> set = new HashSet<string>();
- int count = ReadInt();
+ int count = ReadInt32();
for (int i = 0; i < count; i++)
{
set.Add(ReadString());
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Store/DataOutput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/DataOutput.cs b/src/Lucene.Net.Core/Store/DataOutput.cs
index ac51f65..55960d2 100644
--- a/src/Lucene.Net.Core/Store/DataOutput.cs
+++ b/src/Lucene.Net.Core/Store/DataOutput.cs
@@ -63,11 +63,13 @@ namespace Lucene.Net.Store
/// <summary>
/// Writes an int as four bytes.
- /// <p>
+ /// <para/>
/// 32-bit unsigned integer written as four bytes, high-order bytes first.
+ /// <para/>
+ /// NOTE: this was writeInt() in Lucene
/// </summary>
/// <seealso cref= DataInput#readInt() </seealso>
- public virtual void WriteInt(int i) // LUCENENET TODO: Rename WriteInt32() ?
+ public virtual void WriteInt32(int i)
{
WriteByte((byte)(sbyte)(i >> 24));
WriteByte((byte)(sbyte)(i >> 16));
@@ -76,9 +78,12 @@ namespace Lucene.Net.Store
}
/// <summary>
- /// Writes a short as two bytes. </summary>
+ /// Writes a short as two bytes.
+ /// <para/>
+ /// NOTE: this was writeShort() in Lucene
+ /// </summary>
/// <seealso cref= DataInput#readShort() </seealso>
- public virtual void WriteShort(short i) // LUCENENET TODO: Rename WriteInt16() ?
+ public virtual void WriteInt16(short i)
{
WriteByte((byte)(sbyte)((ushort)i >> 8));
WriteByte((byte)(sbyte)(ushort)i);
@@ -185,12 +190,14 @@ namespace Lucene.Net.Store
/// </tr>
/// </table>
/// <p>this provides compression while still being efficient to decode.</p>
+ /// <para/>
+ /// NOTE: this was writeVInt() in Lucene
/// </summary>
/// <param name="i"> Smaller values take fewer bytes. Negative numbers are
/// supported, but should be avoided. </param>
/// <exception cref="System.IO.IOException"> If there is an I/O error writing to the underlying medium. </exception>
/// <seealso cref= DataInput#readVInt() </seealso>
- public void WriteVInt(int i) // LUCENENET TODO: Rename WriteVInt32() ?
+ public void WriteVInt32(int i)
{
while ((i & ~0x7F) != 0)
{
@@ -202,24 +209,29 @@ namespace Lucene.Net.Store
/// <summary>
/// Writes a long as eight bytes.
- /// <p>
+ /// <para/>
/// 64-bit unsigned integer written as eight bytes, high-order bytes first.
+ /// <para/>
+ /// NOTE: this was writeLong() in Lucene
/// </summary>
/// <seealso cref= DataInput#readLong() </seealso>
- public virtual void WriteLong(long i) // LUCENENET TODO: Rename WriteInt64() ?
+ public virtual void WriteInt64(long i)
{
- WriteInt((int)(i >> 32));
- WriteInt((int)i);
+ WriteInt32((int)(i >> 32));
+ WriteInt32((int)i);
}
/// <summary>
/// Writes an long in a variable-length format. Writes between one and nine
/// bytes. Smaller values take fewer bytes. Negative numbers are not
/// supported.
- /// <p>
- /// The format is described further in <seealso cref="DataOutput#writeVInt(int)"/>. </summary>
+ /// <para/>
+ /// The format is described further in <seealso cref="DataOutput#writeVInt(int)"/>.
+ /// <para/>
+ /// NOTE: this was writeVLong() in Lucene
+ /// </summary>
/// <seealso cref= DataInput#readVLong() </seealso>
- public void WriteVLong(long i) // LUCENENET TODO: Rename WriteVInt64() ?
+ public void WriteVInt64(long i)
{
Debug.Assert(i >= 0L);
while ((i & ~0x7FL) != 0L)
@@ -241,7 +253,7 @@ namespace Lucene.Net.Store
{
var utf8Result = new BytesRef(10);
UnicodeUtil.UTF16toUTF8(s.ToCharArray(), 0, s.Length, utf8Result);
- WriteVInt(utf8Result.Length);
+ WriteVInt32(utf8Result.Length);
WriteBytes(utf8Result.Bytes, 0, utf8Result.Length);
}
@@ -287,11 +299,11 @@ namespace Lucene.Net.Store
{
if (map == null)
{
- WriteInt(0);
+ WriteInt32(0);
}
else
{
- WriteInt(map.Count);
+ WriteInt32(map.Count);
foreach (KeyValuePair<string, string> entry in map)
{
WriteString(entry.Key);
@@ -312,11 +324,11 @@ namespace Lucene.Net.Store
{
if (set == null)
{
- WriteInt(0);
+ WriteInt32(0);
}
else
{
- WriteInt(set.Count);
+ WriteInt32(set.Count);
foreach (string value in set)
{
WriteString(value);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Support/ByteBuffer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/ByteBuffer.cs b/src/Lucene.Net.Core/Support/ByteBuffer.cs
index 9185b58..051d724 100644
--- a/src/Lucene.Net.Core/Support/ByteBuffer.cs
+++ b/src/Lucene.Net.Core/Support/ByteBuffer.cs
@@ -529,43 +529,94 @@ namespace Lucene.Net.Support
//public abstract CharBuffer AsCharBuffer();
- public abstract short GetShort();
+ /// <summary>
+ /// NOTE: This was getShort() in the JDK
+ /// </summary>
+ public abstract short GetInt16();
- public abstract ByteBuffer PutShort(short value);
+ /// <summary>
+ /// NOTE: This was putShort() in the JDK
+ /// </summary>
+ public abstract ByteBuffer PutInt16(short value);
- public abstract short GetShort(int index);
+ /// <summary>
+ /// NOTE: This was getShort() in the JDK
+ /// </summary>
+ public abstract short GetInt16(int index);
- public abstract ByteBuffer PutShort(int index, short value);
+ /// <summary>
+ /// NOTE: This was putShort() in the JDK
+ /// </summary>
+ public abstract ByteBuffer PutInt16(int index, short value);
// public abstract ShortBuffer AsShortBuffer();
- public abstract int GetInt();
+ /// <summary>
+ /// NOTE: This was getInt() in the JDK
+ /// </summary>
+ public abstract int GetInt32();
- public abstract ByteBuffer PutInt(int value);
+ /// <summary>
+ /// NOTE: This was putInt() in the JDK
+ /// </summary>
+ public abstract ByteBuffer PutInt32(int value);
- public abstract int GetInt(int index);
+ /// <summary>
+ /// NOTE: This was getInt() in the JDK
+ /// </summary>
+ public abstract int GetInt32(int index);
- public abstract ByteBuffer PutInt(int index, int value);
+ /// <summary>
+ /// NOTE: This was putInt() in the JDK
+ /// </summary>
+ public abstract ByteBuffer PutInt32(int index, int value);
//public abstract IntBuffer AsIntBuffer();
- public abstract long GetLong();
+ /// <summary>
+ /// NOTE: This was getLong() in the JDK
+ /// </summary>
+ public abstract long GetInt64();
- public abstract ByteBuffer PutLong(long value);
+ /// <summary>
+ /// NOTE: This was putLong() in the JDK
+ /// </summary>
+ public abstract ByteBuffer PutInt64(long value);
- public abstract long GetLong(int index);
+ /// <summary>
+ /// NOTE: This was getLong() in the JDK
+ /// </summary>
+ public abstract long GetInt64(int index);
- public abstract ByteBuffer PutLong(int index, long value);
+ /// <summary>
+ /// NOTE: This was putLong() in the JDK
+ /// </summary>
+ public abstract ByteBuffer PutInt64(int index, long value);
- public abstract LongBuffer AsLongBuffer();
+ /// <summary>
+ /// NOTE: This was asLongBuffer() in the JDK
+ /// </summary>
+ public abstract LongBuffer AsInt64Buffer();
- public abstract float GetFloat();
+ /// <summary>
+ /// NOTE: This was getFloat() in the JDK
+ /// </summary>
+ public abstract float GetSingle();
- public abstract ByteBuffer PutFloat(float value);
+ /// <summary>
+ /// NOTE: This was putFloat() in the JDK
+ /// </summary>
+ public abstract ByteBuffer PutSingle(float value);
- public abstract float GetFloat(int index);
+ /// <summary>
+ /// NOTE: This was getFloat() in the JDK
+ /// </summary>
+ public abstract float GetSingle(int index);
- public abstract ByteBuffer PutFloat(int index, float value);
+ /// <summary>
+ /// NOTE: This was putFloat() in the JDK
+ /// </summary>
+ public abstract ByteBuffer PutSingle(int index, float value);
//public abstract FloatBuffer AsFloatBuffer();
@@ -823,7 +874,10 @@ namespace Lucene.Net.Support
// short
- public override short GetShort()
+ /// <summary>
+ /// NOTE: This was getShort() in the JDK
+ /// </summary>
+ public override short GetInt16()
{
var littleEndian = BitConverter.ToInt16(hb, Ix(NextGetIndex(2)));
if (bigEndian)
@@ -833,7 +887,10 @@ namespace Lucene.Net.Support
return littleEndian;
}
- public override short GetShort(int index)
+ /// <summary>
+ /// NOTE: This was getShort() in the JDK
+ /// </summary>
+ public override short GetInt16(int index)
{
var littleEndian = BitConverter.ToInt16(hb, Ix(CheckIndex(index, 2)));
if (bigEndian)
@@ -843,7 +900,10 @@ namespace Lucene.Net.Support
return littleEndian;
}
- public override ByteBuffer PutShort(short value)
+ /// <summary>
+ /// NOTE: This was putShort() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt16(short value)
{
var bytes = BitConverter.GetBytes(bigEndian ? Number.FlipEndian(value) : value);
@@ -854,8 +914,10 @@ namespace Lucene.Net.Support
}
-
- public override ByteBuffer PutShort(int index, short value)
+ /// <summary>
+ /// NOTE: This was putShort() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt16(int index, short value)
{
var bytes = BitConverter.GetBytes(bigEndian ? Number.FlipEndian(value) : value);
@@ -886,7 +948,10 @@ namespace Lucene.Net.Support
// int
- public override int GetInt()
+ /// <summary>
+ /// NOTE: This was getInt() in the JDK
+ /// </summary>
+ public override int GetInt32()
{
var littleEndian = BitConverter.ToInt32(hb, Ix(NextGetIndex(4)));
if (bigEndian)
@@ -896,7 +961,10 @@ namespace Lucene.Net.Support
return littleEndian;
}
- public override int GetInt(int index)
+ /// <summary>
+ /// NOTE: This was getInt() in the JDK
+ /// </summary>
+ public override int GetInt32(int index)
{
var littleEndian = BitConverter.ToInt32(hb, Ix(CheckIndex(index, 4)));
if (bigEndian)
@@ -906,7 +974,10 @@ namespace Lucene.Net.Support
return littleEndian;
}
- public override ByteBuffer PutInt(int value)
+ /// <summary>
+ /// NOTE: This was putInt() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt32(int value)
{
var bytes = BitConverter.GetBytes(bigEndian ? Number.FlipEndian(value) : value);
@@ -918,7 +989,10 @@ namespace Lucene.Net.Support
return this;
}
- public override ByteBuffer PutInt(int index, int value)
+ /// <summary>
+ /// NOTE: This was putInt() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt32(int index, int value)
{
var bytes = BitConverter.GetBytes(bigEndian ? Number.FlipEndian(value) : value);
@@ -951,7 +1025,10 @@ namespace Lucene.Net.Support
// long
- public override long GetLong()
+ /// <summary>
+ /// NOTE: This was getLong() in the JDK
+ /// </summary>
+ public override long GetInt64()
{
var littleEndian = BitConverter.ToInt64(hb, Ix(NextGetIndex(8)));
if (bigEndian)
@@ -961,7 +1038,10 @@ namespace Lucene.Net.Support
return littleEndian;
}
- public override long GetLong(int index)
+ /// <summary>
+ /// NOTE: This was getLong() in the JDK
+ /// </summary>
+ public override long GetInt64(int index)
{
var littleEndian = BitConverter.ToInt64(hb, Ix(CheckIndex(index, 8)));
if (bigEndian)
@@ -971,7 +1051,10 @@ namespace Lucene.Net.Support
return littleEndian;
}
- public override ByteBuffer PutLong(long value)
+ /// <summary>
+ /// NOTE: This was putLong() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt64(long value)
{
var bytes = BitConverter.GetBytes(bigEndian ? Number.FlipEndian(value) : value);
@@ -988,8 +1071,10 @@ namespace Lucene.Net.Support
}
-
- public override ByteBuffer PutLong(int index, long value)
+ /// <summary>
+ /// NOTE: This was putLong() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt64(int index, long value)
{
var bytes = BitConverter.GetBytes(bigEndian ? Number.FlipEndian(value) : value);
@@ -1005,7 +1090,10 @@ namespace Lucene.Net.Support
return this;
}
- public override LongBuffer AsLongBuffer()
+ /// <summary>
+ /// NOTE: This was asLongBuffer() in the JDK
+ /// </summary>
+ public override LongBuffer AsInt64Buffer()
{
int size = this.Remaining >> 3;
int off = offset + Position;
@@ -1032,7 +1120,10 @@ namespace Lucene.Net.Support
// off)));
}
- public override float GetFloat()
+ /// <summary>
+ /// NOTE: This was getFloat() in the JDK
+ /// </summary>
+ public override float GetSingle()
{
byte[] temp = new byte[4];
System.Array.Copy(hb, Ix(NextGetIndex(4)), temp, 0, 4);
@@ -1043,7 +1134,10 @@ namespace Lucene.Net.Support
return BitConverter.ToSingle(temp, 0);
}
- public override float GetFloat(int index)
+ /// <summary>
+ /// NOTE: This was getFloat() in the JDK
+ /// </summary>
+ public override float GetSingle(int index)
{
var littleEndian = BitConverter.ToSingle(hb, Ix(CheckIndex(index, 4)));
if (bigEndian)
@@ -1053,7 +1147,10 @@ namespace Lucene.Net.Support
return littleEndian;
}
- public override ByteBuffer PutFloat(float value)
+ /// <summary>
+ /// NOTE: This was putFloat() in the JDK
+ /// </summary>
+ public override ByteBuffer PutSingle(float value)
{
var bytes = BitConverter.GetBytes(value);
@@ -1071,8 +1168,10 @@ namespace Lucene.Net.Support
}
-
- public override ByteBuffer PutFloat(int index, float value)
+ /// <summary>
+ /// NOTE: This was putFloat() in the JDK
+ /// </summary>
+ public override ByteBuffer PutSingle(int index, float value)
{
var bytes = BitConverter.GetBytes(value);
@@ -1305,12 +1404,18 @@ namespace Lucene.Net.Support
// short
- public override ByteBuffer PutShort(short x)
+ /// <summary>
+ /// NOTE: This was putShort() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt16(short x)
{
throw new ReadOnlyBufferException();
}
- public override ByteBuffer PutShort(int i, short x)
+ /// <summary>
+ /// NOTE: This was putShort() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt16(int i, short x)
{
throw new ReadOnlyBufferException();
}
@@ -1337,12 +1442,18 @@ namespace Lucene.Net.Support
// int
- public override ByteBuffer PutInt(int x)
+ /// <summary>
+ /// NOTE: This was putInt() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt32(int x)
{
throw new ReadOnlyBufferException();
}
- public override ByteBuffer PutInt(int i, int x)
+ /// <summary>
+ /// NOTE: This was putInt() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt32(int i, int x)
{
throw new ReadOnlyBufferException();
}
@@ -1369,17 +1480,26 @@ namespace Lucene.Net.Support
// long
- public override ByteBuffer PutLong(long x)
+ /// <summary>
+ /// NOTE: This was putLong() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt64(long x)
{
throw new ReadOnlyBufferException();
}
- public override ByteBuffer PutLong(int i, long x)
+ /// <summary>
+ /// NOTE: This was putLong() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt64(int i, long x)
{
throw new ReadOnlyBufferException();
}
- public override LongBuffer AsLongBuffer()
+ /// <summary>
+ /// NOTE: This was asLongBuffer() in the JDK
+ /// </summary>
+ public override LongBuffer AsInt64Buffer()
{
throw new NotImplementedException();
//int size = this.remaining() >> 3;
@@ -1401,12 +1521,18 @@ namespace Lucene.Net.Support
// float
- public override ByteBuffer PutFloat(float x)
+ /// <summary>
+ /// NOTE: This was putFloat() in the JDK
+ /// </summary>
+ public override ByteBuffer PutSingle(float x)
{
throw new ReadOnlyBufferException();
}
- public override ByteBuffer PutFloat(int i, float x)
+ /// <summary>
+ /// NOTE: This was putFloat() in the JDK
+ /// </summary>
+ public override ByteBuffer PutSingle(int i, float x)
{
throw new ReadOnlyBufferException();
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Support/DataInputStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/DataInputStream.cs b/src/Lucene.Net.Core/Support/DataInputStream.cs
index b135125..71cd5b1 100644
--- a/src/Lucene.Net.Core/Support/DataInputStream.cs
+++ b/src/Lucene.Net.Core/Support/DataInputStream.cs
@@ -96,7 +96,7 @@ namespace Lucene.Net.Support
return (ch != 0);
}
- public byte ReadByte()
+ public byte ReadByte() // LUCENENET TODO: Rename ReadSByte() ... change this to int the same as Stream.ReadByte() ? (since putting sbyte here is ugly)
{
int ch = @in.ReadByte();
if (ch < 0)
@@ -104,7 +104,7 @@ namespace Lucene.Net.Support
return (byte)(ch);
}
- public int ReadUnsignedByte()
+ public int ReadUnsignedByte() // LUCENET TODO: Rename ReadByte() after above method is fixed
{
int ch = @in.ReadByte();
if (ch < 0)
@@ -112,7 +112,10 @@ namespace Lucene.Net.Support
return ch;
}
- public short ReadShort()
+ /// <summary>
+ /// NOTE: This was readShort() in the JDK
+ /// </summary>
+ public short ReadInt16()
{
int ch1 = @in.ReadByte();
int ch2 = @in.ReadByte();
@@ -121,7 +124,10 @@ namespace Lucene.Net.Support
return (short)((ch1 << 8) + (ch2 << 0));
}
- public int ReadUnsignedShort()
+ /// <summary>
+ /// NOTE: This was readUnsignedShort() in the JDK
+ /// </summary>
+ public int ReadUInt16()
{
int ch1 = @in.ReadByte();
int ch2 = @in.ReadByte();
@@ -139,7 +145,10 @@ namespace Lucene.Net.Support
return (char)((ch1 << 8) + (ch2 << 0));
}
- public int ReadInt()
+ /// <summary>
+ /// NOTE: This was readInt() in the JDK
+ /// </summary>
+ public int ReadInt32()
{
int ch1 = @in.ReadByte();
int ch2 = @in.ReadByte();
@@ -152,7 +161,10 @@ namespace Lucene.Net.Support
private byte[] readBuffer = new byte[8];
- public long ReadLong()
+ /// <summary>
+ /// NOTE: This was readLong() in the JDK
+ /// </summary>
+ public long ReadInt64()
{
ReadFully(readBuffer, 0, 8);
return (((long)readBuffer[0] << 56) +
@@ -165,9 +177,12 @@ namespace Lucene.Net.Support
((readBuffer[7] & 255) << 0));
}
- public float ReadFloat()
+ /// <summary>
+ /// NOTE: This was readFloat() in the JDK
+ /// </summary>
+ public float ReadSingle()
{
- return Number.IntBitsToFloat(ReadInt());
+ return Number.Int32BitsToSingle(ReadInt32());
}
public double ReadDouble()
@@ -243,7 +258,7 @@ namespace Lucene.Net.Support
public static string ReadUTF(IDataInput @in)
{
- int utflen = @in.ReadUnsignedShort();
+ int utflen = @in.ReadUInt16();
byte[] bytearr = null;
char[] chararr = null;
if (@in is DataInputStream)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Support/DataOutputStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/DataOutputStream.cs b/src/Lucene.Net.Core/Support/DataOutputStream.cs
index ffc2ba5..fb6d57f 100644
--- a/src/Lucene.Net.Core/Support/DataOutputStream.cs
+++ b/src/Lucene.Net.Core/Support/DataOutputStream.cs
@@ -98,7 +98,10 @@ namespace Lucene.Net.Support
IncCount(1);
}
- public void WriteShort(int v)
+ /// <summary>
+ /// NOTE: This was writeShort() in the JDK
+ /// </summary>
+ public void WriteInt16(int v)
{
@out.WriteByte((byte)((int)((uint)v >> 8) & 0xFF));
@out.WriteByte((byte)((int)((uint)v >> 0) & 0xFF));
@@ -112,7 +115,10 @@ namespace Lucene.Net.Support
IncCount(2);
}
- public void WriteInt(int v)
+ /// <summary>
+ /// NOTE: This was writeInt() in the JDK
+ /// </summary>
+ public void WriteInt32(int v)
{
@out.WriteByte((byte)(int)(((uint)v >> 24) & 0xFF));
@out.WriteByte((byte)(int)(((uint)v >> 16) & 0xFF));
@@ -123,7 +129,10 @@ namespace Lucene.Net.Support
private byte[] writeBuffer = new byte[8];
- public void WriteLong(long v)
+ /// <summary>
+ /// NOTE: This was writeLong() in the JDK
+ /// </summary>
+ public void WriteInt64(long v)
{
writeBuffer[0] = (byte)(long)((ulong)v >> 56);
writeBuffer[1] = (byte)(long)((ulong)v >> 48);
@@ -137,14 +146,17 @@ namespace Lucene.Net.Support
IncCount(8);
}
- public void WriteFloat(float v)
+ /// <summary>
+ /// NOTE: This was writeFloat() in the JDK
+ /// </summary>
+ public void WriteSingle(float v)
{
- WriteInt(Number.FloatToIntBits(v));
+ WriteInt32(Number.SingleToInt32Bits(v));
}
public void WriteDouble(double v)
{
- WriteLong(Number.DoubleToLongBits(v));
+ WriteInt64(Number.DoubleToInt64Bits(v));
}
public void WriteBytes(string s)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Support/IDataInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/IDataInput.cs b/src/Lucene.Net.Core/Support/IDataInput.cs
index 40d56cf..c1c39fa 100644
--- a/src/Lucene.Net.Core/Support/IDataInput.cs
+++ b/src/Lucene.Net.Core/Support/IDataInput.cs
@@ -11,12 +11,28 @@
bool ReadBoolean();
byte ReadByte();
int ReadUnsignedByte();
- short ReadShort();
- int ReadUnsignedShort();
+
+ /// <summary>
+ /// NOTE: This was readShort() in the JDK
+ /// </summary>
+ short ReadInt16();
+
+ /// <summary>
+ /// NOTE: This was readUnsignedShort() in the JDK
+ /// </summary>
+ int ReadUInt16();
char ReadChar();
- int ReadInt();
- long ReadLong();
- float ReadFloat();
+
+ /// <summary>
+ /// NOTE: This was readInt() in the JDK
+ /// </summary>
+ int ReadInt32();
+
+ /// <summary>
+ /// NOTE: This was readLong() in the JDK
+ /// </summary>
+ long ReadInt64();
+ float ReadSingle();
double ReadDouble();
string ReadLine();
string ReadUTF();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Support/IDataOutput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/IDataOutput.cs b/src/Lucene.Net.Core/Support/IDataOutput.cs
index 6f81351..a40fd87 100644
--- a/src/Lucene.Net.Core/Support/IDataOutput.cs
+++ b/src/Lucene.Net.Core/Support/IDataOutput.cs
@@ -10,11 +10,27 @@
void Write(byte[] b, int off, int len);
void WriteBoolean(bool v);
void WriteByte(int v);
- void WriteShort(int v);
+
+ /// <summary>
+ /// NOTE: This was writeShort() in the JDK
+ /// </summary>
+ void WriteInt16(int v);
void WriteChar(int v);
- void WriteInt(int v);
- void WriteLong(long v);
- void WriteFloat(float v);
+
+ /// <summary>
+ /// NOTE: This was writeInt() in the JDK
+ /// </summary>
+ void WriteInt32(int v);
+
+ /// <summary>
+ /// NOTE: This was writeInt64() in the JDK
+ /// </summary>
+ void WriteInt64(long v);
+
+ /// <summary>
+ /// NOTE: This was writeSingle() in the JDK
+ /// </summary>
+ void WriteSingle(float v);
void WriteDouble(double v);
void WriteBytes(string s);
void WriteChars(string s);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Support/LongBuffer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/LongBuffer.cs b/src/Lucene.Net.Core/Support/LongBuffer.cs
index 89cb0fd..0bfdcf2 100644
--- a/src/Lucene.Net.Core/Support/LongBuffer.cs
+++ b/src/Lucene.Net.Core/Support/LongBuffer.cs
@@ -6,7 +6,7 @@ namespace Lucene.Net.Support
/// <summary>
/// Ported from Java's nio.LongBuffer
/// </summary>
- public abstract class LongBuffer : Buffer, IComparable<LongBuffer>
+ public abstract class LongBuffer : Buffer, IComparable<LongBuffer> // LUCENENET TODO: Rename Int64Buffer
{
// These fields are declared here rather than in Heap-X-Buffer in order to
// reduce the number of virtual method invocations needed to access these
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Support/MemoryMappedFileByteBuffer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/MemoryMappedFileByteBuffer.cs b/src/Lucene.Net.Core/Support/MemoryMappedFileByteBuffer.cs
index 3ac6654..2d29ae7 100644
--- a/src/Lucene.Net.Core/Support/MemoryMappedFileByteBuffer.cs
+++ b/src/Lucene.Net.Core/Support/MemoryMappedFileByteBuffer.cs
@@ -124,7 +124,10 @@ namespace Lucene.Net.Support
return this;
}
- public override short GetShort()
+ /// <summary>
+ /// NOTE: This was getShort() in the JDK
+ /// </summary>
+ public override short GetInt16()
{
var littleEndian = _accessor.ReadInt16(Ix(NextGetIndex(2)));
if (bigEndian)
@@ -134,7 +137,10 @@ namespace Lucene.Net.Support
return littleEndian;
}
- public override short GetShort(int index)
+ /// <summary>
+ /// NOTE: This was getShort() in the JDK
+ /// </summary>
+ public override short GetInt16(int index)
{
var littleEndian = _accessor.ReadInt16(Ix(CheckIndex(index, 2)));
if (bigEndian)
@@ -144,19 +150,28 @@ namespace Lucene.Net.Support
return littleEndian;
}
- public override ByteBuffer PutShort(short value)
+ /// <summary>
+ /// NOTE: This was putShort() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt16(short value)
{
_accessor.Write(Ix(NextPutIndex(2)), bigEndian ? Number.FlipEndian(value) : value);
return this;
}
- public override ByteBuffer PutShort(int index, short value)
+ /// <summary>
+ /// NOTE: This was putShort() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt16(int index, short value)
{
_accessor.Write(Ix(CheckIndex(index, 2)), bigEndian ? Number.FlipEndian(value) : value);
return this;
}
- public override int GetInt()
+ /// <summary>
+ /// NOTE: This was getInt() in the JDK
+ /// </summary>
+ public override int GetInt32()
{
var littleEndian = _accessor.ReadInt32(Ix(NextGetIndex(4)));
if (bigEndian)
@@ -166,7 +181,10 @@ namespace Lucene.Net.Support
return littleEndian;
}
- public override int GetInt(int index)
+ /// <summary>
+ /// NOTE: This was getInt() in the JDK
+ /// </summary>
+ public override int GetInt32(int index)
{
var littleEndian = _accessor.ReadInt32(Ix(CheckIndex(index, 4)));
if (bigEndian)
@@ -176,21 +194,29 @@ namespace Lucene.Net.Support
return littleEndian;
}
- public override ByteBuffer PutInt(int value)
+ /// <summary>
+ /// NOTE: This was putInt() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt32(int value)
{
_accessor.Write(Ix(NextPutIndex(4)), bigEndian ? Number.FlipEndian(value) : value);
return this;
}
-
- public override ByteBuffer PutInt(int index, int value)
+ /// <summary>
+ /// NOTE: This was putInt() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt32(int index, int value)
{
_accessor.Write(Ix(CheckIndex(index, 4)), bigEndian ? Number.FlipEndian(value) : value);
return this;
}
- public override long GetLong()
+ /// <summary>
+ /// NOTE: This was getLong() in the JDK
+ /// </summary>
+ public override long GetInt64()
{
var littleEndian = _accessor.ReadInt64(Ix(NextGetIndex(8)));
if (bigEndian)
@@ -200,7 +226,10 @@ namespace Lucene.Net.Support
return littleEndian;
}
- public override long GetLong(int index)
+ /// <summary>
+ /// NOTE: This was getLong() in the JDK
+ /// </summary>
+ public override long GetInt64(int index)
{
var littleEndian = _accessor.ReadInt64(Ix(CheckIndex(index, 8)));
if (bigEndian)
@@ -210,19 +239,28 @@ namespace Lucene.Net.Support
return littleEndian;
}
- public override ByteBuffer PutLong(long value)
+ /// <summary>
+ /// NOTE: This was putLong() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt64(long value)
{
_accessor.Write(Ix(NextPutIndex(8)), bigEndian ? Number.FlipEndian(value) : value);
return this;
}
- public override ByteBuffer PutLong(int index, long value)
+ /// <summary>
+ /// NOTE: This was putLong() in the JDK
+ /// </summary>
+ public override ByteBuffer PutInt64(int index, long value)
{
_accessor.Write(Ix(CheckIndex(index, 8)), bigEndian ? Number.FlipEndian(value) : value);
return this;
}
- public override float GetFloat()
+ /// <summary>
+ /// NOTE: This was getFloat() in the JDK
+ /// </summary>
+ public override float GetSingle()
{
byte[] temp = new byte[4];
temp[0] = _accessor.ReadByte(Ix(NextGetIndex()));
@@ -236,7 +274,10 @@ namespace Lucene.Net.Support
return BitConverter.ToSingle(temp, 0);
}
- public override float GetFloat(int index)
+ /// <summary>
+ /// NOTE: This was getFloat() in the JDK
+ /// </summary>
+ public override float GetSingle(int index)
{
byte[] temp = new byte[4];
temp[0] = _accessor.ReadByte(Ix(NextGetIndex(index)));
@@ -250,7 +291,10 @@ namespace Lucene.Net.Support
return BitConverter.ToSingle(temp, 0);
}
- public override ByteBuffer PutFloat(float value)
+ /// <summary>
+ /// NOTE: This was putFloat() in the JDK
+ /// </summary>
+ public override ByteBuffer PutSingle(float value)
{
var bytes = BitConverter.GetBytes(value);
@@ -266,7 +310,10 @@ namespace Lucene.Net.Support
return this;
}
- public override ByteBuffer PutFloat(int index, float value)
+ /// <summary>
+ /// NOTE: This was putFloat() in the JDK
+ /// </summary>
+ public override ByteBuffer PutSingle(int index, float value)
{
var bytes = BitConverter.GetBytes(value);
@@ -322,7 +369,10 @@ namespace Lucene.Net.Support
_accessor = null;
}
- public override LongBuffer AsLongBuffer()
+ /// <summary>
+ /// NOTE: This was asLongBuffer() in the JDK
+ /// </summary>
+ public override LongBuffer AsInt64Buffer()
{
throw new NotSupportedException();
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Support/Number.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/Number.cs b/src/Lucene.Net.Core/Support/Number.cs
index d5f6ab0..dad6dc5 100644
--- a/src/Lucene.Net.Core/Support/Number.cs
+++ b/src/Lucene.Net.Core/Support/Number.cs
@@ -391,18 +391,27 @@ namespace Lucene.Net.Support
return Convert.ToString(value, 2);
}
- public static float IntBitsToFloat(int value)
+ /// <summary>
+ /// NOTE: This was intBitsToFloat() in the JDK
+ /// </summary>
+ public static float Int32BitsToSingle(int value)
{
return BitConverter.ToSingle(BitConverter.GetBytes(value), 0);
}
- public static int FloatToRawIntBits(float value)
+ /// <summary>
+ /// NOTE: This was floatToRawIntBits() in the JDK
+ /// </summary>
+ public static int SingleToRawInt32Bits(float value)
{
// TODO: does this handle NaNs the same?
return BitConverter.ToInt32(BitConverter.GetBytes(value), 0);
}
- public static int FloatToIntBits(float value)
+ /// <summary>
+ /// NOTE: This was floatToIntBits() in the JDK
+ /// </summary>
+ public static int SingleToInt32Bits(float value)
{
if (float.IsNaN(value))
{
@@ -413,17 +422,26 @@ namespace Lucene.Net.Support
return BitConverter.ToInt32(BitConverter.GetBytes(value), 0);
}
- public static long FloatToLongBits(float value)
+ /// <summary>
+ /// NOTE: This was floatToLongBits() in the JDK
+ /// </summary>
+ public static long SingleToInt64Bits(float value)
{
return BitConverter.ToInt64(BitConverter.GetBytes(value), 0);
}
- public static long DoubleToRawLongBits(double value)
+ /// <summary>
+ /// NOTE: This was doubleToRawLongBits() in the JDK
+ /// </summary>
+ public static long DoubleToRawInt64Bits(double value)
{
return BitConverter.DoubleToInt64Bits(value);
}
- public static long DoubleToLongBits(double value)
+ /// <summary>
+ /// NOTE: This was doubleToLongBits() in the JDK
+ /// </summary>
+ public static long DoubleToInt64Bits(double value)
{
if (double.IsNaN(value))
{
@@ -467,8 +485,8 @@ namespace Lucene.Net.Support
//4 bytes
public static float FlipEndian(float f)
{
- int x = FloatToIntBits(f);
- return IntBitsToFloat(FlipEndian(x));
+ int x = SingleToInt32Bits(f);
+ return Int32BitsToSingle(FlipEndian(x));
}
//8 bytes
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Util/ArrayUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/ArrayUtil.cs b/src/Lucene.Net.Core/Util/ArrayUtil.cs
index 2df630e..474bb64 100644
--- a/src/Lucene.Net.Core/Util/ArrayUtil.cs
+++ b/src/Lucene.Net.Core/Util/ArrayUtil.cs
@@ -53,25 +53,30 @@ namespace Lucene.Net.Util
/// Parses the string argument as if it was an int value and returns the
/// result. Throws NumberFormatException if the string does not represent an
/// int quantity.
+ /// <para/>
+ /// NOTE: This was parseInt() in Lucene
/// </summary>
/// <param name="chars"> a string representation of an int quantity. </param>
/// <returns> int the value represented by the argument </returns>
/// <exception cref="NumberFormatException"> if the argument could not be parsed as an int quantity. </exception>
- public static int ParseInt(char[] chars) // LUCENENET TODO: Rename ParseInt32 ?
+ public static int ParseInt32(char[] chars)
{
- return ParseInt(chars, 0, chars.Length, 10);
+ return ParseInt32(chars, 0, chars.Length, 10);
}
/// <summary>
- /// Parses a char array into an int. </summary>
+ /// Parses a char array into an int.
+ /// <para/>
+ /// NOTE: This was parseInt() in Lucene
+ /// </summary>
/// <param name="chars"> the character array </param>
/// <param name="offset"> The offset into the array </param>
/// <param name="len"> The length </param>
/// <returns> the int </returns>
/// <exception cref="NumberFormatException"> if it can't parse </exception>
- public static int ParseInt(char[] chars, int offset, int len) // LUCENENET TODO: Rename ParseInt32 ?
+ public static int ParseInt32(char[] chars, int offset, int len)
{
- return ParseInt(chars, offset, len, 10);
+ return ParseInt32(chars, offset, len, 10);
}
/// <summary>
@@ -79,12 +84,14 @@ namespace Lucene.Net.Util
/// result. Throws NumberFormatException if the string does not represent an
/// int quantity. The second argument specifies the radix to use when parsing
/// the value.
+ /// <para/>
+ /// NOTE: This was parseInt() in Lucene
/// </summary>
/// <param name="chars"> a string representation of an int quantity. </param>
/// <param name="radix"> the base to use for conversion. </param>
/// <returns> int the value represented by the argument </returns>
/// <exception cref="NumberFormatException"> if the argument could not be parsed as an int quantity. </exception>
- public static int ParseInt(char[] chars, int offset, int len, int radix) // LUCENENET TODO: Rename ParseInt32 ?
+ public static int ParseInt32(char[] chars, int offset, int len, int radix)
{
int minRadix = 2, maxRadix = 36;
if (chars == null || radix < minRadix || radix > maxRadix)
@@ -757,7 +764,10 @@ namespace Lucene.Net.Util
return false;
}
- public static int[] ToIntArray(ICollection<int?> ints) // LUCENENET TODO: Nullable issue - the cast to int probably won't work here
+ /// <summary>
+ /// NOTE: This was toIntArray() in Lucene
+ /// </summary>
+ public static int[] ToInt32Array(ICollection<int?> ints) // LUCENENET TODO: Nullable issue - the cast to int probably won't work here
{
int[] result = new int[ints.Count];
int upto = 0;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Util/Automaton/BasicOperations.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Automaton/BasicOperations.cs b/src/Lucene.Net.Core/Util/Automaton/BasicOperations.cs
index 5b560b3..1e6ee2c 100644
--- a/src/Lucene.Net.Core/Util/Automaton/BasicOperations.cs
+++ b/src/Lucene.Net.Core/Util/Automaton/BasicOperations.cs
@@ -861,7 +861,7 @@ namespace Lucene.Net.Util.Automaton
statesSet.ComputeHash();
State q;
- newstate.TryGetValue(statesSet.ToFrozenIntSet(), out q);
+ newstate.TryGetValue(statesSet.ToFrozenInt32Set(), out q);
if (q == null)
{
q = new State();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Util/Automaton/SortedIntSet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Automaton/SortedIntSet.cs b/src/Lucene.Net.Core/Util/Automaton/SortedIntSet.cs
index 32688d5..44b9a8a 100644
--- a/src/Lucene.Net.Core/Util/Automaton/SortedIntSet.cs
+++ b/src/Lucene.Net.Core/Util/Automaton/SortedIntSet.cs
@@ -25,7 +25,7 @@ namespace Lucene.Net.Util.Automaton
// Just holds a set of int[] states, plus a corresponding
// int[] count per state. Used by
// BasicOperations.determinize
- internal sealed class SortedIntSet : IEquatable<SortedIntSet>, IEquatable<SortedIntSet.FrozenIntSet>
+ internal sealed class SortedIntSet : IEquatable<SortedIntSet>, IEquatable<SortedIntSet.FrozenIntSet> // LUCENENET TODO: Rename SortedInt32Set
{
internal int[] values;
internal int[] counts;
@@ -184,7 +184,7 @@ namespace Lucene.Net.Util.Automaton
}
}
- public FrozenIntSet ToFrozenIntSet() // LUCENENET TODO: This didn't exist in the original
+ public FrozenIntSet ToFrozenInt32Set() // LUCENENET TODO: This didn't exist in the original
{
int[] c = new int[upto];
Array.Copy(values, 0, c, 0, upto);
@@ -280,7 +280,7 @@ namespace Lucene.Net.Util.Automaton
return sb.ToString();
}
- public sealed class FrozenIntSet : IEquatable<SortedIntSet>, IEquatable<FrozenIntSet>
+ public sealed class FrozenIntSet : IEquatable<SortedIntSet>, IEquatable<FrozenIntSet> // LUCENENET TODO: Rename FrozenInt32Set
{
internal readonly int[] values;
internal readonly int hashCode;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 2053fed..609a3a5 100644
--- a/src/Lucene.Net.Core/Util/Automaton/SpecialOperations.cs
+++ b/src/Lucene.Net.Core/Util/Automaton/SpecialOperations.cs
@@ -319,7 +319,7 @@ namespace Lucene.Net.Util.Automaton
for (int n = t.min; n <= t.max; n++)
{
path.Grow(path.Length + 1);
- path.Ints[path.Length] = n;
+ path.Int32s[path.Length] = n;
path.Length++;
if (t.to.accept)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 39adf42..b147f4d 100644
--- a/src/Lucene.Net.Core/Util/Fst/Builder.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Builder.cs
@@ -314,7 +314,7 @@ namespace Lucene.Net.Util.Fst
{
// this node doesn't make it -- deref it
node.Clear();
- parent.DeleteLast(lastInput.Ints[lastInput.Offset + idx - 1], node);
+ parent.DeleteLast(lastInput.Int32s[lastInput.Offset + idx - 1], node);
}
else
{
@@ -336,13 +336,13 @@ namespace Lucene.Net.Util.Fst
// this node makes it and we now compile it. first,
// compile any targets that were previously
// undecided:
- parent.ReplaceLast(lastInput.Ints[lastInput.Offset + idx - 1], CompileNode(node, 1 + lastInput.Length - idx), nextFinalOutput, isFinal);
+ parent.ReplaceLast(lastInput.Int32s[lastInput.Offset + idx - 1], CompileNode(node, 1 + lastInput.Length - idx), nextFinalOutput, isFinal);
}
else
{
// replaceLast just to install
// nextFinalOutput/isFinal onto the arc
- parent.ReplaceLast(lastInput.Ints[lastInput.Offset + idx - 1], node, nextFinalOutput, isFinal);
+ parent.ReplaceLast(lastInput.Int32s[lastInput.Offset + idx - 1], node, nextFinalOutput, isFinal);
// this node will stay in play for now, since we are
// undecided on whether to prune it. later, it
// will be either compiled or pruned, so we must
@@ -425,7 +425,7 @@ namespace Lucene.Net.Util.Fst
{
frontier[pos1].InputCount++;
//System.out.println(" incr " + pos1 + " ct=" + frontier[pos1].inputCount + " n=" + frontier[pos1]);
- if (pos1 >= pos1Stop || lastInput.Ints[pos1] != input.Ints[pos2])
+ if (pos1 >= pos1Stop || lastInput.Int32s[pos1] != input.Int32s[pos2])
{
break;
}
@@ -452,7 +452,7 @@ namespace Lucene.Net.Util.Fst
// init tail states for current input
for (int idx = prefixLenPlus1; idx <= input.Length; idx++)
{
- frontier[idx - 1].AddArc(input.Ints[input.Offset + idx - 1], frontier[idx]);
+ frontier[idx - 1].AddArc(input.Int32s[input.Offset + idx - 1], frontier[idx]);
frontier[idx].InputCount++;
}
@@ -470,7 +470,7 @@ namespace Lucene.Net.Util.Fst
UnCompiledNode<T> node = frontier[idx];
UnCompiledNode<T> parentNode = frontier[idx - 1];
- T lastOutput = parentNode.GetLastOutput(input.Ints[input.Offset + idx - 1]);
+ T lastOutput = parentNode.GetLastOutput(input.Int32s[input.Offset + idx - 1]);
Debug.Assert(ValidOutput(lastOutput));
T commonOutputPrefix;
@@ -482,7 +482,7 @@ namespace Lucene.Net.Util.Fst
Debug.Assert(ValidOutput(commonOutputPrefix));
wordSuffix = fst.Outputs.Subtract(lastOutput, commonOutputPrefix);
Debug.Assert(ValidOutput(wordSuffix));
- parentNode.SetLastOutput(input.Ints[input.Offset + idx - 1], commonOutputPrefix);
+ parentNode.SetLastOutput(input.Int32s[input.Offset + idx - 1], commonOutputPrefix);
node.PrependOutput(wordSuffix);
}
else
@@ -504,11 +504,11 @@ namespace Lucene.Net.Util.Fst
{
// this new arc is private to this new input; set its
// arc output to the leftover output:
- frontier[prefixLenPlus1 - 1].SetLastOutput(input.Ints[input.Offset + prefixLenPlus1 - 1], output);
+ frontier[prefixLenPlus1 - 1].SetLastOutput(input.Int32s[input.Offset + prefixLenPlus1 - 1], output);
}
// save last input
- lastInput.CopyInts(input);
+ lastInput.CopyInt32s(input);
//System.out.println(" count[0]=" + frontier[0].inputCount);
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Util/Fst/ByteSequenceOutputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/ByteSequenceOutputs.cs b/src/Lucene.Net.Core/Util/Fst/ByteSequenceOutputs.cs
index f045b67..7f41142 100644
--- a/src/Lucene.Net.Core/Util/Fst/ByteSequenceOutputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/ByteSequenceOutputs.cs
@@ -134,13 +134,13 @@ namespace Lucene.Net.Util.Fst
public override void Write(BytesRef prefix, DataOutput @out)
{
Debug.Assert(prefix != null);
- @out.WriteVInt(prefix.Length);
+ @out.WriteVInt32(prefix.Length);
@out.WriteBytes(prefix.Bytes, prefix.Offset, prefix.Length);
}
public override BytesRef Read(DataInput @in)
{
- int len = @in.ReadVInt();
+ int len = @in.ReadVInt32();
if (len == 0)
{
return NO_OUTPUT;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/BytesStore.cs b/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
index 25e473e..294165f 100644
--- a/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
+++ b/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
@@ -266,9 +266,11 @@ namespace Lucene.Net.Util.Fst
/// <summary>
/// Writes an int at the absolute position without
- /// changing the current pointer.
+ /// changing the current pointer.
+ /// <para/>
+ /// NOTE: This was writeInt() in Lucene
/// </summary>
- public virtual void WriteInt(long pos, int value) // LUCENENET TODO: Change to WriteInt32 ?
+ public virtual void WriteInt32(long pos, int value)
{
int blockIndex = (int)(pos >> blockBits);
int upto = (int)(pos & blockMask);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Util/Fst/CharSequenceOutputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/CharSequenceOutputs.cs b/src/Lucene.Net.Core/Util/Fst/CharSequenceOutputs.cs
index 017ca94..36e4297 100644
--- a/src/Lucene.Net.Core/Util/Fst/CharSequenceOutputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/CharSequenceOutputs.cs
@@ -134,17 +134,17 @@ namespace Lucene.Net.Util.Fst
public override void Write(CharsRef prefix, DataOutput @out)
{
Debug.Assert(prefix != null);
- @out.WriteVInt(prefix.Length);
+ @out.WriteVInt32(prefix.Length);
// TODO: maybe UTF8?
for (int idx = 0; idx < prefix.Length; idx++)
{
- @out.WriteVInt(prefix.Chars[prefix.Offset + idx]);
+ @out.WriteVInt32(prefix.Chars[prefix.Offset + idx]);
}
}
public override CharsRef Read(DataInput @in)
{
- int len = @in.ReadVInt();
+ int len = @in.ReadVInt32();
if (len == 0)
{
return NO_OUTPUT;
@@ -154,7 +154,7 @@ namespace Lucene.Net.Util.Fst
CharsRef output = new CharsRef(len);
for (int idx = 0; idx < len; idx++)
{
- output.Chars[idx] = (char)@in.ReadVInt();
+ output.Chars[idx] = (char)@in.ReadVInt32();
}
output.Length = len;
return output;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 1f9fc1d..8cc840d 100644
--- a/src/Lucene.Net.Core/Util/Fst/FST.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FST.cs
@@ -251,7 +251,7 @@ namespace Lucene.Net.Util.Fst
// accepts empty string
// 1 KB blocks:
BytesStore emptyBytes = new BytesStore(10);
- int numBytes = @in.ReadVInt();
+ int numBytes = @in.ReadVInt32();
emptyBytes.CopyBytes(@in, numBytes);
// De-serialize empty-string output:
@@ -303,12 +303,12 @@ namespace Lucene.Net.Util.Fst
{
nodeRefToAddress = null;
}
- startNode = @in.ReadVLong();
- nodeCount = @in.ReadVLong();
- arcCount = @in.ReadVLong();
- arcWithOutputCount = @in.ReadVLong();
+ startNode = @in.ReadVInt64();
+ nodeCount = @in.ReadVInt64();
+ arcCount = @in.ReadVInt64();
+ arcWithOutputCount = @in.ReadVInt64();
- long numBytes_ = @in.ReadVLong();
+ long numBytes_ = @in.ReadVInt64();
bytes = new BytesStore(@in, numBytes_, 1 << maxBlockBits);
NO_OUTPUT = outputs.NoOutput;
@@ -533,7 +533,7 @@ namespace Lucene.Net.Util.Fst
upto++;
}
}
- @out.WriteVInt(emptyOutputBytes.Length);
+ @out.WriteVInt32(emptyOutputBytes.Length);
@out.WriteBytes(emptyOutputBytes, 0, emptyOutputBytes.Length);
}
else
@@ -558,12 +558,12 @@ namespace Lucene.Net.Util.Fst
{
((PackedInts.Mutable)nodeRefToAddress).Save(@out);
}
- @out.WriteVLong(startNode);
- @out.WriteVLong(nodeCount);
- @out.WriteVLong(arcCount);
- @out.WriteVLong(arcWithOutputCount);
+ @out.WriteVInt64(startNode);
+ @out.WriteVInt64(nodeCount);
+ @out.WriteVInt64(arcCount);
+ @out.WriteVInt64(arcWithOutputCount);
long numBytes = bytes.Position;
- @out.WriteVLong(numBytes);
+ @out.WriteVInt64(numBytes);
bytes.WriteTo(@out);
}
@@ -604,11 +604,11 @@ namespace Lucene.Net.Util.Fst
else if (inputType == FST.INPUT_TYPE.BYTE2)
{
Debug.Assert(v <= 65535, "v=" + v);
- @out.WriteShort((short)v);
+ @out.WriteInt16((short)v);
}
else
{
- @out.WriteVInt(v);
+ @out.WriteVInt32(v);
}
}
@@ -623,11 +623,11 @@ namespace Lucene.Net.Util.Fst
else if (inputType == FST.INPUT_TYPE.BYTE2)
{
// Unsigned short:
- v = @in.ReadShort() & 0xFFFF;
+ v = @in.ReadInt16() & 0xFFFF;
}
else
{
- v = @in.ReadVInt();
+ v = @in.ReadVInt32();
}
return v;
}
@@ -748,7 +748,7 @@ namespace Lucene.Net.Util.Fst
{
Debug.Assert(target.Node > 0);
//System.out.println(" write target");
- bytes.WriteVLong(target.Node);
+ bytes.WriteVInt64(target.Node);
}
// just write the arcs "like normal" on first pass,
@@ -797,8 +797,8 @@ namespace Lucene.Net.Util.Fst
var bad = new ByteArrayDataOutput(header);
// write a "false" first arc:
bad.WriteByte((byte)FST.ARCS_AS_FIXED_ARRAY);
- bad.WriteVInt(nodeIn.NumArcs);
- bad.WriteVInt(maxBytesPerArc);
+ bad.WriteVInt32(nodeIn.NumArcs);
+ bad.WriteVInt32(maxBytesPerArc);
int headerLen = bad.Position;
long fixedArrayStart = startAddress + headerLen;
@@ -919,14 +919,14 @@ namespace Lucene.Net.Util.Fst
if (b == FST.ARCS_AS_FIXED_ARRAY)
{
// array: jump straight to end
- arc.NumArcs = @in.ReadVInt();
+ arc.NumArcs = @in.ReadVInt32();
if (packed || version >= FST.VERSION_VINT_TARGET)
{
- arc.BytesPerArc = @in.ReadVInt();
+ arc.BytesPerArc = @in.ReadVInt32();
}
else
{
- arc.BytesPerArc = @in.ReadInt();
+ arc.BytesPerArc = @in.ReadInt32();
}
//System.out.println(" array numArcs=" + arc.numArcs + " bpa=" + arc.bytesPerArc);
arc.PosArcsStart = @in.Position;
@@ -958,7 +958,7 @@ namespace Lucene.Net.Util.Fst
}
else if (packed)
{
- @in.ReadVLong();
+ @in.ReadVInt64();
}
else
{
@@ -981,11 +981,11 @@ namespace Lucene.Net.Util.Fst
long target;
if (version < FST.VERSION_VINT_TARGET)
{
- target = @in.ReadInt();
+ target = @in.ReadInt32();
}
else
{
- target = @in.ReadVLong();
+ target = @in.ReadVInt64();
}
return target;
}
@@ -1039,14 +1039,14 @@ namespace Lucene.Net.Util.Fst
{
//System.out.println(" fixedArray");
// this is first arc in a fixed-array
- arc.NumArcs = @in.ReadVInt();
+ arc.NumArcs = @in.ReadVInt32();
if (packed || version >= FST.VERSION_VINT_TARGET)
{
- arc.BytesPerArc = @in.ReadVInt();
+ arc.BytesPerArc = @in.ReadVInt32();
}
else
{
- arc.BytesPerArc = @in.ReadInt();
+ arc.BytesPerArc = @in.ReadInt32();
}
arc.ArcIdx = -1;
arc.NextArc = arc.PosArcsStart = @in.Position;
@@ -1118,16 +1118,16 @@ namespace Lucene.Net.Util.Fst
if (b == FST.ARCS_AS_FIXED_ARRAY)
{
//System.out.println(" nextArc fixed array");
- @in.ReadVInt();
+ @in.ReadVInt32();
// Skip bytesPerArc:
if (packed || version >= FST.VERSION_VINT_TARGET)
{
- @in.ReadVInt();
+ @in.ReadVInt32();
}
else
{
- @in.ReadInt();
+ @in.ReadInt32();
}
}
else
@@ -1245,7 +1245,7 @@ namespace Lucene.Net.Util.Fst
if (packed)
{
long pos = @in.Position;
- long code = @in.ReadVLong();
+ long code = @in.ReadVInt64();
if (arc.Flag(FST.BIT_TARGET_DELTA))
{
// Address is delta-coded from current address:
@@ -1340,14 +1340,14 @@ namespace Lucene.Net.Util.Fst
if (@in.ReadByte() == FST.ARCS_AS_FIXED_ARRAY)
{
// Arcs are full array; do binary search:
- arc.NumArcs = @in.ReadVInt();
+ arc.NumArcs = @in.ReadVInt32();
if (packed || version >= FST.VERSION_VINT_TARGET)
{
- arc.BytesPerArc = @in.ReadVInt();
+ arc.BytesPerArc = @in.ReadVInt32();
}
else
{
- arc.BytesPerArc = @in.ReadInt();
+ arc.BytesPerArc = @in.ReadInt32();
}
arc.PosArcsStart = @in.Position;
int low = 0;
@@ -1429,7 +1429,7 @@ namespace Lucene.Net.Util.Fst
{
if (packed)
{
- @in.ReadVLong();
+ @in.ReadVInt64();
}
else
{
@@ -1812,8 +1812,8 @@ namespace Lucene.Net.Util.Fst
bytesPerArc = arc.BytesPerArc;
}
writer.WriteByte((byte)FST.ARCS_AS_FIXED_ARRAY);
- writer.WriteVInt(arc.NumArcs);
- writer.WriteVInt(bytesPerArc);
+ writer.WriteVInt32(arc.NumArcs);
+ writer.WriteVInt32(bytesPerArc);
//System.out.println("node " + node + ": " + arc.numArcs + " arcs");
}
@@ -1930,7 +1930,7 @@ namespace Lucene.Net.Util.Fst
if (Flag(flags, FST.BIT_TARGET_DELTA))
{
//System.out.println(" delta");
- writer.WriteVLong(delta);
+ writer.WriteVInt64(delta);
if (!retry)
{
deltaCount++;
@@ -1945,7 +1945,7 @@ namespace Lucene.Net.Util.Fst
System.out.println(" abs");
}
*/
- writer.WriteVLong(absPtr);
+ writer.WriteVInt64(absPtr);
if (!retry)
{
if (absPtr >= topNodeMap.Count)