http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Search/FieldCacheImpl.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/FieldCacheImpl.cs b/src/Lucene.Net.Core/Search/FieldCacheImpl.cs index e1e7c21..8891e73 100644 --- a/src/Lucene.Net.Core/Search/FieldCacheImpl.cs +++ b/src/Lucene.Net.Core/Search/FieldCacheImpl.cs @@ -36,9 +36,9 @@ namespace Lucene.Net.Search using FixedBitSet = Lucene.Net.Util.FixedBitSet; using GrowableWriter = Lucene.Net.Util.Packed.GrowableWriter; using IndexReader = Lucene.Net.Index.IndexReader; - using MonotonicAppendingLongBuffer = Lucene.Net.Util.Packed.MonotonicAppendingLongBuffer; + using MonotonicAppendingInt64Buffer = Lucene.Net.Util.Packed.MonotonicAppendingInt64Buffer; using NumericDocValues = Lucene.Net.Index.NumericDocValues; - using PackedInts = Lucene.Net.Util.Packed.PackedInts; + using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s; using PagedBytes = Lucene.Net.Util.PagedBytes; using SegmentReader = Lucene.Net.Index.SegmentReader; using SortedDocValues = Lucene.Net.Index.SortedDocValues; @@ -71,10 +71,10 @@ namespace Lucene.Net.Search { caches = new Dictionary<Type, Cache>(9); caches[typeof(sbyte)] = new ByteCache(this); - caches[typeof(short)] = new ShortCache(this); - caches[typeof(int)] = new IntCache(this); - caches[typeof(float)] = new FloatCache(this); - caches[typeof(long)] = new LongCache(this); + caches[typeof(short)] = new Int16Cache(this); + caches[typeof(int)] = new Int32Cache(this); + caches[typeof(float)] = new SingleCache(this); + caches[typeof(long)] = new Int64Cache(this); caches[typeof(double)] = new DoubleCache(this); caches[typeof(BinaryDocValues)] = new BinaryDocValuesCache(this); caches[typeof(SortedDocValues)] = new SortedDocValuesCache(this); @@ -608,7 +608,7 @@ namespace Lucene.Net.Search /// <summary> /// NOTE: this was getShorts() in Lucene /// </summary> - public virtual FieldCache.Shorts GetInt16s(AtomicReader reader, string field, bool setDocsWithField) + public virtual FieldCache.Int16s GetInt16s(AtomicReader reader, string field, bool setDocsWithField) { return GetInt16s(reader, field, null, setDocsWithField); } @@ -617,21 +617,21 @@ namespace Lucene.Net.Search /// <summary> /// NOTE: this was getShorts() in Lucene /// </summary> - public virtual FieldCache.Shorts GetInt16s(AtomicReader reader, string field, FieldCache.IShortParser parser, bool setDocsWithField) + public virtual FieldCache.Int16s GetInt16s(AtomicReader reader, string field, FieldCache.IInt16Parser parser, bool setDocsWithField) { NumericDocValues valuesIn = reader.GetNumericDocValues(field); if (valuesIn != null) { // Not cached here by FieldCacheImpl (cached instead // per-thread by SegmentReader): - return new FieldCache_ShortsAnonymousInnerClassHelper(this, valuesIn); + return new FieldCache_Int16sAnonymousInnerClassHelper(this, valuesIn); } else { FieldInfo info = reader.FieldInfos.FieldInfo(field); if (info == null) { - return FieldCache.Shorts.EMPTY; + return FieldCache.Int16s.EMPTY; } else if (info.HasDocValues) { @@ -639,19 +639,19 @@ namespace Lucene.Net.Search } else if (!info.IsIndexed) { - return FieldCache.Shorts.EMPTY; + return FieldCache.Int16s.EMPTY; } - return (FieldCache.Shorts)caches[typeof(short)].Get(reader, new CacheKey(field, parser), setDocsWithField); + return (FieldCache.Int16s)caches[typeof(short)].Get(reader, new CacheKey(field, parser), setDocsWithField); } } - private class FieldCache_ShortsAnonymousInnerClassHelper : FieldCache.Shorts + private class FieldCache_Int16sAnonymousInnerClassHelper : FieldCache.Int16s { private readonly FieldCacheImpl outerInstance; private NumericDocValues valuesIn; - public FieldCache_ShortsAnonymousInnerClassHelper(FieldCacheImpl outerInstance, NumericDocValues valuesIn) + public FieldCache_Int16sAnonymousInnerClassHelper(FieldCacheImpl outerInstance, NumericDocValues valuesIn) { this.outerInstance = outerInstance; this.valuesIn = valuesIn; @@ -663,11 +663,14 @@ namespace Lucene.Net.Search } } - internal class ShortsFromArray : FieldCache.Shorts + /// <summary> + /// NOTE: This was ShortsFromArray in Lucene + /// </summary> + internal class Int16sFromArray : FieldCache.Int16s { private readonly short[] values; - public ShortsFromArray(short[] values) + public Int16sFromArray(short[] values) { this.values = values; } @@ -678,9 +681,12 @@ namespace Lucene.Net.Search } } - internal sealed class ShortCache : Cache + /// <summary> + /// NOTE: This was ShortCache in Lucene + /// </summary> + internal sealed class Int16Cache : Cache { - internal ShortCache(FieldCacheImpl wrapper) + internal Int16Cache(FieldCacheImpl wrapper) : base(wrapper) { } @@ -689,7 +695,7 @@ namespace Lucene.Net.Search { int maxDoc = reader.MaxDoc; short[] values; - FieldCache.IShortParser parser = (FieldCache.IShortParser)key.custom; + FieldCache.IInt16Parser parser = (FieldCache.IInt16Parser)key.custom; if (parser == null) { // Confusing: must delegate to wrapper (vs simply @@ -707,17 +713,17 @@ namespace Lucene.Net.Search { wrapper.SetDocsWithField(reader, key.field, u.docsWithField); } - return new ShortsFromArray(values); + return new Int16sFromArray(values); } private class UninvertAnonymousInnerClassHelper : Uninvert { - private readonly ShortCache outerInstance; + private readonly Int16Cache outerInstance; private short[] values; - private FieldCache.IShortParser parser; + private FieldCache.IInt16Parser parser; - public UninvertAnonymousInnerClassHelper(ShortCache outerInstance, short[] values, FieldCache.IShortParser parser) + public UninvertAnonymousInnerClassHelper(Int16Cache outerInstance, short[] values, FieldCache.IInt16Parser parser) { this.outerInstance = outerInstance; this.values = values; @@ -747,7 +753,7 @@ namespace Lucene.Net.Search /// <summary> /// NOTE: this was getInts() in Lucene /// </summary> - public virtual FieldCache.Ints GetInt32s(AtomicReader reader, string field, bool setDocsWithField) + public virtual FieldCache.Int32s GetInt32s(AtomicReader reader, string field, bool setDocsWithField) { return GetInt32s(reader, field, null, setDocsWithField); } @@ -755,21 +761,21 @@ namespace Lucene.Net.Search /// <summary> /// NOTE: this was getInts() in Lucene /// </summary> - public virtual FieldCache.Ints GetInt32s(AtomicReader reader, string field, FieldCache.IIntParser parser, bool setDocsWithField) + public virtual FieldCache.Int32s GetInt32s(AtomicReader reader, string field, FieldCache.IInt32Parser parser, bool setDocsWithField) { NumericDocValues valuesIn = reader.GetNumericDocValues(field); if (valuesIn != null) { // Not cached here by FieldCacheImpl (cached instead // per-thread by SegmentReader): - return new FieldCache_IntsAnonymousInnerClassHelper(this, valuesIn); + return new FieldCache_Int32sAnonymousInnerClassHelper(this, valuesIn); } else { FieldInfo info = reader.FieldInfos.FieldInfo(field); if (info == null) { - return FieldCache.Ints.EMPTY; + return FieldCache.Int32s.EMPTY; } else if (info.HasDocValues) { @@ -777,19 +783,19 @@ namespace Lucene.Net.Search } else if (!info.IsIndexed) { - return FieldCache.Ints.EMPTY; + return FieldCache.Int32s.EMPTY; } - return (FieldCache.Ints)caches[typeof(int)].Get(reader, new CacheKey(field, parser), setDocsWithField); + return (FieldCache.Int32s)caches[typeof(int)].Get(reader, new CacheKey(field, parser), setDocsWithField); } } - private class FieldCache_IntsAnonymousInnerClassHelper : FieldCache.Ints + private class FieldCache_Int32sAnonymousInnerClassHelper : FieldCache.Int32s { private readonly FieldCacheImpl outerInstance; private NumericDocValues valuesIn; - public FieldCache_IntsAnonymousInnerClassHelper(FieldCacheImpl outerInstance, NumericDocValues valuesIn) + public FieldCache_Int32sAnonymousInnerClassHelper(FieldCacheImpl outerInstance, NumericDocValues valuesIn) { this.outerInstance = outerInstance; this.valuesIn = valuesIn; @@ -801,12 +807,15 @@ namespace Lucene.Net.Search } } - internal class IntsFromArray : FieldCache.Ints + /// <summary> + /// NOTE: This was IntsFromArray in Lucene + /// </summary> + internal class Int32sFromArray : FieldCache.Int32s { - private readonly PackedInts.Reader values; + private readonly PackedInt32s.Reader values; private readonly int minValue; - public IntsFromArray(PackedInts.Reader values, int minValue) + public Int32sFromArray(PackedInt32s.Reader values, int minValue) { Debug.Assert(values.BitsPerValue <= 32); this.values = values; @@ -847,16 +856,19 @@ namespace Lucene.Net.Search public long MinValue { get; set; } // LUCENENET NOTE: for some reason, this was not marked readonly } - internal sealed class IntCache : Cache + /// <summary> + /// NOTE: This was IntCache in Lucene + /// </summary> + internal sealed class Int32Cache : Cache { - internal IntCache(FieldCacheImpl wrapper) + internal Int32Cache(FieldCacheImpl wrapper) : base(wrapper) { } protected override object CreateValue(AtomicReader reader, CacheKey key, bool setDocsWithField) { - FieldCache.IIntParser parser = (FieldCache.IIntParser)key.custom; + FieldCache.IInt32Parser parser = (FieldCache.IInt32Parser)key.custom; if (parser == null) { // Confusing: must delegate to wrapper (vs simply @@ -887,20 +899,20 @@ namespace Lucene.Net.Search GrowableWriterAndMinValue values = valuesRef.Get(); if (values == null) { - return new IntsFromArray(new PackedInts.NullReader(reader.MaxDoc), 0); + return new Int32sFromArray(new PackedInt32s.NullReader(reader.MaxDoc), 0); } - return new IntsFromArray(values.Writer.Mutable, (int)values.MinValue); + return new Int32sFromArray(values.Writer.Mutable, (int)values.MinValue); } private class UninvertAnonymousInnerClassHelper : Uninvert { - private readonly IntCache outerInstance; + private readonly Int32Cache outerInstance; private AtomicReader reader; - private FieldCache.IIntParser parser; + private FieldCache.IInt32Parser parser; private FieldCacheImpl.HoldsOneThing<GrowableWriterAndMinValue> valuesRef; - public UninvertAnonymousInnerClassHelper(IntCache outerInstance, AtomicReader reader, FieldCache.IIntParser parser, FieldCacheImpl.HoldsOneThing<GrowableWriterAndMinValue> valuesRef) + public UninvertAnonymousInnerClassHelper(Int32Cache outerInstance, AtomicReader reader, FieldCache.IInt32Parser parser, FieldCacheImpl.HoldsOneThing<GrowableWriterAndMinValue> valuesRef) { this.outerInstance = outerInstance; this.reader = reader; @@ -926,14 +938,14 @@ namespace Lucene.Net.Search if (currentValue < 0) { minValue = currentValue; - startBitsPerValue = PackedInts.BitsRequired((-minValue) & 0xFFFFFFFFL); + startBitsPerValue = PackedInt32s.BitsRequired((-minValue) & 0xFFFFFFFFL); } else { minValue = 0; - startBitsPerValue = PackedInts.BitsRequired(currentValue); + startBitsPerValue = PackedInt32s.BitsRequired(currentValue); } - values = new GrowableWriter(startBitsPerValue, reader.MaxDoc, PackedInts.FAST); + values = new GrowableWriter(startBitsPerValue, reader.MaxDoc, PackedInt32s.FAST); if (minValue != 0) { values.Fill(0, values.Count, (-minValue) & 0xFFFFFFFFL); // default value must be 0 @@ -1043,7 +1055,7 @@ namespace Lucene.Net.Search /// <summary> /// NOTE: this was getFloats() in Lucene /// </summary> - public virtual FieldCache.Floats GetSingles(AtomicReader reader, string field, bool setDocsWithField) + public virtual FieldCache.Singles GetSingles(AtomicReader reader, string field, bool setDocsWithField) { return GetSingles(reader, field, null, setDocsWithField); } @@ -1051,21 +1063,21 @@ namespace Lucene.Net.Search /// <summary> /// NOTE: this was getFloats() in Lucene /// </summary> - public virtual FieldCache.Floats GetSingles(AtomicReader reader, string field, FieldCache.IFloatParser parser, bool setDocsWithField) + public virtual FieldCache.Singles GetSingles(AtomicReader reader, string field, FieldCache.ISingleParser parser, bool setDocsWithField) { NumericDocValues valuesIn = reader.GetNumericDocValues(field); if (valuesIn != null) { // Not cached here by FieldCacheImpl (cached instead // per-thread by SegmentReader): - return new FieldCache_FloatsAnonymousInnerClassHelper(this, valuesIn); + return new FieldCache_SinglesAnonymousInnerClassHelper(this, valuesIn); } else { FieldInfo info = reader.FieldInfos.FieldInfo(field); if (info == null) { - return FieldCache.Floats.EMPTY; + return FieldCache.Singles.EMPTY; } else if (info.HasDocValues) { @@ -1073,19 +1085,19 @@ namespace Lucene.Net.Search } else if (!info.IsIndexed) { - return FieldCache.Floats.EMPTY; + return FieldCache.Singles.EMPTY; } - return (FieldCache.Floats)caches[typeof(float)].Get(reader, new CacheKey(field, parser), setDocsWithField); + return (FieldCache.Singles)caches[typeof(float)].Get(reader, new CacheKey(field, parser), setDocsWithField); } } - private class FieldCache_FloatsAnonymousInnerClassHelper : FieldCache.Floats + private class FieldCache_SinglesAnonymousInnerClassHelper : FieldCache.Singles { private readonly FieldCacheImpl outerInstance; private NumericDocValues valuesIn; - public FieldCache_FloatsAnonymousInnerClassHelper(FieldCacheImpl outerInstance, NumericDocValues valuesIn) + public FieldCache_SinglesAnonymousInnerClassHelper(FieldCacheImpl outerInstance, NumericDocValues valuesIn) { this.outerInstance = outerInstance; this.valuesIn = valuesIn; @@ -1097,11 +1109,14 @@ namespace Lucene.Net.Search } } - internal class FloatsFromArray : FieldCache.Floats + /// <summary> + /// NOTE: This was FloatsFromArray in Lucene + /// </summary> + internal class SinglesFromArray : FieldCache.Singles { private readonly float[] values; - public FloatsFromArray(float[] values) + public SinglesFromArray(float[] values) { this.values = values; } @@ -1112,16 +1127,19 @@ namespace Lucene.Net.Search } } - internal sealed class FloatCache : Cache + /// <summary> + /// NOTE: This was FloatCache in Lucene + /// </summary> + internal sealed class SingleCache : Cache { - internal FloatCache(FieldCacheImpl wrapper) + internal SingleCache(FieldCacheImpl wrapper) : base(wrapper) { } protected override object CreateValue(AtomicReader reader, CacheKey key, bool setDocsWithField) { - FieldCache.IFloatParser parser = (FieldCache.IFloatParser)key.custom; + FieldCache.ISingleParser parser = (FieldCache.ISingleParser)key.custom; if (parser == null) { // Confusing: must delegate to wrapper (vs simply @@ -1155,18 +1173,18 @@ namespace Lucene.Net.Search { values = new float[reader.MaxDoc]; } - return new FloatsFromArray(values); + return new SinglesFromArray(values); } private class UninvertAnonymousInnerClassHelper : Uninvert { - private readonly FloatCache outerInstance; + private readonly SingleCache outerInstance; private AtomicReader reader; - private FieldCache.IFloatParser parser; + private FieldCache.ISingleParser parser; private FieldCacheImpl.HoldsOneThing<float[]> valuesRef; - public UninvertAnonymousInnerClassHelper(FloatCache outerInstance, AtomicReader reader, FieldCache.IFloatParser parser, FieldCacheImpl.HoldsOneThing<float[]> valuesRef) + public UninvertAnonymousInnerClassHelper(SingleCache outerInstance, AtomicReader reader, FieldCache.ISingleParser parser, FieldCacheImpl.HoldsOneThing<float[]> valuesRef) { this.outerInstance = outerInstance; this.reader = reader; @@ -1206,7 +1224,7 @@ namespace Lucene.Net.Search /// <summary> /// NOTE: this was getLongs() in Lucene /// </summary> - public virtual FieldCache.Longs GetInt64s(AtomicReader reader, string field, bool setDocsWithField) + public virtual FieldCache.Int64s GetInt64s(AtomicReader reader, string field, bool setDocsWithField) { return GetInt64s(reader, field, null, setDocsWithField); } @@ -1214,21 +1232,21 @@ namespace Lucene.Net.Search /// <summary> /// NOTE: this was getLongs() in Lucene /// </summary> - public virtual FieldCache.Longs GetInt64s(AtomicReader reader, string field, FieldCache.ILongParser parser, bool setDocsWithField) + public virtual FieldCache.Int64s GetInt64s(AtomicReader reader, string field, FieldCache.IInt64Parser parser, bool setDocsWithField) { NumericDocValues valuesIn = reader.GetNumericDocValues(field); if (valuesIn != null) { // Not cached here by FieldCacheImpl (cached instead // per-thread by SegmentReader): - return new FieldCache_LongsAnonymousInnerClassHelper(this, valuesIn); + return new FieldCache_Int64sAnonymousInnerClassHelper(this, valuesIn); } else { FieldInfo info = reader.FieldInfos.FieldInfo(field); if (info == null) { - return FieldCache.Longs.EMPTY; + return FieldCache.Int64s.EMPTY; } else if (info.HasDocValues) { @@ -1236,19 +1254,19 @@ namespace Lucene.Net.Search } else if (!info.IsIndexed) { - return FieldCache.Longs.EMPTY; + return FieldCache.Int64s.EMPTY; } - return (FieldCache.Longs)caches[typeof(long)].Get(reader, new CacheKey(field, parser), setDocsWithField); + return (FieldCache.Int64s)caches[typeof(long)].Get(reader, new CacheKey(field, parser), setDocsWithField); } } - private class FieldCache_LongsAnonymousInnerClassHelper : FieldCache.Longs + private class FieldCache_Int64sAnonymousInnerClassHelper : FieldCache.Int64s { private readonly FieldCacheImpl outerInstance; private NumericDocValues valuesIn; - public FieldCache_LongsAnonymousInnerClassHelper(FieldCacheImpl outerInstance, NumericDocValues valuesIn) + public FieldCache_Int64sAnonymousInnerClassHelper(FieldCacheImpl outerInstance, NumericDocValues valuesIn) { this.outerInstance = outerInstance; this.valuesIn = valuesIn; @@ -1260,12 +1278,15 @@ namespace Lucene.Net.Search } } - internal class LongsFromArray : FieldCache.Longs + /// <summary> + /// NOTE: This was LongsFromArray in Lucene + /// </summary> + internal class Int64sFromArray : FieldCache.Int64s { - private readonly PackedInts.Reader values; + private readonly PackedInt32s.Reader values; private readonly long minValue; - public LongsFromArray(PackedInts.Reader values, long minValue) + public Int64sFromArray(PackedInt32s.Reader values, long minValue) { this.values = values; this.minValue = minValue; @@ -1277,16 +1298,19 @@ namespace Lucene.Net.Search } } - internal sealed class LongCache : Cache + /// <summary> + /// NOTE: This was LongCache in Lucene + /// </summary> + internal sealed class Int64Cache : Cache { - internal LongCache(FieldCacheImpl wrapper) + internal Int64Cache(FieldCacheImpl wrapper) : base(wrapper) { } protected override object CreateValue(AtomicReader reader, CacheKey key, bool setDocsWithField) { - FieldCache.ILongParser parser = (FieldCache.ILongParser)key.custom; + FieldCache.IInt64Parser parser = (FieldCache.IInt64Parser)key.custom; if (parser == null) { // Confusing: must delegate to wrapper (vs simply @@ -1317,20 +1341,20 @@ namespace Lucene.Net.Search GrowableWriterAndMinValue values = valuesRef.Get(); if (values == null) { - return new LongsFromArray(new PackedInts.NullReader(reader.MaxDoc), 0L); + return new Int64sFromArray(new PackedInt32s.NullReader(reader.MaxDoc), 0L); } - return new LongsFromArray(values.Writer.Mutable, values.MinValue); + return new Int64sFromArray(values.Writer.Mutable, values.MinValue); } private class UninvertAnonymousInnerClassHelper : Uninvert { - private readonly LongCache outerInstance; + private readonly Int64Cache outerInstance; private AtomicReader reader; - private FieldCache.ILongParser parser; + private FieldCache.IInt64Parser parser; private FieldCacheImpl.HoldsOneThing<GrowableWriterAndMinValue> valuesRef; - public UninvertAnonymousInnerClassHelper(LongCache outerInstance, AtomicReader reader, FieldCache.ILongParser parser, FieldCacheImpl.HoldsOneThing<GrowableWriterAndMinValue> valuesRef) + public UninvertAnonymousInnerClassHelper(Int64Cache outerInstance, AtomicReader reader, FieldCache.IInt64Parser parser, FieldCacheImpl.HoldsOneThing<GrowableWriterAndMinValue> valuesRef) { this.outerInstance = outerInstance; this.reader = reader; @@ -1356,14 +1380,14 @@ namespace Lucene.Net.Search if (currentValue < 0) { minValue = currentValue; - startBitsPerValue = minValue == long.MinValue ? 64 : PackedInts.BitsRequired(-minValue); + startBitsPerValue = minValue == long.MinValue ? 64 : PackedInt32s.BitsRequired(-minValue); } else { minValue = 0; - startBitsPerValue = PackedInts.BitsRequired(currentValue); + startBitsPerValue = PackedInt32s.BitsRequired(currentValue); } - values = new GrowableWriter(startBitsPerValue, reader.MaxDoc, PackedInts.FAST); + values = new GrowableWriter(startBitsPerValue, reader.MaxDoc, PackedInt32s.FAST); if (minValue != 0) { values.Fill(0, values.Count, -minValue); // default value must be 0 @@ -1543,11 +1567,11 @@ namespace Lucene.Net.Search public class SortedDocValuesImpl : SortedDocValues { private readonly PagedBytes.Reader bytes; - private readonly MonotonicAppendingLongBuffer termOrdToBytesOffset; - private readonly PackedInts.Reader docToTermOrd; + private readonly MonotonicAppendingInt64Buffer termOrdToBytesOffset; + private readonly PackedInt32s.Reader docToTermOrd; private readonly int numOrd; - public SortedDocValuesImpl(PagedBytes.Reader bytes, MonotonicAppendingLongBuffer termOrdToBytesOffset, PackedInts.Reader docToTermOrd, int numOrd) + public SortedDocValuesImpl(PagedBytes.Reader bytes, MonotonicAppendingInt64Buffer termOrdToBytesOffset, PackedInt32s.Reader docToTermOrd, int numOrd) { this.bytes = bytes; this.docToTermOrd = docToTermOrd; @@ -1583,7 +1607,7 @@ namespace Lucene.Net.Search public virtual SortedDocValues GetTermsIndex(AtomicReader reader, string field) { - return GetTermsIndex(reader, field, PackedInts.FAST); + return GetTermsIndex(reader, field, PackedInt32s.FAST); } public virtual SortedDocValues GetTermsIndex(AtomicReader reader, string field, float acceptableOverheadRatio) @@ -1662,7 +1686,7 @@ namespace Lucene.Net.Search numUniqueTerms = termCountHardLimit; } - startTermsBPV = PackedInts.BitsRequired(numUniqueTerms); + startTermsBPV = PackedInt32s.BitsRequired(numUniqueTerms); } else { @@ -1674,7 +1698,7 @@ namespace Lucene.Net.Search startTermsBPV = 1; } - MonotonicAppendingLongBuffer termOrdToBytesOffset = new MonotonicAppendingLongBuffer(); + MonotonicAppendingInt64Buffer termOrdToBytesOffset = new MonotonicAppendingInt64Buffer(); GrowableWriter docToTermOrd = new GrowableWriter(startTermsBPV, maxDoc, acceptableOverheadRatio); int termOrd = 0; @@ -1723,9 +1747,9 @@ namespace Lucene.Net.Search private class BinaryDocValuesImpl : BinaryDocValues { private readonly PagedBytes.Reader bytes; - private readonly PackedInts.Reader docToOffset; + private readonly PackedInt32s.Reader docToOffset; - public BinaryDocValuesImpl(PagedBytes.Reader bytes, PackedInts.Reader docToOffset) + public BinaryDocValuesImpl(PagedBytes.Reader bytes, PackedInt32s.Reader docToOffset) { this.bytes = bytes; this.docToOffset = docToOffset; @@ -1751,7 +1775,7 @@ namespace Lucene.Net.Search // should share it... public virtual BinaryDocValues GetTerms(AtomicReader reader, string field, bool setDocsWithField) { - return GetTerms(reader, field, setDocsWithField, PackedInts.FAST); + return GetTerms(reader, field, setDocsWithField, PackedInt32s.FAST); } public virtual BinaryDocValues GetTerms(AtomicReader reader, string field, bool setDocsWithField, float acceptableOverheadRatio) @@ -1823,7 +1847,7 @@ namespace Lucene.Net.Search { numUniqueTerms = termCountHardLimit; } - startBPV = PackedInts.BitsRequired(numUniqueTerms * 4); + startBPV = PackedInt32s.BitsRequired(numUniqueTerms * 4); } else { @@ -1874,7 +1898,7 @@ namespace Lucene.Net.Search } } - PackedInts.Reader offsetReader = docToOffset.Mutable; + PackedInt32s.Reader offsetReader = docToOffset.Mutable; if (setDocsWithField) { wrapper.SetDocsWithField(reader, key.field, new BitsAnonymousInnerClassHelper(this, maxDoc, offsetReader)); @@ -1888,9 +1912,9 @@ namespace Lucene.Net.Search private readonly BinaryDocValuesCache outerInstance; private int maxDoc; - private PackedInts.Reader offsetReader; + private PackedInt32s.Reader offsetReader; - public BitsAnonymousInnerClassHelper(BinaryDocValuesCache outerInstance, int maxDoc, PackedInts.Reader offsetReader) + public BitsAnonymousInnerClassHelper(BinaryDocValuesCache outerInstance, int maxDoc, PackedInt32s.Reader offsetReader) { this.outerInstance = outerInstance; this.maxDoc = maxDoc;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs b/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs index b48805e..f7c4185 100644 --- a/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs +++ b/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs @@ -312,15 +312,15 @@ namespace Lucene.Net.Search #if FEATURE_SERIALIZABLE [Serializable] #endif - private class AnonymousShortFieldCacheRangeFilter : FieldCacheRangeFilter<short?> + private class AnonymousInt16FieldCacheRangeFilter : FieldCacheRangeFilter<short?> { private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet { - private FieldCache.Shorts values; + private FieldCache.Int16s values; private short inclusiveLowerPoint; private short inclusiveUpperPoint; - internal AnonymousClassFieldCacheDocIdSet(FieldCache.Shorts values, short inclusiveLowerPoint, short inclusiveUpperPoint, int maxDoc, IBits acceptDocs) + internal AnonymousClassFieldCacheDocIdSet(FieldCache.Int16s values, short inclusiveLowerPoint, short inclusiveUpperPoint, int maxDoc, IBits acceptDocs) : base(maxDoc, acceptDocs) { this.values = values; @@ -335,7 +335,7 @@ namespace Lucene.Net.Search } } - internal AnonymousShortFieldCacheRangeFilter(string field, FieldCache.IParser parser, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper) + internal AnonymousInt16FieldCacheRangeFilter(string field, FieldCache.IParser parser, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper) : base(field, parser, lowerVal, upperVal, includeLower, includeUpper) { } @@ -371,7 +371,7 @@ namespace Lucene.Net.Search return null; #pragma warning disable 612, 618 - FieldCache.Shorts values = FieldCache.DEFAULT.GetInt16s(context.AtomicReader, field, (FieldCache.IShortParser)parser, false); + FieldCache.Int16s values = FieldCache.DEFAULT.GetInt16s(context.AtomicReader, field, (FieldCache.IInt16Parser)parser, false); #pragma warning restore 612, 618 // we only request the usage of termDocs, if the range contains 0 @@ -382,15 +382,15 @@ namespace Lucene.Net.Search #if FEATURE_SERIALIZABLE [Serializable] #endif - private class AnonymousIntFieldCacheRangeFilter : FieldCacheRangeFilter<int?> + private class AnonymousInt32FieldCacheRangeFilter : FieldCacheRangeFilter<int?> { private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet { - private FieldCache.Ints values; + private FieldCache.Int32s values; private int inclusiveLowerPoint; private int inclusiveUpperPoint; - internal AnonymousClassFieldCacheDocIdSet(FieldCache.Ints values, int inclusiveLowerPoint, int inclusiveUpperPoint, int maxDoc, IBits acceptDocs) + internal AnonymousClassFieldCacheDocIdSet(FieldCache.Int32s values, int inclusiveLowerPoint, int inclusiveUpperPoint, int maxDoc, IBits acceptDocs) : base(maxDoc, acceptDocs) { this.values = values; @@ -405,7 +405,7 @@ namespace Lucene.Net.Search } } - internal AnonymousIntFieldCacheRangeFilter(string field, FieldCache.IParser parser, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper) + internal AnonymousInt32FieldCacheRangeFilter(string field, FieldCache.IParser parser, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper) : base(field, parser, lowerVal, upperVal, includeLower, includeUpper) { } @@ -440,7 +440,7 @@ namespace Lucene.Net.Search if (inclusiveLowerPoint > inclusiveUpperPoint) return null; - FieldCache.Ints values = FieldCache.DEFAULT.GetInt32s(context.AtomicReader, field, (FieldCache.IIntParser)parser, false); + FieldCache.Int32s values = FieldCache.DEFAULT.GetInt32s(context.AtomicReader, field, (FieldCache.IInt32Parser)parser, false); // we only request the usage of termDocs, if the range contains 0 return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader.MaxDoc, acceptDocs); } @@ -449,15 +449,15 @@ namespace Lucene.Net.Search #if FEATURE_SERIALIZABLE [Serializable] #endif - private class AnonymousLongFieldCacheRangeFilter : FieldCacheRangeFilter<long?> + private class AnonymousInt64FieldCacheRangeFilter : FieldCacheRangeFilter<long?> { private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet { - private FieldCache.Longs values; + private FieldCache.Int64s values; private long inclusiveLowerPoint; private long inclusiveUpperPoint; - internal AnonymousClassFieldCacheDocIdSet(FieldCache.Longs values, long inclusiveLowerPoint, long inclusiveUpperPoint, int maxDoc, IBits acceptDocs) + internal AnonymousClassFieldCacheDocIdSet(FieldCache.Int64s values, long inclusiveLowerPoint, long inclusiveUpperPoint, int maxDoc, IBits acceptDocs) : base(maxDoc, acceptDocs) { this.values = values; @@ -472,7 +472,7 @@ namespace Lucene.Net.Search } } - internal AnonymousLongFieldCacheRangeFilter(string field, FieldCache.IParser parser, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper) + internal AnonymousInt64FieldCacheRangeFilter(string field, FieldCache.IParser parser, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper) : base(field, parser, lowerVal, upperVal, includeLower, includeUpper) { } @@ -507,7 +507,7 @@ namespace Lucene.Net.Search if (inclusiveLowerPoint > inclusiveUpperPoint) return null; - FieldCache.Longs values = FieldCache.DEFAULT.GetInt64s(context.AtomicReader, field, (FieldCache.ILongParser)parser, false); + FieldCache.Int64s values = FieldCache.DEFAULT.GetInt64s(context.AtomicReader, field, (FieldCache.IInt64Parser)parser, false); // we only request the usage of termDocs, if the range contains 0 return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader.MaxDoc, acceptDocs); } @@ -516,15 +516,15 @@ namespace Lucene.Net.Search #if FEATURE_SERIALIZABLE [Serializable] #endif - private class AnonymousFloatFieldCacheRangeFilter : FieldCacheRangeFilter<float?> + private class AnonymousSingleFieldCacheRangeFilter : FieldCacheRangeFilter<float?> { private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet { - private FieldCache.Floats values; + private FieldCache.Singles values; private float inclusiveLowerPoint; private float inclusiveUpperPoint; - internal AnonymousClassFieldCacheDocIdSet(FieldCache.Floats values, float inclusiveLowerPoint, float inclusiveUpperPoint, int maxDoc, IBits acceptDocs) + internal AnonymousClassFieldCacheDocIdSet(FieldCache.Singles values, float inclusiveLowerPoint, float inclusiveUpperPoint, int maxDoc, IBits acceptDocs) : base(maxDoc, acceptDocs) { this.values = values; @@ -539,7 +539,7 @@ namespace Lucene.Net.Search } } - internal AnonymousFloatFieldCacheRangeFilter(string field, FieldCache.IParser parser, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper) + internal AnonymousSingleFieldCacheRangeFilter(string field, FieldCache.IParser parser, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper) : base(field, parser, lowerVal, upperVal, includeLower, includeUpper) { } @@ -578,7 +578,7 @@ namespace Lucene.Net.Search if (inclusiveLowerPoint > inclusiveUpperPoint) return null; - FieldCache.Floats values = FieldCache.DEFAULT.GetSingles(context.AtomicReader, field, (FieldCache.IFloatParser)parser, false); + FieldCache.Singles values = FieldCache.DEFAULT.GetSingles(context.AtomicReader, field, (FieldCache.ISingleParser)parser, false); // we only request the usage of termDocs, if the range contains 0 return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader.MaxDoc, acceptDocs); @@ -723,9 +723,9 @@ namespace Lucene.Net.Search /// NOTE: this was newShortRange() in Lucene /// </summary> [Obsolete] - public static FieldCacheRangeFilter<short?> NewInt16Range(string field, FieldCache.IShortParser parser, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper) + public static FieldCacheRangeFilter<short?> NewInt16Range(string field, FieldCache.IInt16Parser parser, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper) { - return new AnonymousShortFieldCacheRangeFilter(field, parser, lowerVal, upperVal, includeLower, includeUpper); + return new AnonymousInt16FieldCacheRangeFilter(field, parser, lowerVal, upperVal, includeLower, includeUpper); } /// <summary> @@ -747,9 +747,9 @@ namespace Lucene.Net.Search /// <para/> /// NOTE: this was newIntRange() in Lucene /// </summary> - public static FieldCacheRangeFilter<int?> NewInt32Range(string field, FieldCache.IIntParser parser, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper) + public static FieldCacheRangeFilter<int?> NewInt32Range(string field, FieldCache.IInt32Parser parser, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper) { - return new AnonymousIntFieldCacheRangeFilter(field, parser, lowerVal, upperVal, includeLower, includeUpper); + return new AnonymousInt32FieldCacheRangeFilter(field, parser, lowerVal, upperVal, includeLower, includeUpper); } /// <summary> @@ -770,9 +770,9 @@ namespace Lucene.Net.Search /// <para/> /// NOTE: this was newLongRange() in Lucene /// </summary> - public static FieldCacheRangeFilter<long?> NewInt64Range(string field, FieldCache.ILongParser parser, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper) + public static FieldCacheRangeFilter<long?> NewInt64Range(string field, FieldCache.IInt64Parser parser, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper) { - return new AnonymousLongFieldCacheRangeFilter(field, parser, lowerVal, upperVal, includeLower, includeUpper); + return new AnonymousInt64FieldCacheRangeFilter(field, parser, lowerVal, upperVal, includeLower, includeUpper); } /// <summary> @@ -794,9 +794,9 @@ namespace Lucene.Net.Search /// <para/> /// NOTE: this was newFloatRange() in Lucene /// </summary> - public static FieldCacheRangeFilter<float?> NewSingleRange(string field, FieldCache.IFloatParser parser, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper) + public static FieldCacheRangeFilter<float?> NewSingleRange(string field, FieldCache.ISingleParser parser, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper) { - return new AnonymousFloatFieldCacheRangeFilter(field, parser, lowerVal, upperVal, includeLower, includeUpper); + return new AnonymousSingleFieldCacheRangeFilter(field, parser, lowerVal, upperVal, includeLower, includeUpper); } /// <summary> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Search/FieldCacheRewriteMethod.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/FieldCacheRewriteMethod.cs b/src/Lucene.Net.Core/Search/FieldCacheRewriteMethod.cs index 973bf8b..f669871 100644 --- a/src/Lucene.Net.Core/Search/FieldCacheRewriteMethod.cs +++ b/src/Lucene.Net.Core/Search/FieldCacheRewriteMethod.cs @@ -24,7 +24,7 @@ namespace Lucene.Net.Search using IBits = Lucene.Net.Util.IBits; using BytesRef = Lucene.Net.Util.BytesRef; using IndexReader = Lucene.Net.Index.IndexReader; - using LongBitSet = Lucene.Net.Util.LongBitSet; + using Int64BitSet = Lucene.Net.Util.Int64BitSet; using SortedDocValues = Lucene.Net.Index.SortedDocValues; using Terms = Lucene.Net.Index.Terms; using TermsEnum = Lucene.Net.Index.TermsEnum; @@ -102,7 +102,7 @@ namespace Lucene.Net.Search { SortedDocValues fcsi = FieldCache.DEFAULT.GetTermsIndex((context.AtomicReader), m_query.m_field); // Cannot use FixedBitSet because we require long index (ord): - LongBitSet termSet = new LongBitSet(fcsi.ValueCount); + Int64BitSet termSet = new Int64BitSet(fcsi.ValueCount); TermsEnum termsEnum = m_query.GetTermsEnum(new TermsAnonymousInnerClassHelper(this, fcsi)); Debug.Assert(termsEnum != null); @@ -206,9 +206,9 @@ namespace Lucene.Net.Search private readonly MultiTermQueryFieldCacheWrapperFilter outerInstance; private SortedDocValues fcsi; - private LongBitSet termSet; + private Int64BitSet termSet; - public FieldCacheDocIdSetAnonymousInnerClassHelper(MultiTermQueryFieldCacheWrapperFilter outerInstance, int maxDoc, IBits acceptDocs, SortedDocValues fcsi, LongBitSet termSet) + public FieldCacheDocIdSetAnonymousInnerClassHelper(MultiTermQueryFieldCacheWrapperFilter outerInstance, int maxDoc, IBits acceptDocs, SortedDocValues fcsi, Int64BitSet termSet) : base(maxDoc, acceptDocs) { this.outerInstance = outerInstance; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Search/FieldComparator.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/FieldComparator.cs b/src/Lucene.Net.Core/Search/FieldComparator.cs index e4b0026..e4600ef 100644 --- a/src/Lucene.Net.Core/Search/FieldComparator.cs +++ b/src/Lucene.Net.Core/Search/FieldComparator.cs @@ -529,21 +529,22 @@ namespace Lucene.Net.Search /// <summary> /// Parses field's values as float (using {@link /// FieldCache#getFloats} and sorts by ascending value + /// <para/> + /// NOTE: This was FloatComparator in Lucene /// </summary> - // LUCENENET TODO: Rename SingleComparer ? - public sealed class FloatComparer : NumericComparer<float> + public sealed class SingleComparer : NumericComparer<float> { private readonly float[] values; - private readonly FieldCache.IFloatParser parser; - private FieldCache.Floats currentReaderValues; + private readonly FieldCache.ISingleParser parser; + private FieldCache.Singles currentReaderValues; private float bottom; private float topValue; - internal FloatComparer(int numHits, string field, FieldCache.IParser parser, float? missingValue) + internal SingleComparer(int numHits, string field, FieldCache.IParser parser, float? missingValue) : base(field, missingValue) { values = new float[numHits]; - this.parser = (FieldCache.IFloatParser)parser; + this.parser = (FieldCache.ISingleParser)parser; } public override int Compare(int slot1, int slot2) @@ -616,23 +617,24 @@ namespace Lucene.Net.Search /// <summary> /// Parses field's values as short (using {@link - /// FieldCache#getShorts} and sorts by ascending value + /// FieldCache#getShorts} and sorts by ascending value + /// <para/> + /// NOTE: This was ShortComparator in Lucene /// </summary> - // LUCENENET TODO: Rename Int16Comparer ? [Obsolete] - public sealed class ShortComparer : NumericComparer<short> + public sealed class Int16Comparer : NumericComparer<short> { private readonly short[] values; - private readonly FieldCache.IShortParser parser; - private FieldCache.Shorts currentReaderValues; + private readonly FieldCache.IInt16Parser parser; + private FieldCache.Int16s currentReaderValues; private short bottom; private short topValue; - internal ShortComparer(int numHits, string field, FieldCache.IParser parser, short? missingValue) + internal Int16Comparer(int numHits, string field, FieldCache.IParser parser, short? missingValue) : base(field, missingValue) { values = new short[numHits]; - this.parser = (FieldCache.IShortParser)parser; + this.parser = (FieldCache.IInt16Parser)parser; } public override int Compare(int slot1, int slot2) @@ -706,22 +708,23 @@ namespace Lucene.Net.Search /// <summary> /// Parses field's values as int (using {@link - /// FieldCache#getInts} and sorts by ascending value + /// FieldCache#getInts} and sorts by ascending value + /// <para/> + /// NOTE: This was IntComparator in Lucene /// </summary> - // LUCENENET TODO: Rename Int32Comparer ? - public sealed class IntComparer : NumericComparer<int> + public sealed class Int32Comparer : NumericComparer<int> { private readonly int[] values; - private readonly FieldCache.IIntParser parser; - private FieldCache.Ints currentReaderValues; + private readonly FieldCache.IInt32Parser parser; + private FieldCache.Int32s currentReaderValues; private int bottom; // Value of bottom of queue private int topValue; - internal IntComparer(int numHits, string field, FieldCache.IParser parser, int? missingValue) + internal Int32Comparer(int numHits, string field, FieldCache.IParser parser, int? missingValue) : base(field, missingValue) { values = new int[numHits]; - this.parser = (FieldCache.IIntParser)parser; + this.parser = (FieldCache.IInt32Parser)parser; } public override int Compare(int slot1, int slot2) @@ -792,22 +795,23 @@ namespace Lucene.Net.Search /// <summary> /// Parses field's values as long (using {@link - /// FieldCache#getLongs} and sorts by ascending value + /// FieldCache#getLongs} and sorts by ascending value + /// <para/> + /// NOTE: This was LongComparator in Lucene /// </summary> - // LUCENENET TODO: Rename Int64Comparer ? - public sealed class LongComparer : NumericComparer<long> + public sealed class Int64Comparer : NumericComparer<long> { private readonly long[] values; - private readonly FieldCache.ILongParser parser; - private FieldCache.Longs currentReaderValues; + private readonly FieldCache.IInt64Parser parser; + private FieldCache.Int64s currentReaderValues; private long bottom; private long topValue; - internal LongComparer(int numHits, string field, FieldCache.IParser parser, long? missingValue) + internal Int64Comparer(int numHits, string field, FieldCache.IParser parser, long? missingValue) : base(field, missingValue) { values = new long[numHits]; - this.parser = (FieldCache.ILongParser)parser; + this.parser = (FieldCache.IInt64Parser)parser; } public override int Compare(int slot1, int slot2) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs b/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs index 7fff3c8..16d15a2 100644 --- a/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs +++ b/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs @@ -519,9 +519,12 @@ namespace Lucene.Net.Search } } - private sealed class IntQueue + /// <summary> + /// NOTE: This was IntQueue in Lucene + /// </summary> + private sealed class Int32Queue { - public IntQueue() + public Int32Queue() { InitializeInstanceFields(); } @@ -579,7 +582,7 @@ namespace Lucene.Net.Search private int _doc; private int _freq; private readonly DocsQueue _queue; - private readonly IntQueue _posList; + private readonly Int32Queue _posList; private readonly long _cost; public UnionDocsAndPositionsEnum(IBits liveDocs, AtomicReaderContext context, Term[] terms, IDictionary<Term, TermContext> termContexts, TermsEnum termsEnum) @@ -606,7 +609,7 @@ namespace Lucene.Net.Search } _queue = new DocsQueue(docsEnums); - _posList = new IntQueue(); + _posList = new Int32Queue(); } public override sealed int NextDoc() http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Search/NumericRangeQuery.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/NumericRangeQuery.cs b/src/Lucene.Net.Core/Search/NumericRangeQuery.cs index 003078f..08a86c4 100644 --- a/src/Lucene.Net.Core/Search/NumericRangeQuery.cs +++ b/src/Lucene.Net.Core/Search/NumericRangeQuery.cs @@ -34,8 +34,8 @@ namespace Lucene.Net.Search /// <summary> /// <p>A <seealso cref="Query"/> that matches numeric values within a /// specified range. To use this, you must first index the - /// numeric values using <seealso cref="IntField"/>, {@link - /// FloatField}, <seealso cref="LongField"/> or <seealso cref="DoubleField"/> (expert: {@link + /// numeric values using <seealso cref="Int32Field"/>, {@link + /// FloatField}, <seealso cref="Int64Field"/> or <seealso cref="DoubleField"/> (expert: {@link /// NumericTokenStream}). If your terms are instead textual, /// you should use <seealso cref="TermRangeQuery"/>. {@link /// NumericRangeFilter} is the filter equivalent of this @@ -144,8 +144,8 @@ namespace Lucene.Net.Search /// <li>Steps <b>>=64</b> for <em>long/double</em> and <b>>=32</b> for <em>int/float</em> produces one token /// per value in the index and querying is as slow as a conventional <seealso cref="TermRangeQuery"/>. But it can be used /// to produce fields, that are solely used for sorting (in this case simply use <seealso cref="Integer#MAX_VALUE"/> as - /// <code>precisionStep</code>). Using <seealso cref="IntField"/>, - /// <seealso cref="LongField"/>, <seealso cref="FloatField"/> or <seealso cref="DoubleField"/> for sorting + /// <code>precisionStep</code>). Using <seealso cref="Int32Field"/>, + /// <seealso cref="Int64Field"/>, <seealso cref="SingleField"/> or <seealso cref="DoubleField"/> for sorting /// is ideal, because building the field cache is much faster than with text-only numbers. /// These fields have one term per value and therefore also work with term enumeration for building distinct lists /// (e.g. facets / preselected values to search for). @@ -361,7 +361,7 @@ namespace Lucene.Net.Search maxBound--; } - NumericUtils.SplitInt64Range(new LongRangeBuilderAnonymousInnerClassHelper(this), this.outerInstance.precisionStep, minBound, maxBound); + NumericUtils.SplitInt64Range(new Int64RangeBuilderAnonymousInnerClassHelper(this), this.outerInstance.precisionStep, minBound, maxBound); break; } @@ -408,7 +408,7 @@ namespace Lucene.Net.Search maxBound--; } - NumericUtils.SplitInt32Range(new IntRangeBuilderAnonymousInnerClassHelper(this), this.outerInstance.precisionStep, minBound, maxBound); + NumericUtils.SplitInt32Range(new Int32RangeBuilderAnonymousInnerClassHelper(this), this.outerInstance.precisionStep, minBound, maxBound); break; } @@ -420,11 +420,11 @@ namespace Lucene.Net.Search termComp = Comparer; } - private class LongRangeBuilderAnonymousInnerClassHelper : NumericUtils.LongRangeBuilder + private class Int64RangeBuilderAnonymousInnerClassHelper : NumericUtils.Int64RangeBuilder { private readonly NumericRangeTermsEnum outerInstance; - public LongRangeBuilderAnonymousInnerClassHelper(NumericRangeTermsEnum outerInstance) + public Int64RangeBuilderAnonymousInnerClassHelper(NumericRangeTermsEnum outerInstance) { this.outerInstance = outerInstance; } @@ -436,11 +436,11 @@ namespace Lucene.Net.Search } } - private class IntRangeBuilderAnonymousInnerClassHelper : NumericUtils.IntRangeBuilder + private class Int32RangeBuilderAnonymousInnerClassHelper : NumericUtils.Int32RangeBuilder { private readonly NumericRangeTermsEnum outerInstance; - public IntRangeBuilderAnonymousInnerClassHelper(NumericRangeTermsEnum outerInstance) + public Int32RangeBuilderAnonymousInnerClassHelper(NumericRangeTermsEnum outerInstance) { this.outerInstance = outerInstance; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs b/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs index 2f363d8..86ae76f 100644 --- a/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs +++ b/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs @@ -23,7 +23,7 @@ namespace Lucene.Net.Search.Similarities using BytesRef = Lucene.Net.Util.BytesRef; using FieldInvertState = Lucene.Net.Index.FieldInvertState; using NumericDocValues = Lucene.Net.Index.NumericDocValues; - using SmallFloat = Lucene.Net.Util.SmallFloat; + using SmallSingle = Lucene.Net.Util.SmallSingle; /// <summary> /// BM25 Similarity. Introduced in Stephen E. Robertson, Steve Walker, @@ -102,18 +102,18 @@ namespace Lucene.Net.Search.Similarities /// <summary> /// The default implementation encodes <code>boost / sqrt(length)</code> - /// with <seealso cref="SmallFloat#floatToByte315(float)"/>. this is compatible with + /// with <seealso cref="SmallSingle#floatToByte315(float)"/>. this is compatible with /// Lucene's default implementation. If you change this, then you should /// change <seealso cref="#decodeNormValue(byte)"/> to match. /// </summary> protected internal virtual sbyte EncodeNormValue(float boost, int fieldLength) // LUCENENET TODO: Can we use byte? { - return SmallFloat.SingleToByte315(boost / (float)Math.Sqrt(fieldLength)); + return SmallSingle.SingleToByte315(boost / (float)Math.Sqrt(fieldLength)); } /// <summary> /// The default implementation returns <code>1 / f<sup>2</sup></code> - /// where <code>f</code> is <seealso cref="SmallFloat#byte315ToFloat(byte)"/>. + /// where <code>f</code> is <seealso cref="SmallSingle#byte315ToFloat(byte)"/>. /// </summary> protected internal virtual float DecodeNormValue(sbyte b) // LUCENENET TODO: Can we use byte? { @@ -151,7 +151,7 @@ namespace Lucene.Net.Search.Similarities { for (int i = 0; i < 256; i++) { - float f = SmallFloat.Byte315ToSingle((sbyte)i); + float f = SmallSingle.Byte315ToSingle((sbyte)i); NORM_TABLE[i] = 1.0f / (f * f); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Search/Similarities/DefaultSimilarity.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/Similarities/DefaultSimilarity.cs b/src/Lucene.Net.Core/Search/Similarities/DefaultSimilarity.cs index 2ea6e9a..b2a84a9 100644 --- a/src/Lucene.Net.Core/Search/Similarities/DefaultSimilarity.cs +++ b/src/Lucene.Net.Core/Search/Similarities/DefaultSimilarity.cs @@ -21,7 +21,7 @@ namespace Lucene.Net.Search.Similarities using BytesRef = Lucene.Net.Util.BytesRef; using FieldInvertState = Lucene.Net.Index.FieldInvertState; - using SmallFloat = Lucene.Net.Util.SmallFloat; + using SmallSingle = Lucene.Net.Util.SmallSingle; /// <summary> /// Expert: Default scoring implementation which {@link #encodeNormValue(float) @@ -54,7 +54,7 @@ namespace Lucene.Net.Search.Similarities { for (int i = 0; i < 256; i++) { - NORM_TABLE[i] = SmallFloat.Byte315ToSingle((sbyte)i); + NORM_TABLE[i] = SmallSingle.Byte315ToSingle((sbyte)i); } } @@ -90,10 +90,10 @@ namespace Lucene.Net.Search.Similarities /// representable value. /// </summary> /// <seealso cref= Lucene.Net.Document.Field#setBoost(float) </seealso> - /// <seealso cref= Lucene.Net.Util.SmallFloat </seealso> + /// <seealso cref= Lucene.Net.Util.SmallSingle </seealso> public override sealed long EncodeNormValue(float f) { - return SmallFloat.SingleToByte315(f); + return SmallSingle.SingleToByte315(f); } /// <summary> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs b/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs index 9337174..4ddaeb6 100644 --- a/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs +++ b/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs @@ -4,7 +4,7 @@ using AtomicReaderContext = Lucene.Net.Index.AtomicReaderContext; using BytesRef = Lucene.Net.Util.BytesRef; using FieldInvertState = Lucene.Net.Index.FieldInvertState; using NumericDocValues = Lucene.Net.Index.NumericDocValues; -using SmallFloat = Lucene.Net.Util.SmallFloat; +using SmallSingle = Lucene.Net.Util.SmallSingle; namespace Lucene.Net.Search.Similarities { @@ -235,7 +235,7 @@ namespace Lucene.Net.Search.Similarities { for (int i = 0; i < 256; i++) { - float floatNorm = SmallFloat.Byte315ToSingle((sbyte)i); + float floatNorm = SmallSingle.Byte315ToSingle((sbyte)i); NORM_TABLE[i] = 1.0f / (floatNorm * floatNorm); } } @@ -268,7 +268,7 @@ namespace Lucene.Net.Search.Similarities /// Encodes the length to a byte via SmallFloat. </summary> protected internal virtual sbyte EncodeNormValue(float boost, float length) // LUCENENET TODO: Can this be byte? { - return SmallFloat.SingleToByte315((boost / (float)Math.Sqrt(length))); + return SmallSingle.SingleToByte315((boost / (float)Math.Sqrt(length))); } // ----------------------------- Static methods ------------------------------ http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Search/SortField.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/SortField.cs b/src/Lucene.Net.Core/Search/SortField.cs index 7f2a474..f0c9d7a 100644 --- a/src/Lucene.Net.Core/Search/SortField.cs +++ b/src/Lucene.Net.Core/Search/SortField.cs @@ -130,15 +130,15 @@ namespace Lucene.Net.Search /// subclass an existing numeric parser, or field is null </exception> public SortField(string field, FieldCache.IParser parser, bool reverse) { - if (parser is FieldCache.IIntParser) + if (parser is FieldCache.IInt32Parser) { InitFieldType(field, SortFieldType.INT); } - else if (parser is FieldCache.IFloatParser) + else if (parser is FieldCache.ISingleParser) { InitFieldType(field, SortFieldType.FLOAT); } - else if (parser is FieldCache.IShortParser) + else if (parser is FieldCache.IInt16Parser) { #pragma warning disable 612, 618 InitFieldType(field, SortFieldType.SHORT); @@ -148,7 +148,7 @@ namespace Lucene.Net.Search InitFieldType(field, SortFieldType.BYTE); #pragma warning restore 612, 618 } - else if (parser is FieldCache.ILongParser) + else if (parser is FieldCache.IInt64Parser) { InitFieldType(field, SortFieldType.LONG); } @@ -467,13 +467,13 @@ namespace Lucene.Net.Search return new FieldComparer.DocComparer(numHits); case SortFieldType.INT: - return new FieldComparer.IntComparer(numHits, field, parser, (int?)m_missingValue); + return new FieldComparer.Int32Comparer(numHits, field, parser, (int?)m_missingValue); case SortFieldType.FLOAT: - return new FieldComparer.FloatComparer(numHits, field, parser, (float?)m_missingValue); + return new FieldComparer.SingleComparer(numHits, field, parser, (float?)m_missingValue); case SortFieldType.LONG: - return new FieldComparer.LongComparer(numHits, field, parser, (long?)m_missingValue); + return new FieldComparer.Int64Comparer(numHits, field, parser, (long?)m_missingValue); case SortFieldType.DOUBLE: return new FieldComparer.DoubleComparer(numHits, field, parser, (double?)m_missingValue); @@ -483,7 +483,7 @@ namespace Lucene.Net.Search return new FieldComparer.ByteComparer(numHits, field, parser, (sbyte?)m_missingValue); case SortFieldType.SHORT: - return new FieldComparer.ShortComparer(numHits, field, parser, (short?)m_missingValue); + return new FieldComparer.Int16Comparer(numHits, field, parser, (short?)m_missingValue); #pragma warning restore 612, 618 case SortFieldType.CUSTOM: http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Store/RAMDirectory.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Store/RAMDirectory.cs b/src/Lucene.Net.Core/Store/RAMDirectory.cs index 98bc160..2bbd2ac 100644 --- a/src/Lucene.Net.Core/Store/RAMDirectory.cs +++ b/src/Lucene.Net.Core/Store/RAMDirectory.cs @@ -45,7 +45,7 @@ namespace Lucene.Net.Store public class RAMDirectory : BaseDirectory { protected internal readonly IDictionary<string, RAMFile> m_fileMap = new ConcurrentDictionary<string, RAMFile>(); - protected internal readonly AtomicLong m_sizeInBytes = new AtomicLong(0); + protected internal readonly AtomicInt64 m_sizeInBytes = new AtomicInt64(0); // ***** // Lock acquisition sequence: RAMDirectory, then RAMFile http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Support/AtomicInteger.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Support/AtomicInteger.cs b/src/Lucene.Net.Core/Support/AtomicInteger.cs index 5a010e3..4c07b65 100644 --- a/src/Lucene.Net.Core/Support/AtomicInteger.cs +++ b/src/Lucene.Net.Core/Support/AtomicInteger.cs @@ -2,16 +2,19 @@ namespace Lucene.Net.Support { - public class AtomicInteger + /// <summary> + /// NOTE: This was AtomicInteger in the JDK + /// </summary> + public class AtomicInt32 { private int value; - public AtomicInteger() + public AtomicInt32() : this(0) { } - public AtomicInteger(int value_) + public AtomicInt32(int value_) { Interlocked.Exchange(ref value, value_); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Support/AtomicLong.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Support/AtomicLong.cs b/src/Lucene.Net.Core/Support/AtomicLong.cs index 92c5b2b..3e330eb 100644 --- a/src/Lucene.Net.Core/Support/AtomicLong.cs +++ b/src/Lucene.Net.Core/Support/AtomicLong.cs @@ -2,16 +2,19 @@ namespace Lucene.Net.Support { - public class AtomicLong + /// <summary> + /// NOTE: This was AtomicLong in the JDK + /// </summary> + public class AtomicInt64 { private long value; - public AtomicLong() + public AtomicInt64() : this(0) { } - public AtomicLong(long value) + public AtomicInt64(long value) { Interlocked.Exchange(ref this.value, value); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Support/Buffer.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Support/Buffer.cs b/src/Lucene.Net.Core/Support/Buffer.cs index f40bcef..60df952 100644 --- a/src/Lucene.Net.Core/Support/Buffer.cs +++ b/src/Lucene.Net.Core/Support/Buffer.cs @@ -3,7 +3,7 @@ namespace Lucene.Net.Support { /// <summary> - /// Base class for <see cref="ByteBuffer"/> and <see cref="LongBuffer"/> (ported from Java) + /// Base class for <see cref="ByteBuffer"/> and <see cref="Int64Buffer"/> (ported from Java) /// </summary> public abstract class Buffer { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/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 051d724..3d0a908 100644 --- a/src/Lucene.Net.Core/Support/ByteBuffer.cs +++ b/src/Lucene.Net.Core/Support/ByteBuffer.cs @@ -596,7 +596,7 @@ namespace Lucene.Net.Support /// <summary> /// NOTE: This was asLongBuffer() in the JDK /// </summary> - public abstract LongBuffer AsInt64Buffer(); + public abstract Int64Buffer AsInt64Buffer(); /// <summary> /// NOTE: This was getFloat() in the JDK @@ -1093,11 +1093,11 @@ namespace Lucene.Net.Support /// <summary> /// NOTE: This was asLongBuffer() in the JDK /// </summary> - public override LongBuffer AsInt64Buffer() + public override Int64Buffer AsInt64Buffer() { int size = this.Remaining >> 3; int off = offset + Position; - return (new ByteBufferAsLongBuffer(bigEndian, + return (new ByteBufferAsInt64Buffer(bigEndian, this, -1, 0, @@ -1499,7 +1499,7 @@ namespace Lucene.Net.Support /// <summary> /// NOTE: This was asLongBuffer() in the JDK /// </summary> - public override LongBuffer AsInt64Buffer() + public override Int64Buffer AsInt64Buffer() { throw new NotImplementedException(); //int size = this.remaining() >> 3; @@ -1589,14 +1589,16 @@ namespace Lucene.Net.Support //} } - - internal class ByteBufferAsLongBuffer : LongBuffer + /// <summary> + /// NOTE: This was ByteBufferAsLongBuffer in the JDK + /// </summary> + internal class ByteBufferAsInt64Buffer : Int64Buffer { protected readonly ByteBuffer bb; new protected readonly int offset; protected readonly bool bigEndian; - internal ByteBufferAsLongBuffer(bool bigEndian, ByteBuffer bb) + internal ByteBufferAsInt64Buffer(bool bigEndian, ByteBuffer bb) : base(-1, 0, bb.Remaining >> 3, bb.Remaining >> 3) @@ -1611,7 +1613,7 @@ namespace Lucene.Net.Support this.bigEndian = bigEndian; } - internal ByteBufferAsLongBuffer(bool bigEndian, ByteBuffer bb, + internal ByteBufferAsInt64Buffer(bool bigEndian, ByteBuffer bb, int mark, int pos, int lim, int cap, int off) : base(mark, pos, lim, cap) @@ -1621,7 +1623,7 @@ namespace Lucene.Net.Support this.bigEndian = bigEndian; } - public override LongBuffer Slice() + public override Int64Buffer Slice() { int pos = this.Position; int lim = this.Limit; @@ -1629,12 +1631,12 @@ namespace Lucene.Net.Support int rem = (pos <= lim ? lim - pos : 0); int off = (pos << 3) + offset; Debug.Assert(off >= 0); - return new ByteBufferAsLongBuffer(this.bigEndian, bb, -1, 0, rem, rem, off); + return new ByteBufferAsInt64Buffer(this.bigEndian, bb, -1, 0, rem, rem, off); } - public override LongBuffer Duplicate() + public override Int64Buffer Duplicate() { - return new ByteBufferAsLongBuffer(this.bigEndian, + return new ByteBufferAsInt64Buffer(this.bigEndian, bb, this.MarkValue, this.Position, @@ -1643,7 +1645,7 @@ namespace Lucene.Net.Support offset); } - public override LongBuffer AsReadOnlyBuffer() + public override Int64Buffer AsReadOnlyBuffer() { throw new NotImplementedException(); //return new ByteBufferAsLongBufferRB(bb, @@ -1685,13 +1687,13 @@ namespace Lucene.Net.Support return littleEndian; } - public override LongBuffer Put(long value) + public override Int64Buffer Put(long value) { PutImpl(Ix(NextPutIndex()), value); return this; } - public override LongBuffer Put(int index, long value) + public override Int64Buffer Put(int index, long value) { PutImpl(Ix(CheckIndex(index)), value); return this; @@ -1712,7 +1714,7 @@ namespace Lucene.Net.Support } - public override LongBuffer Compact() + public override Int64Buffer Compact() { int pos = Position; int lim = Limit; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/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 0bfdcf2..5d8290c 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> // LUCENENET TODO: Rename Int64Buffer + public abstract class Int64Buffer : Buffer, IComparable<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 @@ -19,7 +19,7 @@ namespace Lucene.Net.Support /// <summary> /// Creates a new buffer with the given mark, position, limit, capacity, backing array, and array offset /// </summary> - public LongBuffer(int mark, int pos, int lim, int cap, + public Int64Buffer(int mark, int pos, int lim, int cap, long[] hb, int offset) : base(mark, pos, lim, cap) { @@ -30,25 +30,25 @@ namespace Lucene.Net.Support /// <summary> /// Creates a new buffer with the given mark, position, limit, and capacity /// </summary> - public LongBuffer(int mark, int pos, int lim, int cap) + public Int64Buffer(int mark, int pos, int lim, int cap) : this(mark, pos, lim, cap, null, 0) { } - public static LongBuffer Allocate(int capacity) + public static Int64Buffer Allocate(int capacity) { if (capacity < 0) throw new ArgumentException(); - return new HeapLongBuffer(capacity, capacity); + return new HeapInt64Buffer(capacity, capacity); } - public static LongBuffer Wrap(long[] array, + public static Int64Buffer Wrap(long[] array, int offset, int length) { try { - return new HeapLongBuffer(array, offset, length); + return new HeapInt64Buffer(array, offset, length); } #pragma warning disable 168 catch (ArgumentException x) @@ -58,29 +58,29 @@ namespace Lucene.Net.Support } } - public static LongBuffer Wrap(long[] array) + public static Int64Buffer Wrap(long[] array) { return Wrap(array, 0, array.Length); } - public abstract LongBuffer Slice(); + public abstract Int64Buffer Slice(); - public abstract LongBuffer Duplicate(); + public abstract Int64Buffer Duplicate(); - public abstract LongBuffer AsReadOnlyBuffer(); + public abstract Int64Buffer AsReadOnlyBuffer(); public abstract long Get(); - public abstract LongBuffer Put(long l); + public abstract Int64Buffer Put(long l); public abstract long Get(int index); - public abstract LongBuffer Put(int index, long l); + public abstract Int64Buffer Put(int index, long l); // -- Bulk get operations -- - public virtual LongBuffer Get(long[] dst, int offset, int length) + public virtual Int64Buffer Get(long[] dst, int offset, int length) { CheckBounds(offset, length, dst.Length); if (length > Remaining) @@ -91,14 +91,14 @@ namespace Lucene.Net.Support return this; } - public virtual LongBuffer Get(long[] dst) + public virtual Int64Buffer Get(long[] dst) { return Get(dst, 0, dst.Length); } // -- Bulk put operations -- - public virtual LongBuffer Put(LongBuffer src) + public virtual Int64Buffer Put(Int64Buffer src) { if (src == this) throw new ArgumentException(); @@ -112,7 +112,7 @@ namespace Lucene.Net.Support return this; } - public virtual LongBuffer Put(long[] src, int offset, int length) + public virtual Int64Buffer Put(long[] src, int offset, int length) { CheckBounds(offset, length, src.Length); if (length > Remaining) @@ -123,7 +123,7 @@ namespace Lucene.Net.Support return this; } - public LongBuffer Put(long[] src) + public Int64Buffer Put(long[] src) { return Put(src, 0, src.Length); } @@ -160,7 +160,7 @@ namespace Lucene.Net.Support } } - public abstract LongBuffer Compact(); + public abstract Int64Buffer Compact(); //public override bool IsDirect { get; } @@ -193,9 +193,9 @@ namespace Lucene.Net.Support { if (this == obj) return true; - if (!(obj is LongBuffer)) + if (!(obj is Int64Buffer)) return false; - LongBuffer that = (LongBuffer)obj; + Int64Buffer that = (Int64Buffer)obj; if (this.Remaining != that.Remaining) return false; int p = this.Position; @@ -210,7 +210,7 @@ namespace Lucene.Net.Support return x == y; } - public int CompareTo(LongBuffer other) + public int CompareTo(Int64Buffer other) { int n = this.Position + Math.Min(this.Remaining, other.Remaining); for (int i = this.Position, j = other.Position; i < n; i++, j++) @@ -237,7 +237,10 @@ namespace Lucene.Net.Support public abstract ByteOrder Order { get; } - public class HeapLongBuffer : LongBuffer + /// <summary> + /// NOTE: This was HeapLongBuffer in the JDK + /// </summary> + public class HeapInt64Buffer : Int64Buffer { // For speed these fields are actually declared in X-Buffer; // these declarations are here as documentation @@ -248,7 +251,7 @@ namespace Lucene.Net.Support */ - internal HeapLongBuffer(int cap, int lim) + internal HeapInt64Buffer(int cap, int lim) : base(-1, 0, lim, cap, new long[cap], 0) { /* @@ -257,7 +260,7 @@ namespace Lucene.Net.Support */ } - internal HeapLongBuffer(long[] buf, int off, int len) + internal HeapInt64Buffer(long[] buf, int off, int len) : base(-1, off, off + len, buf.Length, buf, 0) { /* @@ -266,7 +269,7 @@ namespace Lucene.Net.Support */ } - protected HeapLongBuffer(long[] buf, + protected HeapInt64Buffer(long[] buf, int mark, int pos, int lim, int cap, int off) : base(mark, pos, lim, cap, buf, off) @@ -277,9 +280,9 @@ namespace Lucene.Net.Support */ } - public override LongBuffer Slice() + public override Int64Buffer Slice() { - return new HeapLongBuffer(hb, + return new HeapInt64Buffer(hb, -1, 0, this.Remaining, @@ -287,9 +290,9 @@ namespace Lucene.Net.Support this.Position + offset); } - public override LongBuffer Duplicate() + public override Int64Buffer Duplicate() { - return new HeapLongBuffer(hb, + return new HeapInt64Buffer(hb, this.MarkValue, this.Position, this.Limit, @@ -297,7 +300,7 @@ namespace Lucene.Net.Support offset); } - public override LongBuffer AsReadOnlyBuffer() + public override Int64Buffer AsReadOnlyBuffer() { throw new NotImplementedException(); //return new HeapLongBufferR(hb, @@ -323,7 +326,7 @@ namespace Lucene.Net.Support return hb[Ix(CheckIndex(index))]; } - public override LongBuffer Get(long[] dst, int offset, int length) + public override Int64Buffer Get(long[] dst, int offset, int length) { CheckBounds(offset, length, dst.Length); if (length > Remaining) @@ -350,19 +353,19 @@ namespace Lucene.Net.Support } } - public override LongBuffer Put(long l) + public override Int64Buffer Put(long l) { hb[Ix(NextPutIndex())] = l; return this; } - public override LongBuffer Put(int index, long l) + public override Int64Buffer Put(int index, long l) { hb[Ix(CheckIndex(index))] = l; return this; } - public override LongBuffer Put(long[] src, int offset, int length) + public override Int64Buffer Put(long[] src, int offset, int length) { CheckBounds(offset, length, src.Length); @@ -373,13 +376,13 @@ namespace Lucene.Net.Support return this; } - public override LongBuffer Put(LongBuffer src) + public override Int64Buffer Put(Int64Buffer src) { - if (src is HeapLongBuffer) { + if (src is HeapInt64Buffer) { if (src == this) throw new ArgumentException(); - HeapLongBuffer sb = (HeapLongBuffer)src; + HeapInt64Buffer sb = (HeapInt64Buffer)src; int n = sb.Remaining; if (n > Remaining) throw new BufferOverflowException(); @@ -402,7 +405,7 @@ namespace Lucene.Net.Support return this; } - public override LongBuffer Compact() + public override Int64Buffer Compact() { System.Array.Copy(hb, Ix(Position), hb, Ix(0), Remaining); SetPosition(Remaining); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/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 2d29ae7..0f9d73f 100644 --- a/src/Lucene.Net.Core/Support/MemoryMappedFileByteBuffer.cs +++ b/src/Lucene.Net.Core/Support/MemoryMappedFileByteBuffer.cs @@ -372,7 +372,7 @@ namespace Lucene.Net.Support /// <summary> /// NOTE: This was asLongBuffer() in the JDK /// </summary> - public override LongBuffer AsInt64Buffer() + public override Int64Buffer AsInt64Buffer() { throw new NotSupportedException(); }
