http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/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 1e6ee2c..4c02d4e 100644 --- a/src/Lucene.Net.Core/Util/Automaton/BasicOperations.cs +++ b/src/Lucene.Net.Core/Util/Automaton/BasicOperations.cs @@ -796,10 +796,10 @@ namespace Lucene.Net.Util.Automaton bool initAccept = a.initial.accept; int initNumber = a.initial.number; a.initial = new State(); - SortedIntSet.FrozenIntSet initialset = new SortedIntSet.FrozenIntSet(initNumber, a.initial); + SortedInt32Set.FrozenInt32Set initialset = new SortedInt32Set.FrozenInt32Set(initNumber, a.initial); - LinkedList<SortedIntSet.FrozenIntSet> worklist = new LinkedList<SortedIntSet.FrozenIntSet>(); - IDictionary<SortedIntSet.FrozenIntSet, State> newstate = new Dictionary<SortedIntSet.FrozenIntSet, State>(); + LinkedList<SortedInt32Set.FrozenInt32Set> worklist = new LinkedList<SortedInt32Set.FrozenInt32Set>(); + IDictionary<SortedInt32Set.FrozenInt32Set, State> newstate = new Dictionary<SortedInt32Set.FrozenInt32Set, State>(); worklist.AddLast(initialset); @@ -816,7 +816,7 @@ namespace Lucene.Net.Util.Automaton PointTransitionSet points = new PointTransitionSet(); // like SortedMap<Integer,Integer> - SortedIntSet statesSet = new SortedIntSet(5); + SortedInt32Set statesSet = new SortedInt32Set(5); // LUCENENET TODO: THIS IS INFINITE LOOPING @@ -825,7 +825,7 @@ namespace Lucene.Net.Util.Automaton // differing equality checking. while (worklist.Count > 0) { - SortedIntSet.FrozenIntSet s = worklist.First.Value; + SortedInt32Set.FrozenInt32Set s = worklist.First.Value; worklist.Remove(s); // Collate all outgoing transitions by min/1+max: @@ -866,7 +866,7 @@ namespace Lucene.Net.Util.Automaton { q = new State(); - SortedIntSet.FrozenIntSet p = statesSet.Freeze(q); + SortedInt32Set.FrozenInt32Set p = statesSet.Freeze(q); worklist.AddLast(p); if (newStateUpto == newStatesArray.Length) {
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/Automaton/MinimizationOperations.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Automaton/MinimizationOperations.cs b/src/Lucene.Net.Core/Util/Automaton/MinimizationOperations.cs index 3a1d413..1350478 100644 --- a/src/Lucene.Net.Core/Util/Automaton/MinimizationOperations.cs +++ b/src/Lucene.Net.Core/Util/Automaton/MinimizationOperations.cs @@ -86,7 +86,7 @@ namespace Lucene.Net.Util.Automaton int[] block = new int[statesLen]; StateList[,] active = new StateList[statesLen, sigmaLen]; StateListNode[,] active2 = new StateListNode[statesLen, sigmaLen]; - LinkedList<IntPair> pending = new LinkedList<IntPair>(); + LinkedList<Int32Pair> pending = new LinkedList<Int32Pair>(); BitArray pending2 = new BitArray(sigmaLen * statesLen); BitArray split = new BitArray(statesLen), refine = new BitArray(statesLen), refine2 = new BitArray(statesLen); for (int q = 0; q < statesLen; q++) @@ -134,14 +134,14 @@ namespace Lucene.Net.Util.Automaton for (int x = 0; x < sigmaLen; x++) { int j = (active[0, x].Count <= active[1, x].Count) ? 0 : 1; - pending.AddLast(new IntPair(j, x)); + pending.AddLast(new Int32Pair(j, x)); pending2.SafeSet(x * statesLen + j, true); } // process pending until fixed point int k = 2; while (pending.Count > 0) { - IntPair ip = pending.First.Value; + Int32Pair ip = pending.First.Value; pending.Remove(ip); int p = ip.N1; int x = ip.N2; @@ -199,12 +199,12 @@ namespace Lucene.Net.Util.Automaton if (!pending2.SafeGet(ofs + j) && 0 < aj && aj <= ak) { pending2.SafeSet(ofs + j, true); - pending.AddLast(new IntPair(j, c)); + pending.AddLast(new Int32Pair(j, c)); } else { pending2.SafeSet(ofs + k, true); - pending.AddLast(new IntPair(k, c)); + pending.AddLast(new Int32Pair(k, c)); } } k++; @@ -249,11 +249,14 @@ namespace Lucene.Net.Util.Automaton a.RemoveDeadTransitions(); } - internal sealed class IntPair + /// <summary> + /// NOTE: This was IntPair in Lucene + /// </summary> + internal sealed class Int32Pair { internal int N1 { get; private set; } internal int N2 { get; private set; } - internal IntPair(int n1, int n2) + internal Int32Pair(int n1, int n2) { this.N1 = n1; this.N2 = n2; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/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 44b9a8a..1ce3b7f 100644 --- a/src/Lucene.Net.Core/Util/Automaton/SortedIntSet.cs +++ b/src/Lucene.Net.Core/Util/Automaton/SortedIntSet.cs @@ -22,10 +22,14 @@ namespace Lucene.Net.Util.Automaton * limitations under the License. */ - // 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> // LUCENENET TODO: Rename SortedInt32Set + /// <summary> + /// Just holds a set of int[] states, plus a corresponding + /// int[] count per state. Used by + /// BasicOperations.determinize + /// <para/> + /// NOTE: This was SortedIntSet in Lucene + /// </summary> + internal sealed class SortedInt32Set : IEquatable<SortedInt32Set>, IEquatable<SortedInt32Set.FrozenInt32Set> { internal int[] values; internal int[] counts; @@ -42,7 +46,7 @@ namespace Lucene.Net.Util.Automaton internal State state; - public SortedIntSet(int capacity) + public SortedInt32Set(int capacity) { values = new int[capacity]; counts = new int[capacity]; @@ -184,18 +188,18 @@ namespace Lucene.Net.Util.Automaton } } - public FrozenIntSet ToFrozenInt32Set() // LUCENENET TODO: This didn't exist in the original + public FrozenInt32Set ToFrozenInt32Set() // LUCENENET TODO: This didn't exist in the original { int[] c = new int[upto]; Array.Copy(values, 0, c, 0, upto); - return new FrozenIntSet(c, this.hashCode, this.state); + return new FrozenInt32Set(c, this.hashCode, this.state); } - public FrozenIntSet Freeze(State state) + public FrozenInt32Set Freeze(State state) { int[] c = new int[upto]; Array.Copy(values, 0, c, 0, upto); - return new FrozenIntSet(c, hashCode, state); + return new FrozenInt32Set(c, hashCode, state); } public override int GetHashCode() @@ -209,11 +213,11 @@ namespace Lucene.Net.Util.Automaton { return false; } - if (!(other is FrozenIntSet)) + if (!(other is FrozenInt32Set)) { return false; } - FrozenIntSet other2 = (FrozenIntSet)other; + FrozenInt32Set other2 = (FrozenInt32Set)other; if (hashCode != other2.hashCode) { return false; @@ -233,12 +237,12 @@ namespace Lucene.Net.Util.Automaton return true; } - public bool Equals(SortedIntSet other) // LUCENENET TODO: This didn't exist in the original + public bool Equals(SortedInt32Set other) // LUCENENET TODO: This didn't exist in the original { throw new NotImplementedException("SortedIntSet Equals"); } - public bool Equals(FrozenIntSet other) // LUCENENET TODO: This didn't exist in the original + public bool Equals(FrozenInt32Set other) // LUCENENET TODO: This didn't exist in the original { if (other == null) { @@ -280,20 +284,23 @@ namespace Lucene.Net.Util.Automaton return sb.ToString(); } - public sealed class FrozenIntSet : IEquatable<SortedIntSet>, IEquatable<FrozenIntSet> // LUCENENET TODO: Rename FrozenInt32Set + /// <summary> + /// NOTE: This was FrozenIntSet in Lucene + /// </summary> + public sealed class FrozenInt32Set : IEquatable<SortedInt32Set>, IEquatable<FrozenInt32Set> { internal readonly int[] values; internal readonly int hashCode; internal readonly State state; - public FrozenIntSet(int[] values, int hashCode, State state) + public FrozenInt32Set(int[] values, int hashCode, State state) { this.values = values; this.hashCode = hashCode; this.state = state; } - public FrozenIntSet(int num, State state) + public FrozenInt32Set(int num, State state) { this.values = new int[] { num }; this.state = state; @@ -311,9 +318,9 @@ namespace Lucene.Net.Util.Automaton { return false; } - if (other is FrozenIntSet) + if (other is FrozenInt32Set) { - FrozenIntSet other2 = (FrozenIntSet)other; + FrozenInt32Set other2 = (FrozenInt32Set)other; if (hashCode != other2.hashCode) { return false; @@ -331,9 +338,9 @@ namespace Lucene.Net.Util.Automaton } return true; } - else if (other is SortedIntSet) + else if (other is SortedInt32Set) { - SortedIntSet other3 = (SortedIntSet)other; + SortedInt32Set other3 = (SortedInt32Set)other; if (hashCode != other3.hashCode) { return false; @@ -355,7 +362,7 @@ namespace Lucene.Net.Util.Automaton return false; } - public bool Equals(SortedIntSet other) // LUCENENET TODO: This didn't exist in the original + public bool Equals(SortedInt32Set other) // LUCENENET TODO: This didn't exist in the original { if (other == null) { @@ -380,7 +387,7 @@ namespace Lucene.Net.Util.Automaton return true; } - public bool Equals(FrozenIntSet other) // LUCENENET TODO: This didn't exist in the original + public bool Equals(FrozenInt32Set other) // LUCENENET TODO: This didn't exist in the original { if (other == null) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/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 609a3a5..ac83546 100644 --- a/src/Lucene.Net.Core/Util/Automaton/SpecialOperations.cs +++ b/src/Lucene.Net.Core/Util/Automaton/SpecialOperations.cs @@ -285,17 +285,17 @@ namespace Lucene.Net.Util.Automaton /// strings are accepted, the first limit strings found are returned. If <code>limit</code><0, then /// the limit is infinite. /// </summary> - public static ISet<IntsRef> GetFiniteStrings(Automaton a, int limit) + public static ISet<Int32sRef> GetFiniteStrings(Automaton a, int limit) { - HashSet<IntsRef> strings = new HashSet<IntsRef>(); + HashSet<Int32sRef> strings = new HashSet<Int32sRef>(); if (a.IsSingleton) { if (limit > 0) { - strings.Add(Util.ToUTF32(a.Singleton, new IntsRef())); + strings.Add(Util.ToUTF32(a.Singleton, new Int32sRef())); } } - else if (!GetFiniteStrings(a.initial, new HashSet<State>(), strings, new IntsRef(), limit)) + else if (!GetFiniteStrings(a.initial, new HashSet<State>(), strings, new Int32sRef(), limit)) { return strings; } @@ -307,7 +307,7 @@ namespace Lucene.Net.Util.Automaton /// false if more than <code>limit</code> strings are found. /// <code>limit</code><0 means "infinite". /// </summary> - private static bool GetFiniteStrings(State s, HashSet<State> pathstates, HashSet<IntsRef> strings, IntsRef path, int limit) + private static bool GetFiniteStrings(State s, HashSet<State> pathstates, HashSet<Int32sRef> strings, Int32sRef path, int limit) { pathstates.Add(s); foreach (Transition t in s.GetTransitions()) @@ -323,7 +323,7 @@ namespace Lucene.Net.Util.Automaton path.Length++; if (t.to.accept) { - strings.Add(IntsRef.DeepCopyOf(path)); + strings.Add(Int32sRef.DeepCopyOf(path)); if (limit >= 0 && strings.Count > limit) { return false; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/BytesRefHash.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/BytesRefHash.cs b/src/Lucene.Net.Core/Util/BytesRefHash.cs index 1916ef1..b134712 100644 --- a/src/Lucene.Net.Core/Util/BytesRefHash.cs +++ b/src/Lucene.Net.Core/Util/BytesRefHash.cs @@ -593,7 +593,7 @@ namespace Lucene.Net.Util /// <seealso cref="BytesStartArray"/>. The <seealso cref="BytesRefHash"/> uses this reference to /// track it memory usage /// </summary> - /// <returns> a <seealso cref="AtomicLong"/> reference holding the number of bytes used + /// <returns> a <seealso cref="AtomicInt64"/> reference holding the number of bytes used /// by this <seealso cref="BytesStartArray"/>. </returns> public abstract Counter BytesUsed(); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/FixedBitSet.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/FixedBitSet.cs b/src/Lucene.Net.Core/Util/FixedBitSet.cs index f375819..0f4aa34 100644 --- a/src/Lucene.Net.Core/Util/FixedBitSet.cs +++ b/src/Lucene.Net.Core/Util/FixedBitSet.cs @@ -28,7 +28,7 @@ namespace Lucene.Net.Util /// BitSet of fixed length (numBits), backed by accessible (<seealso cref="#getBits"/>) /// long[], accessed with an int index, implementing <seealso cref="GetBits"/> and /// <seealso cref="DocIdSet"/>. If you need to manage more than 2.1B bits, use - /// <seealso cref="LongBitSet"/>. + /// <seealso cref="Int64BitSet"/>. /// /// @lucene.internal /// </summary> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/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 b147f4d..7195193 100644 --- a/src/Lucene.Net.Core/Util/Fst/Builder.cs +++ b/src/Lucene.Net.Core/Util/Fst/Builder.cs @@ -23,7 +23,7 @@ namespace Lucene.Net.Util.Fst */ //using INPUT_TYPE = Lucene.Net.Util.Fst.FST.INPUT_TYPE; // javadoc - using PackedInts = Lucene.Net.Util.Packed.PackedInts; + using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s; // TODO: could we somehow stream an FST to disk while we // build it? @@ -68,7 +68,7 @@ namespace Lucene.Net.Util.Fst private readonly bool doShareNonSingletonNodes; private readonly int shareMaxTailLength; - private readonly IntsRef lastInput = new IntsRef(); + private readonly Int32sRef lastInput = new Int32sRef(); // for packing private readonly bool doPackFST; @@ -104,7 +104,7 @@ namespace Lucene.Net.Util.Fst /// boolean, int)} with pruning options turned off. /// </summary> public Builder(FST.INPUT_TYPE inputType, Outputs<T> outputs) - : this(inputType, 0, 0, true, true, int.MaxValue, outputs, null, false, PackedInts.COMPACT, true, 15) + : this(inputType, 0, 0, true, true, int.MaxValue, outputs, null, false, PackedInt32s.COMPACT, true, 15) { var x = new System.Text.StringBuilder(); } @@ -149,7 +149,7 @@ namespace Lucene.Net.Util.Fst /// <param name="doPackFST"> Pass true to create a packed FST. /// </param> /// <param name="acceptableOverheadRatio"> How to trade speed for space when building the FST. this option </param> - /// is only relevant when doPackFST is true. <seealso cref= PackedInts#getMutable(int, int, float) + /// is only relevant when doPackFST is true. <seealso cref= PackedInt32s#getMutable(int, int, float) /// </seealso> /// <param name="allowArrayArcs"> Pass false to disable the array arc optimization /// while building the FST; this will make the resulting @@ -375,7 +375,7 @@ namespace Lucene.Net.Util.Fst /// IntSequenceOutputs}) then you cannot reuse across /// calls. /// </summary> - public virtual void Add(IntsRef input, T output) + public virtual void Add(Int32sRef input, T output) { /* if (DEBUG) { @@ -609,7 +609,7 @@ namespace Lucene.Net.Util.Fst /// </summary> public abstract class FreezeTail<S> { - public abstract void Freeze(UnCompiledNode<S>[] frontier, int prefixLenPlus1, IntsRef prevInput); + public abstract void Freeze(UnCompiledNode<S>[] frontier, int prefixLenPlus1, Int32sRef prevInput); } public interface INode // LUCENENET NOTE: made public rather than internal because it is returned in public types http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/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 8cc840d..0c53847 100644 --- a/src/Lucene.Net.Core/Util/Fst/FST.cs +++ b/src/Lucene.Net.Core/Util/Fst/FST.cs @@ -32,7 +32,7 @@ namespace Lucene.Net.Util.Fst using GrowableWriter = Lucene.Net.Util.Packed.GrowableWriter; using InputStreamDataInput = Lucene.Net.Store.InputStreamDataInput; using OutputStreamDataOutput = Lucene.Net.Store.OutputStreamDataOutput; - using PackedInts = Lucene.Net.Util.Packed.PackedInts; + using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s; using RAMOutputStream = Lucene.Net.Store.RAMOutputStream; // TODO: break this into WritableFST and ReadOnlyFST.. then @@ -164,7 +164,7 @@ namespace Lucene.Net.Util.Fst private long arcWithOutputCount; private readonly bool packed; - private PackedInts.Reader nodeRefToAddress; + private PackedInt32s.Reader nodeRefToAddress; ///// <summary> ///// If arc has this label then that arc is final/accepted </summary> @@ -297,7 +297,7 @@ namespace Lucene.Net.Util.Fst } if (packed) { - nodeRefToAddress = PackedInts.GetReader(@in); + nodeRefToAddress = PackedInt32s.GetReader(@in); } else { @@ -493,7 +493,7 @@ namespace Lucene.Net.Util.Fst { throw new InvalidOperationException("cannot save an FST pre-packed FST; it must first be packed"); } - if (packed && !(nodeRefToAddress is PackedInts.Mutable)) + if (packed && !(nodeRefToAddress is PackedInt32s.Mutable)) { throw new InvalidOperationException("cannot save a FST which has been loaded from disk "); } @@ -556,7 +556,7 @@ namespace Lucene.Net.Util.Fst @out.WriteByte((byte)t); if (packed) { - ((PackedInts.Mutable)nodeRefToAddress).Save(@out); + ((PackedInt32s.Mutable)nodeRefToAddress).Save(@out); } @out.WriteVInt64(startNode); @out.WriteVInt64(nodeCount); @@ -1727,7 +1727,7 @@ namespace Lucene.Net.Util.Fst } // +1 because node ords start at 1 (0 is reserved as stop node): - GrowableWriter newNodeAddress = new GrowableWriter(PackedInts.BitsRequired(this.bytes.Position), (int)(1 + nodeCount), acceptableOverheadRatio); + GrowableWriter newNodeAddress = new GrowableWriter(PackedInt32s.BitsRequired(this.bytes.Position), (int)(1 + nodeCount), acceptableOverheadRatio); // Fill initial coarse guess: for (int node = 1; node <= nodeCount; node++) @@ -2035,7 +2035,7 @@ namespace Lucene.Net.Util.Fst maxAddress = Math.Max(maxAddress, newNodeAddress.Get((int)key)); } - PackedInts.Mutable nodeRefToAddressIn = PackedInts.GetMutable(topNodeMap.Count, PackedInts.BitsRequired(maxAddress), acceptableOverheadRatio); + PackedInt32s.Mutable nodeRefToAddressIn = PackedInt32s.GetMutable(topNodeMap.Count, PackedInt32s.BitsRequired(maxAddress), acceptableOverheadRatio); foreach (KeyValuePair<int, int> ent in topNodeMap) { nodeRefToAddressIn.Set(ent.Value, newNodeAddress.Get(ent.Key)); @@ -2307,9 +2307,9 @@ namespace Lucene.Net.Util.Fst internal class ArcAndState<T> { internal Arc<T> Arc { get; private set; } - internal IntsRef Chain { get; private set; } + internal Int32sRef Chain { get; private set; } - public ArcAndState(Arc<T> arc, IntsRef chain) + public ArcAndState(Arc<T> arc, Int32sRef chain) { this.Arc = arc; this.Chain = chain; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/Fst/IntSequenceOutputs.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Fst/IntSequenceOutputs.cs b/src/Lucene.Net.Core/Util/Fst/IntSequenceOutputs.cs index 0db64a6..1f586ba 100644 --- a/src/Lucene.Net.Core/Util/Fst/IntSequenceOutputs.cs +++ b/src/Lucene.Net.Core/Util/Fst/IntSequenceOutputs.cs @@ -24,21 +24,23 @@ namespace Lucene.Net.Util.Fst using DataOutput = Lucene.Net.Store.DataOutput; /// <summary> - /// An FST <seealso cref="Outputs"/> implementation where each output + /// An FST <see cref="Outputs{T}"/> implementation where each output /// is a sequence of ints. + /// <para/> + /// NOTE: This was IntSequenceOutputs in Lucene /// /// @lucene.experimental /// </summary> - public sealed class IntSequenceOutputs : Outputs<IntsRef> + public sealed class Int32SequenceOutputs : Outputs<Int32sRef> { - private static readonly IntsRef NO_OUTPUT = new IntsRef(); - private static readonly IntSequenceOutputs singleton = new IntSequenceOutputs(); + private static readonly Int32sRef NO_OUTPUT = new Int32sRef(); + private static readonly Int32SequenceOutputs singleton = new Int32SequenceOutputs(); - private IntSequenceOutputs() + private Int32SequenceOutputs() { } - public static IntSequenceOutputs Singleton + public static Int32SequenceOutputs Singleton { get { @@ -46,7 +48,7 @@ namespace Lucene.Net.Util.Fst } } - public override IntsRef Common(IntsRef output1, IntsRef output2) + public override Int32sRef Common(Int32sRef output1, Int32sRef output2) { Debug.Assert(output1 != null); Debug.Assert(output2 != null); @@ -81,11 +83,11 @@ namespace Lucene.Net.Util.Fst } else { - return new IntsRef(output1.Int32s, output1.Offset, pos1 - output1.Offset); + return new Int32sRef(output1.Int32s, output1.Offset, pos1 - output1.Offset); } } - public override IntsRef Subtract(IntsRef output, IntsRef inc) + public override Int32sRef Subtract(Int32sRef output, Int32sRef inc) { Debug.Assert(output != null); Debug.Assert(inc != null); @@ -103,11 +105,11 @@ namespace Lucene.Net.Util.Fst { Debug.Assert(inc.Length < output.Length, "inc.length=" + inc.Length + " vs output.length=" + output.Length); Debug.Assert(inc.Length > 0); - return new IntsRef(output.Int32s, output.Offset + inc.Length, output.Length - inc.Length); + return new Int32sRef(output.Int32s, output.Offset + inc.Length, output.Length - inc.Length); } } - public override IntsRef Add(IntsRef prefix, IntsRef output) + public override Int32sRef Add(Int32sRef prefix, Int32sRef output) { Debug.Assert(prefix != null); Debug.Assert(output != null); @@ -123,7 +125,7 @@ namespace Lucene.Net.Util.Fst { Debug.Assert(prefix.Length > 0); Debug.Assert(output.Length > 0); - IntsRef result = new IntsRef(prefix.Length + output.Length); + Int32sRef result = new Int32sRef(prefix.Length + output.Length); Array.Copy(prefix.Int32s, prefix.Offset, result.Int32s, 0, prefix.Length); Array.Copy(output.Int32s, output.Offset, result.Int32s, prefix.Length, output.Length); result.Length = prefix.Length + output.Length; @@ -131,7 +133,7 @@ namespace Lucene.Net.Util.Fst } } - public override void Write(IntsRef prefix, DataOutput @out) + public override void Write(Int32sRef prefix, DataOutput @out) { Debug.Assert(prefix != null); @out.WriteVInt32(prefix.Length); @@ -141,7 +143,7 @@ namespace Lucene.Net.Util.Fst } } - public override IntsRef Read(DataInput @in) + public override Int32sRef Read(DataInput @in) { int len = @in.ReadVInt32(); if (len == 0) @@ -150,7 +152,7 @@ namespace Lucene.Net.Util.Fst } else { - IntsRef output = new IntsRef(len); + Int32sRef output = new Int32sRef(len); for (int idx = 0; idx < len; idx++) { output.Int32s[idx] = @in.ReadVInt32(); @@ -160,7 +162,7 @@ namespace Lucene.Net.Util.Fst } } - public override IntsRef NoOutput + public override Int32sRef NoOutput { get { @@ -168,7 +170,7 @@ namespace Lucene.Net.Util.Fst } } - public override string OutputToString(IntsRef output) + public override string OutputToString(Int32sRef output) { return output.ToString(); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs b/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs index fba0afb..9fea57c 100644 --- a/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs +++ b/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs @@ -21,15 +21,17 @@ namespace Lucene.Net.Util.Fst /// <summary> /// Enumerates all input (IntsRef) + output pairs in an - /// FST. + /// FST. + /// <para/> + /// NOTE: This was IntsRefFSTEnum{T} in Lucene /// /// @lucene.experimental /// </summary> - public sealed class IntsRefFSTEnum<T> : FSTEnum<T> + public sealed class Int32sRefFSTEnum<T> : FSTEnum<T> { - private readonly IntsRef current = new IntsRef(10); - private readonly IntsRefFSTEnum.InputOutput<T> result = new IntsRefFSTEnum.InputOutput<T>(); - private IntsRef target; + private readonly Int32sRef current = new Int32sRef(10); + private readonly Int32sRefFSTEnum.InputOutput<T> result = new Int32sRefFSTEnum.InputOutput<T>(); + private Int32sRef target; // LUCENENET NOTE: The InputOutput<T> class was moved into the IntsRefFSTEnum class @@ -38,19 +40,19 @@ namespace Lucene.Net.Util.Fst /// doFloor is true, advance positions to the biggest /// term before target. /// </summary> - public IntsRefFSTEnum(FST<T> fst) + public Int32sRefFSTEnum(FST<T> fst) : base(fst) { result.Input = current; current.Offset = 1; } - public IntsRefFSTEnum.InputOutput<T> Current + public Int32sRefFSTEnum.InputOutput<T> Current { get { return result; } } - public IntsRefFSTEnum.InputOutput<T> Next() + public Int32sRefFSTEnum.InputOutput<T> Next() { //System.out.println(" enum.next"); DoNext(); @@ -59,7 +61,7 @@ namespace Lucene.Net.Util.Fst /// <summary> /// Seeks to smallest term that's >= target. </summary> - public IntsRefFSTEnum.InputOutput<T> SeekCeil(IntsRef target) + public Int32sRefFSTEnum.InputOutput<T> SeekCeil(Int32sRef target) { this.target = target; m_targetLength = target.Length; @@ -69,7 +71,7 @@ namespace Lucene.Net.Util.Fst /// <summary> /// Seeks to biggest term that's <= target. </summary> - public IntsRefFSTEnum.InputOutput<T> SeekFloor(IntsRef target) + public Int32sRefFSTEnum.InputOutput<T> SeekFloor(Int32sRef target) { this.target = target; m_targetLength = target.Length; @@ -83,7 +85,7 @@ namespace Lucene.Net.Util.Fst /// #seekFloor} or <seealso cref="#seekCeil"/> because it /// short-circuits as soon the match is not found. /// </summary> - public IntsRefFSTEnum.InputOutput<T> SeekExact(IntsRef target) + public Int32sRefFSTEnum.InputOutput<T> SeekExact(Int32sRef target) { this.target = target; m_targetLength = target.Length; @@ -131,7 +133,7 @@ namespace Lucene.Net.Util.Fst current.Int32s = ArrayUtil.Grow(current.Int32s, m_upto + 1); } - private IntsRefFSTEnum.InputOutput<T> SetResult() + private Int32sRefFSTEnum.InputOutput<T> SetResult() { if (m_upto == 0) { @@ -149,18 +151,20 @@ namespace Lucene.Net.Util.Fst /// <summary> /// LUCENENET specific. This class is to mimic Java's ability to specify /// nested classes of Generics without having to specify the generic type - /// (i.e. IntsRefFSTEnum.InputOutput{T} rather than IntsRefFSTEnum{T}.InputOutput{T}) + /// (i.e. <c>Int32sRefFSTEnum.InputOutput{T}</c> rather than <c>Int32sRefFSTEnum{T}.InputOutput{T}</c>) + /// <para/> + /// NOTE: This was Int32sRefFSTEnum{T} in Lucene /// </summary> - public sealed class IntsRefFSTEnum + public sealed class Int32sRefFSTEnum { - private IntsRefFSTEnum() + private Int32sRefFSTEnum() { } /// <summary> /// Holds a single input (IntsRef) + output pair. </summary> public class InputOutput<T> { - public IntsRef Input { get; set; } + public Int32sRef Input { get; set; } public T Output { get; set; } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/Fst/NodeHash.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs index ee61491..67dc54e 100644 --- a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs +++ b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs @@ -20,7 +20,7 @@ namespace Lucene.Net.Util.Fst * limitations under the License. */ - using PackedInts = Lucene.Net.Util.Packed.PackedInts; + using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s; using PagedGrowableWriter = Lucene.Net.Util.Packed.PagedGrowableWriter; // Used to dedup states (lookup already-frozen states) @@ -35,7 +35,7 @@ namespace Lucene.Net.Util.Fst public NodeHash(FST<T> fst, FST.BytesReader input) { - table = new PagedGrowableWriter(16, 1 << 30, 8, PackedInts.COMPACT); + table = new PagedGrowableWriter(16, 1 << 30, 8, PackedInt32s.COMPACT); mask = 15; this.fst = fst; this.input = input; @@ -184,7 +184,7 @@ namespace Lucene.Net.Util.Fst { PagedGrowableWriter oldTable = table; - table = new PagedGrowableWriter(2 * oldTable.Count, 1 << 30, PackedInts.BitsRequired(count), PackedInts.COMPACT); + table = new PagedGrowableWriter(2 * oldTable.Count, 1 << 30, PackedInt32s.BitsRequired(count), PackedInt32s.COMPACT); mask = table.Count - 1; for (long idx = 0; idx < oldTable.Count; idx++) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/Fst/PositiveIntOutputs.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Fst/PositiveIntOutputs.cs b/src/Lucene.Net.Core/Util/Fst/PositiveIntOutputs.cs index 3713f83..4350dc9 100644 --- a/src/Lucene.Net.Core/Util/Fst/PositiveIntOutputs.cs +++ b/src/Lucene.Net.Core/Util/Fst/PositiveIntOutputs.cs @@ -24,22 +24,24 @@ namespace Lucene.Net.Util.Fst using DataOutput = Lucene.Net.Store.DataOutput; /// <summary> - /// An FST <seealso cref="Outputs"/> implementation where each output + /// An FST <seealso cref="Outputs{T}"/> implementation where each output /// is a non-negative long value. + /// <para/> + /// NOTE: This was PositiveIntOutputs in Lucene /// /// @lucene.experimental /// </summary> - public sealed class PositiveIntOutputs : Outputs<long?> + public sealed class PositiveInt32Outputs : Outputs<long?> { private static readonly long NO_OUTPUT = new long(); - private static readonly PositiveIntOutputs singleton = new PositiveIntOutputs(); + private static readonly PositiveInt32Outputs singleton = new PositiveInt32Outputs(); - private PositiveIntOutputs() + private PositiveInt32Outputs() { } - public static PositiveIntOutputs Singleton + public static PositiveInt32Outputs Singleton { get { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/Fst/Util.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Fst/Util.cs b/src/Lucene.Net.Core/Util/Fst/Util.cs index e3329c2..44bd4bc 100644 --- a/src/Lucene.Net.Core/Util/Fst/Util.cs +++ b/src/Lucene.Net.Core/Util/Fst/Util.cs @@ -39,7 +39,7 @@ namespace Lucene.Net.Util.Fst /// Looks up the output for this input, or null if the /// input is not accepted. /// </summary> - public static T Get<T>(FST<T> fst, IntsRef input) + public static T Get<T>(FST<T> fst, Int32sRef input) { // TODO: would be nice not to alloc this on every lookup var arc = fst.GetFirstArc(new FST.Arc<T>()); @@ -117,7 +117,7 @@ namespace Lucene.Net.Util.Fst /// 2, ...), or file offets (when appending to a file) /// fit this. /// </summary> - public static IntsRef GetByOutput(FST<long?> fst, long targetOutput) + public static Int32sRef GetByOutput(FST<long?> fst, long targetOutput) { var @in = fst.GetBytesReader(); @@ -126,7 +126,7 @@ namespace Lucene.Net.Util.Fst FST.Arc<long?> scratchArc = new FST.Arc<long?>(); - IntsRef result = new IntsRef(); + Int32sRef result = new Int32sRef(); return GetByOutput(fst, targetOutput, @in, arc, scratchArc, result); } @@ -135,7 +135,7 @@ namespace Lucene.Net.Util.Fst /// Expert: like <seealso cref="Util#getByOutput(FST, long)"/> except reusing /// BytesReader, initial and scratch Arc, and result. /// </summary> - public static IntsRef GetByOutput(FST<long?> fst, long targetOutput, FST.BytesReader @in, FST.Arc<long?> arc, FST.Arc<long?> scratchArc, IntsRef result) + public static Int32sRef GetByOutput(FST<long?> fst, long targetOutput, FST.BytesReader @in, FST.Arc<long?> arc, FST.Arc<long?> scratchArc, Int32sRef result) { long output = arc.Output.Value; int upto = 0; @@ -301,11 +301,11 @@ namespace Lucene.Net.Util.Fst { public FST.Arc<T> Arc { get; set; } public T Cost { get; set; } - public IntsRef Input { get; private set; } + public Int32sRef Input { get; private set; } /// <summary> /// Sole constructor </summary> - public FSTPath(T cost, FST.Arc<T> arc, IntsRef input) + public FSTPath(T cost, FST.Arc<T> arc, Int32sRef input) { this.Arc = (new FST.Arc<T>()).CopyFrom(arc); this.Cost = cost; @@ -424,7 +424,7 @@ namespace Lucene.Net.Util.Fst // copy over the current input to the new input // and add the arc.label to the end - IntsRef newInput = new IntsRef(path.Input.Length + 1); + Int32sRef newInput = new Int32sRef(path.Input.Length + 1); Array.Copy(path.Input.Int32s, 0, newInput.Int32s, 0, path.Input.Length); newInput.Int32s[path.Input.Length] = path.Arc.Label; newInput.Length = path.Input.Length + 1; @@ -449,7 +449,7 @@ namespace Lucene.Net.Util.Fst /// Adds all leaving arcs, including 'finished' arc, if /// the node is final, from this node into the queue. /// </summary> - public virtual void AddStartPaths(FST.Arc<T> node, T startOutput, bool allowEmptyString, IntsRef input) + public virtual void AddStartPaths(FST.Arc<T> node, T startOutput, bool allowEmptyString, Int32sRef input) { // De-dup NO_OUTPUT since it must be a singleton: if (startOutput.Equals(fst.Outputs.NoOutput)) @@ -634,7 +634,7 @@ namespace Lucene.Net.Util.Fst return new TopResults<T>(rejectCount + topN <= maxQueueDepth, results); } - protected virtual bool AcceptResult(IntsRef input, T output) + protected virtual bool AcceptResult(Int32sRef input, T output) { return true; } @@ -646,10 +646,10 @@ namespace Lucene.Net.Util.Fst /// </summary> public sealed class Result<T> { - public IntsRef Input { get; private set; } + public Int32sRef Input { get; private set; } public T Output { get; private set; } - public Result(IntsRef input, T output) + public Result(Int32sRef input, T output) { this.Input = input; this.Output = output; @@ -702,7 +702,7 @@ namespace Lucene.Net.Util.Fst // since this search is initialized with a single start node // it is okay to start with an empty input path here - searcher.AddStartPaths(fromNode, startOutput, allowEmptyString, new IntsRef()); + searcher.AddStartPaths(fromNode, startOutput, allowEmptyString, new Int32sRef()); return searcher.Search(); } @@ -978,7 +978,7 @@ namespace Lucene.Net.Util.Fst /// Just maps each UTF16 unit (char) to the ints in an /// IntsRef. /// </summary> - public static IntsRef ToUTF16(string s, IntsRef scratch) + public static Int32sRef ToUTF16(string s, Int32sRef scratch) { int charLimit = s.Length; scratch.Offset = 0; @@ -996,7 +996,7 @@ namespace Lucene.Net.Util.Fst /// CharSequence and places them in the provided scratch /// IntsRef, which must not be null, returning it. /// </summary> - public static IntsRef ToUTF32(string s, IntsRef scratch) + public static Int32sRef ToUTF32(string s, Int32sRef scratch) { int charIdx = 0; int intIdx = 0; @@ -1018,7 +1018,7 @@ namespace Lucene.Net.Util.Fst /// char[] and places them in the provided scratch /// IntsRef, which must not be null, returning it. /// </summary> - public static IntsRef ToUTF32(char[] s, int offset, int length, IntsRef scratch) + public static Int32sRef ToUTF32(char[] s, int offset, int length, Int32sRef scratch) { int charIdx = offset; int intIdx = 0; @@ -1041,7 +1041,7 @@ namespace Lucene.Net.Util.Fst /// <para/> /// NOTE: This was toIntsRef() in Lucene /// </summary> - public static IntsRef ToInt32sRef(BytesRef input, IntsRef scratch) + public static Int32sRef ToInt32sRef(BytesRef input, Int32sRef scratch) { scratch.Grow(input.Length); for (int i = 0; i < input.Length; i++) @@ -1056,7 +1056,7 @@ namespace Lucene.Net.Util.Fst /// Just converts IntsRef to BytesRef; you must ensure the /// int values fit into a byte. /// </summary> - public static BytesRef ToBytesRef(IntsRef input, BytesRef scratch) + public static BytesRef ToBytesRef(Int32sRef input, BytesRef scratch) { scratch.Grow(input.Length); for (int i = 0; i < input.Length; i++) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/IntBlockPool.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/IntBlockPool.cs b/src/Lucene.Net.Core/Util/IntBlockPool.cs index 0216498..300a5f6 100644 --- a/src/Lucene.Net.Core/Util/IntBlockPool.cs +++ b/src/Lucene.Net.Core/Util/IntBlockPool.cs @@ -23,10 +23,12 @@ namespace Lucene.Net.Util */ /// <summary> - /// A pool for int blocks similar to <seealso cref="ByteBlockPool"/> + /// A pool for int blocks similar to <seealso cref="ByteBlockPool"/>. + /// <para/> + /// NOTE: This was IntBlockPool in Lucene /// @lucene.internal /// </summary> - public sealed class IntBlockPool + public sealed class Int32BlockPool { public static readonly int INT_BLOCK_SHIFT = 13; public static readonly int INT_BLOCK_SIZE = 1 << INT_BLOCK_SHIFT; @@ -122,17 +124,17 @@ namespace Lucene.Net.Util private readonly Allocator allocator; /// <summary> - /// Creates a new <seealso cref="IntBlockPool"/> with a default <seealso cref="Allocator"/>. </summary> - /// <seealso cref= IntBlockPool#nextBuffer() </seealso> - public IntBlockPool() + /// Creates a new <seealso cref="Int32BlockPool"/> with a default <seealso cref="Allocator"/>. </summary> + /// <seealso cref= Int32BlockPool#nextBuffer() </seealso> + public Int32BlockPool() : this(new DirectAllocator()) { } /// <summary> - /// Creates a new <seealso cref="IntBlockPool"/> with the given <seealso cref="Allocator"/>. </summary> - /// <seealso cref= IntBlockPool#nextBuffer() </seealso> - public IntBlockPool(Allocator allocator) + /// Creates a new <seealso cref="Int32BlockPool"/> with the given <seealso cref="Allocator"/>. </summary> + /// <seealso cref= Int32BlockPool#nextBuffer() </seealso> + public Int32BlockPool(Allocator allocator) { // set defaults Int32Upto = INT_BLOCK_SIZE; @@ -143,7 +145,7 @@ namespace Lucene.Net.Util /// <summary> /// Resets the pool to its initial state reusing the first buffer. Calling - /// <seealso cref="IntBlockPool#nextBuffer()"/> is not needed after reset. + /// <seealso cref="Int32BlockPool#nextBuffer()"/> is not needed after reset. /// </summary> public void Reset() { @@ -156,8 +158,8 @@ namespace Lucene.Net.Util /// this should be set to <code>true</code> if this pool is used with /// <seealso cref="SliceWriter"/>. </param> /// <param name="reuseFirst"> if <code>true</code> the first buffer will be reused and calling - /// <seealso cref="IntBlockPool#nextBuffer()"/> is not needed after reset iff the - /// block pool was used before ie. <seealso cref="IntBlockPool#nextBuffer()"/> was called before. </param> + /// <seealso cref="Int32BlockPool#nextBuffer()"/> is not needed after reset iff the + /// block pool was used before ie. <seealso cref="Int32BlockPool#nextBuffer()"/> was called before. </param> public void Reset(bool zeroFillBuffers, bool reuseFirst) { if (bufferUpto != -1) @@ -203,7 +205,7 @@ namespace Lucene.Net.Util /// <summary> /// Advances the pool to its next buffer. this method should be called once /// after the constructor to initialize the pool. In contrast to the - /// constructor a <seealso cref="IntBlockPool#reset()"/> call will advance the pool to + /// constructor a <seealso cref="Int32BlockPool#reset()"/> call will advance the pool to /// its first buffer immediately. /// </summary> public void NextBuffer() @@ -251,7 +253,7 @@ namespace Lucene.Net.Util // no need to make this public unless we support different sizes // TODO make the levels and the sizes configurable /// <summary> - /// An array holding the offset into the <seealso cref="IntBlockPool#LEVEL_SIZE_ARRAY"/> + /// An array holding the offset into the <seealso cref="Int32BlockPool#LEVEL_SIZE_ARRAY"/> /// to quickly navigate to the next slice level. /// </summary> private static readonly int[] NEXT_LEVEL_ARRAY = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 9 }; @@ -294,16 +296,16 @@ namespace Lucene.Net.Util } /// <summary> - /// A <seealso cref="SliceWriter"/> that allows to write multiple integer slices into a given <seealso cref="IntBlockPool"/>. + /// A <seealso cref="SliceWriter"/> that allows to write multiple integer slices into a given <seealso cref="Int32BlockPool"/>. /// </summary> /// <seealso cref= SliceReader /// @lucene.internal </seealso> public class SliceWriter { private int offset; - private readonly IntBlockPool pool; + private readonly Int32BlockPool pool; - public SliceWriter(IntBlockPool pool) + public SliceWriter(Int32BlockPool pool) { this.pool = pool; } @@ -365,7 +367,7 @@ namespace Lucene.Net.Util /// </summary> public sealed class SliceReader { - private readonly IntBlockPool pool; + private readonly Int32BlockPool pool; private int upto; private int bufferUpto; private int bufferOffset; @@ -377,7 +379,7 @@ namespace Lucene.Net.Util /// <summary> /// Creates a new <seealso cref="SliceReader"/> on the given pool /// </summary> - public SliceReader(IntBlockPool pool) + public SliceReader(Int32BlockPool pool) { this.pool = pool; } @@ -396,7 +398,7 @@ namespace Lucene.Net.Util buffer = pool.buffers[bufferUpto]; upto = startOffset & INT_BLOCK_MASK; - int firstSize = IntBlockPool.LEVEL_SIZE_ARRAY[0]; + int firstSize = Int32BlockPool.LEVEL_SIZE_ARRAY[0]; if (startOffset + firstSize >= endOffset) { // There is only this one slice to read http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/IntsRef.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/IntsRef.cs b/src/Lucene.Net.Core/Util/IntsRef.cs index 26dd154..c39aceb 100644 --- a/src/Lucene.Net.Core/Util/IntsRef.cs +++ b/src/Lucene.Net.Core/Util/IntsRef.cs @@ -25,12 +25,14 @@ namespace Lucene.Net.Util /// <summary> /// Represents int[], as a slice (offset + length) into an - /// existing int[]. The <seealso cref="#ints"/> member should never be null; use - /// <seealso cref="#EMPTY_INTS"/> if necessary. - /// + /// existing int[]. The <seealso cref="#ints"/> member should never be null; use + /// <seealso cref="#EMPTY_INTS"/> if necessary. + /// <para/> + /// NOTE: This was IntsRef in Lucene + /// /// @lucene.internal /// </summary> - public sealed class IntsRef : IComparable<IntsRef> // LUCENENET TODO: Rename Int32sRef ? + public sealed class Int32sRef : IComparable<Int32sRef> { /// <summary> /// An empty integer array for convenience </summary> @@ -67,7 +69,7 @@ namespace Lucene.Net.Util /// <summary> /// Create a IntsRef with <seealso cref="#EMPTY_INTS"/> </summary> - public IntsRef() + public Int32sRef() { ints = EMPTY_INTS; } @@ -76,7 +78,7 @@ namespace Lucene.Net.Util /// Create a IntsRef pointing to a new array of size <code>capacity</code>. /// Offset and length will both be zero. /// </summary> - public IntsRef(int capacity) + public Int32sRef(int capacity) { ints = new int[capacity]; } @@ -85,7 +87,7 @@ namespace Lucene.Net.Util /// this instance will directly reference ints w/o making a copy. /// ints should not be null. /// </summary> - public IntsRef(int[] ints, int offset, int length) + public Int32sRef(int[] ints, int offset, int length) { this.ints = ints; this.Offset = offset; @@ -101,7 +103,7 @@ namespace Lucene.Net.Util /// <seealso cref= #deepCopyOf </seealso> public object Clone() { - return new IntsRef(ints, Offset, Length); + return new Int32sRef(ints, Offset, Length); } public override int GetHashCode() @@ -122,9 +124,9 @@ namespace Lucene.Net.Util { return false; } - if (other is IntsRef) + if (other is Int32sRef) { - return this.Int32sEquals((IntsRef)other); + return this.Int32sEquals((Int32sRef)other); } return false; } @@ -132,7 +134,7 @@ namespace Lucene.Net.Util /// <summary> /// NOTE: This was intsEquals() in Lucene /// </summary> - public bool Int32sEquals(IntsRef other) + public bool Int32sEquals(Int32sRef other) { if (Length == other.Length) { @@ -156,7 +158,7 @@ namespace Lucene.Net.Util /// <summary> /// Signed int order comparison </summary> - public int CompareTo(IntsRef other) + public int CompareTo(Int32sRef other) { if (this == other) { @@ -191,7 +193,7 @@ namespace Lucene.Net.Util /// <summary> /// NOTE: This was copyInts() in Lucene /// </summary> - public void CopyInt32s(IntsRef other) + public void CopyInt32s(Int32sRef other) { if (ints.Length - Offset < other.Length) { @@ -241,9 +243,9 @@ namespace Lucene.Net.Util /// The returned IntsRef will have a length of other.length /// and an offset of zero. /// </summary> - public static IntsRef DeepCopyOf(IntsRef other) + public static Int32sRef DeepCopyOf(Int32sRef other) { - IntsRef clone = new IntsRef(); + Int32sRef clone = new Int32sRef(); clone.CopyInt32s(other); return clone; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/LongBitSet.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/LongBitSet.cs b/src/Lucene.Net.Core/Util/LongBitSet.cs index 02a73b8..fe46132 100644 --- a/src/Lucene.Net.Core/Util/LongBitSet.cs +++ b/src/Lucene.Net.Core/Util/LongBitSet.cs @@ -25,26 +25,28 @@ namespace Lucene.Net.Util /// BitSet of fixed length (numBits), backed by accessible (<seealso cref="#getBits"/>) /// long[], accessed with a long index. Use it only if you intend to store more /// than 2.1B bits, otherwise you should use <seealso cref="FixedBitSet"/>. + /// <para/> + /// NOTE: This was LongBitSet in Lucene /// /// @lucene.internal /// </summary> - public sealed class LongBitSet // LUCENENET TODO: Rename Int64BitSet ? + public sealed class Int64BitSet { private readonly long[] bits; private readonly long numBits; private readonly int numWords; /// <summary> - /// If the given <seealso cref="LongBitSet"/> is large enough to hold + /// If the given <seealso cref="Int64BitSet"/> is large enough to hold /// {@code numBits}, returns the given bits, otherwise returns a new - /// <seealso cref="LongBitSet"/> which can hold the requested number of bits. + /// <seealso cref="Int64BitSet"/> which can hold the requested number of bits. /// /// <p> /// <b>NOTE:</b> the returned bitset reuses the underlying {@code long[]} of /// the given {@code bits} if possible. Also, calling <seealso cref="#length()"/> on the /// returned bits may return a value greater than {@code numBits}. /// </summary> - public static LongBitSet EnsureCapacity(LongBitSet bits, long numBits) + public static Int64BitSet EnsureCapacity(Int64BitSet bits, long numBits) { if (numBits < bits.Length) { @@ -58,7 +60,7 @@ namespace Lucene.Net.Util { arr = ArrayUtil.Grow(arr, numWords + 1); } - return new LongBitSet(arr, arr.Length << 6); + return new Int64BitSet(arr, arr.Length << 6); } } @@ -74,14 +76,14 @@ namespace Lucene.Net.Util return numLong; } - public LongBitSet(long numBits) + public Int64BitSet(long numBits) { this.numBits = numBits; bits = new long[Bits2words(numBits)]; numWords = bits.Length; } - public LongBitSet(long[] storedBits, long numBits) + public Int64BitSet(long[] storedBits, long numBits) { this.numWords = Bits2words(numBits); if (numWords > storedBits.Length) @@ -226,7 +228,7 @@ namespace Lucene.Net.Util /// <summary> /// this = this OR other </summary> - public void Or(LongBitSet other) + public void Or(Int64BitSet other) { Debug.Assert(other.numWords <= numWords, "numWords=" + numWords + ", other.numWords=" + other.numWords); int pos = Math.Min(numWords, other.numWords); @@ -238,7 +240,7 @@ namespace Lucene.Net.Util /// <summary> /// this = this XOR other </summary> - public void Xor(LongBitSet other) + public void Xor(Int64BitSet other) { Debug.Assert(other.numWords <= numWords, "numWords=" + numWords + ", other.numWords=" + other.numWords); int pos = Math.Min(numWords, other.numWords); @@ -250,7 +252,7 @@ namespace Lucene.Net.Util /// <summary> /// returns true if the sets have any elements in common </summary> - public bool Intersects(LongBitSet other) + public bool Intersects(Int64BitSet other) { int pos = Math.Min(numWords, other.numWords); while (--pos >= 0) @@ -265,7 +267,7 @@ namespace Lucene.Net.Util /// <summary> /// this = this AND other </summary> - public void And(LongBitSet other) + public void And(Int64BitSet other) { int pos = Math.Min(numWords, other.numWords); while (--pos >= 0) @@ -280,7 +282,7 @@ namespace Lucene.Net.Util /// <summary> /// this = this AND NOT other </summary> - public void AndNot(LongBitSet other) + public void AndNot(Int64BitSet other) { int pos = Math.Min(numWords, other.bits.Length); while (--pos >= 0) @@ -409,11 +411,11 @@ namespace Lucene.Net.Util bits[endWord] &= endmask; } - public LongBitSet Clone() + public Int64BitSet Clone() { long[] bits = new long[this.bits.Length]; Array.Copy(this.bits, 0, bits, 0, bits.Length); - return new LongBitSet(bits, numBits); + return new Int64BitSet(bits, numBits); } /// <summary> @@ -424,11 +426,11 @@ namespace Lucene.Net.Util { return true; } - if (!(o is LongBitSet)) + if (!(o is Int64BitSet)) { return false; } - LongBitSet other = (LongBitSet)o; + Int64BitSet other = (Int64BitSet)o; if (numBits != other.Length) { return false; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/LongValues.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/LongValues.cs b/src/Lucene.Net.Core/Util/LongValues.cs index 625a842..ce1335f 100644 --- a/src/Lucene.Net.Core/Util/LongValues.cs +++ b/src/Lucene.Net.Core/Util/LongValues.cs @@ -18,16 +18,19 @@ namespace Lucene.Net.Util */ using NumericDocValues = Lucene.Net.Index.NumericDocValues; - using PackedInts = Lucene.Net.Util.Packed.PackedInts; + using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s; /// <summary> /// Abstraction over an array of longs. /// this class extends NumericDocValues so that we don't need to add another - /// level of abstraction every time we want eg. to use the <seealso cref="PackedInts"/> + /// level of abstraction every time we want eg. to use the <seealso cref="PackedInt32s"/> /// utility classes to represent a <seealso cref="NumericDocValues"/> instance. + /// <para/> + /// NOTE: This was LongValues in Lucene + /// /// @lucene.internal /// </summary> - public abstract class LongValues : NumericDocValues + public abstract class Int64Values : NumericDocValues { /// <summary> /// Get value at <code>index</code>. </summary> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/LongsRef.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/LongsRef.cs b/src/Lucene.Net.Core/Util/LongsRef.cs index 6bfd5f1..4274922 100644 --- a/src/Lucene.Net.Core/Util/LongsRef.cs +++ b/src/Lucene.Net.Core/Util/LongsRef.cs @@ -27,10 +27,12 @@ namespace Lucene.Net.Util /// Represents long[], as a slice (offset + length) into an /// existing long[]. The <seealso cref="#longs"/> member should never be null; use /// <seealso cref="#EMPTY_LONGS"/> if necessary. + /// <para/> + /// NOTE: This was LongsRef in Lucene /// /// @lucene.internal /// </summary> - public sealed class LongsRef : IComparable<LongsRef> // LUCENENET TODO: Rename Int64sRef ? + public sealed class Int64sRef : IComparable<Int64sRef> { /// <summary> /// An empty long array for convenience </summary> @@ -67,7 +69,7 @@ namespace Lucene.Net.Util /// <summary> /// Create a LongsRef with <seealso cref="#EMPTY_LONGS"/> </summary> - public LongsRef() + public Int64sRef() { longs = EMPTY_LONGS; } @@ -76,7 +78,7 @@ namespace Lucene.Net.Util /// Create a LongsRef pointing to a new array of size <code>capacity</code>. /// Offset and length will both be zero. /// </summary> - public LongsRef(int capacity) + public Int64sRef(int capacity) { longs = new long[capacity]; } @@ -85,7 +87,7 @@ namespace Lucene.Net.Util /// this instance will directly reference longs w/o making a copy. /// longs should not be null /// </summary> - public LongsRef(long[] longs, int offset, int length) + public Int64sRef(long[] longs, int offset, int length) { this.longs = longs; this.Offset = offset; @@ -101,7 +103,7 @@ namespace Lucene.Net.Util /// <seealso cref= #deepCopyOf </seealso> public object Clone() { - return new LongsRef(longs, Offset, Length); + return new Int64sRef(longs, Offset, Length); } public override int GetHashCode() @@ -122,9 +124,9 @@ namespace Lucene.Net.Util { return false; } - if (other is LongsRef) + if (other is Int64sRef) { - return this.Int64sEquals((LongsRef)other); + return this.Int64sEquals((Int64sRef)other); } return false; } @@ -132,7 +134,7 @@ namespace Lucene.Net.Util /// <summary> /// NOTE: This was longsEquals() in Lucene /// </summary> - public bool Int64sEquals(LongsRef other) + public bool Int64sEquals(Int64sRef other) { if (Length == other.Length) { @@ -156,7 +158,7 @@ namespace Lucene.Net.Util /// <summary> /// Signed int order comparison </summary> - public int CompareTo(LongsRef other) + public int CompareTo(Int64sRef other) { if (this == other) { @@ -191,7 +193,7 @@ namespace Lucene.Net.Util /// <summary> /// NOTE: This was copyLongs() in Lucene /// </summary> - public void CopyInt64s(LongsRef other) + public void CopyInt64s(Int64sRef other) { if (longs.Length - Offset < other.Length) { @@ -241,9 +243,9 @@ namespace Lucene.Net.Util /// The returned IntsRef will have a length of other.length /// and an offset of zero. /// </summary> - public static LongsRef DeepCopyOf(LongsRef other) + public static Int64sRef DeepCopyOf(Int64sRef other) { - LongsRef clone = new LongsRef(); + Int64sRef clone = new Int64sRef(); clone.CopyInt64s(other); return clone; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/Mutable/MutableValueDate.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Mutable/MutableValueDate.cs b/src/Lucene.Net.Core/Util/Mutable/MutableValueDate.cs index f4fc8e1..bddab21 100644 --- a/src/Lucene.Net.Core/Util/Mutable/MutableValueDate.cs +++ b/src/Lucene.Net.Core/Util/Mutable/MutableValueDate.cs @@ -23,7 +23,7 @@ namespace Lucene.Net.Util.Mutable /// <seealso cref="MutableValue"/> implementation of type /// <seealso cref="Date"/>. /// </summary> - public class MutableValueDate : MutableValueLong + public class MutableValueDate : MutableValueInt64 { public override object ToObject() { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/Mutable/MutableValueFloat.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Mutable/MutableValueFloat.cs b/src/Lucene.Net.Core/Util/Mutable/MutableValueFloat.cs index a71386b..6cd335a 100644 --- a/src/Lucene.Net.Core/Util/Mutable/MutableValueFloat.cs +++ b/src/Lucene.Net.Core/Util/Mutable/MutableValueFloat.cs @@ -20,10 +20,11 @@ namespace Lucene.Net.Util.Mutable */ /// <summary> - /// <seealso cref="MutableValue"/> implementation of type - /// <code>float</code>. + /// <see cref="MutableValue"/> implementation of type <see cref="float"/>. + /// <para/> + /// NOTE: This was MutableValueFloat in Lucene /// </summary> - public class MutableValueFloat : MutableValue + public class MutableValueSingle : MutableValue { public float Value { get; set; } @@ -34,14 +35,14 @@ namespace Lucene.Net.Util.Mutable public override void Copy(MutableValue source) { - MutableValueFloat s = (MutableValueFloat)source; + MutableValueSingle s = (MutableValueSingle)source; Value = s.Value; Exists = s.Exists; } public override MutableValue Duplicate() { - MutableValueFloat v = new MutableValueFloat(); + MutableValueSingle v = new MutableValueSingle(); v.Value = this.Value; v.Exists = this.Exists; return v; @@ -49,13 +50,13 @@ namespace Lucene.Net.Util.Mutable public override bool EqualsSameType(object other) { - MutableValueFloat b = (MutableValueFloat)other; + MutableValueSingle b = (MutableValueSingle)other; return Value == b.Value && Exists == b.Exists; } public override int CompareSameType(object other) { - MutableValueFloat b = (MutableValueFloat)other; + MutableValueSingle b = (MutableValueSingle)other; int c = Value.CompareTo(b.Value); if (c != 0) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/Mutable/MutableValueInt.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Mutable/MutableValueInt.cs b/src/Lucene.Net.Core/Util/Mutable/MutableValueInt.cs index fe70f58..91eb769 100644 --- a/src/Lucene.Net.Core/Util/Mutable/MutableValueInt.cs +++ b/src/Lucene.Net.Core/Util/Mutable/MutableValueInt.cs @@ -18,10 +18,11 @@ namespace Lucene.Net.Util.Mutable */ /// <summary> - /// <seealso cref="MutableValue"/> implementation of type - /// <code>int</code>. + /// <see cref="MutableValue"/> implementation of type <see cref="int"/>. + /// <para/> + /// NOTE: This was MutableValueInt in Lucene /// </summary> - public class MutableValueInt : MutableValue + public class MutableValueInt32 : MutableValue { public int Value { get; set; } @@ -32,14 +33,14 @@ namespace Lucene.Net.Util.Mutable public override void Copy(MutableValue source) { - MutableValueInt s = (MutableValueInt)source; + MutableValueInt32 s = (MutableValueInt32)source; Value = s.Value; Exists = s.Exists; } public override MutableValue Duplicate() { - MutableValueInt v = new MutableValueInt(); + MutableValueInt32 v = new MutableValueInt32(); v.Value = this.Value; v.Exists = this.Exists; return v; @@ -47,13 +48,13 @@ namespace Lucene.Net.Util.Mutable public override bool EqualsSameType(object other) { - MutableValueInt b = (MutableValueInt)other; + MutableValueInt32 b = (MutableValueInt32)other; return Value == b.Value && Exists == b.Exists; } public override int CompareSameType(object other) { - MutableValueInt b = (MutableValueInt)other; + MutableValueInt32 b = (MutableValueInt32)other; int ai = Value; int bi = b.Value; if (ai < bi) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/Mutable/MutableValueLong.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Mutable/MutableValueLong.cs b/src/Lucene.Net.Core/Util/Mutable/MutableValueLong.cs index f6162ad..77fba90 100644 --- a/src/Lucene.Net.Core/Util/Mutable/MutableValueLong.cs +++ b/src/Lucene.Net.Core/Util/Mutable/MutableValueLong.cs @@ -18,10 +18,11 @@ namespace Lucene.Net.Util.Mutable */ /// <summary> - /// <seealso cref="MutableValue"/> implementation of type - /// <code>long</code>. + /// <see cref="MutableValue"/> implementation of type <see cref="long"/>. + /// <para/> + /// NOTE: This was MutableValueLong in Lucene /// </summary> - public class MutableValueLong : MutableValue + public class MutableValueInt64 : MutableValue { public long Value { get; set; } @@ -32,14 +33,14 @@ namespace Lucene.Net.Util.Mutable public override void Copy(MutableValue source) { - MutableValueLong s = (MutableValueLong)source; + MutableValueInt64 s = (MutableValueInt64)source; Exists = s.Exists; Value = s.Value; } public override MutableValue Duplicate() { - MutableValueLong v = new MutableValueLong(); + MutableValueInt64 v = new MutableValueInt64(); v.Value = this.Value; v.Exists = this.Exists; return v; @@ -47,13 +48,13 @@ namespace Lucene.Net.Util.Mutable public override bool EqualsSameType(object other) { - MutableValueLong b = (MutableValueLong)other; + MutableValueInt64 b = (MutableValueInt64)other; return Value == b.Value && Exists == b.Exists; } public override int CompareSameType(object other) { - MutableValueLong b = (MutableValueLong)other; + MutableValueInt64 b = (MutableValueInt64)other; long bv = b.Value; if (Value < bv) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/NumericUtils.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/NumericUtils.cs b/src/Lucene.Net.Core/Util/NumericUtils.cs index b66a134..4478e44 100644 --- a/src/Lucene.Net.Core/Util/NumericUtils.cs +++ b/src/Lucene.Net.Core/Util/NumericUtils.cs @@ -359,14 +359,14 @@ namespace Lucene.Net.Util /// Splits a long range recursively. /// You may implement a builder that adds clauses to a /// <seealso cref="Lucene.Net.Search.BooleanQuery"/> for each call to its - /// <seealso cref="LongRangeBuilder#addRange(BytesRef,BytesRef)"/> + /// <seealso cref="Int64RangeBuilder#addRange(BytesRef,BytesRef)"/> /// method. /// <para/> /// this method is used by <seealso cref="NumericRangeQuery"/>. /// <para/> /// NOTE: This was splitLongRange() in Lucene /// </summary> - public static void SplitInt64Range(LongRangeBuilder builder, int precisionStep, long minBound, long maxBound) + public static void SplitInt64Range(Int64RangeBuilder builder, int precisionStep, long minBound, long maxBound) { SplitRange(builder, 64, precisionStep, minBound, maxBound); } @@ -375,14 +375,14 @@ namespace Lucene.Net.Util /// Splits an int range recursively. /// You may implement a builder that adds clauses to a /// <seealso cref="Lucene.Net.Search.BooleanQuery"/> for each call to its - /// <seealso cref="IntRangeBuilder#addRange(BytesRef,BytesRef)"/> + /// <seealso cref="Int32RangeBuilder#addRange(BytesRef,BytesRef)"/> /// method. /// <para/> /// this method is used by <seealso cref="NumericRangeQuery"/>. /// <para/> /// NOTE: This was splitIntRange() in Lucene /// </summary> - public static void SplitInt32Range(IntRangeBuilder builder, int precisionStep, int minBound, int maxBound) + public static void SplitInt32Range(Int32RangeBuilder builder, int precisionStep, int minBound, int maxBound) { SplitRange(builder, 32, precisionStep, minBound, maxBound); } @@ -443,11 +443,11 @@ namespace Lucene.Net.Util switch (valSize) { case 64: - ((LongRangeBuilder)builder).AddRange(minBound, maxBound, shift); + ((Int64RangeBuilder)builder).AddRange(minBound, maxBound, shift); break; case 32: - ((IntRangeBuilder)builder).AddRange((int)minBound, (int)maxBound, shift); + ((Int32RangeBuilder)builder).AddRange((int)minBound, (int)maxBound, shift); break; default: @@ -459,10 +459,13 @@ namespace Lucene.Net.Util /// <summary> /// Callback for <seealso cref="#splitLongRange"/>. /// You need to overwrite only one of the methods. + /// <para/> + /// NOTE: This was LongRangeBuilder in Lucene + /// /// @lucene.internal /// @since 2.9, API changed non backwards-compliant in 4.0 /// </summary> - public abstract class LongRangeBuilder // LUCENENET TODO: Rename Int64RangeBuilder ? + public abstract class Int64RangeBuilder { /// <summary> /// Overwrite this method, if you like to receive the already prefix encoded range bounds. @@ -489,10 +492,13 @@ namespace Lucene.Net.Util /// <summary> /// Callback for <seealso cref="#splitIntRange"/>. /// You need to overwrite only one of the methods. + /// <para/> + /// NOTE: This was IntRangeBuilder in Lucene + /// /// @lucene.internal /// @since 2.9, API changed non backwards-compliant in 4.0 /// </summary> - public abstract class IntRangeBuilder // LUCENENET TODO: Rename Int32RangeBuilder ? + public abstract class Int32RangeBuilder { /// <summary> /// Overwrite this method, if you like to receive the already prefix encoded range bounds. http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/PForDeltaDocIdSet.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/PForDeltaDocIdSet.cs b/src/Lucene.Net.Core/Util/PForDeltaDocIdSet.cs index 331e020..d0d08a9 100644 --- a/src/Lucene.Net.Core/Util/PForDeltaDocIdSet.cs +++ b/src/Lucene.Net.Core/Util/PForDeltaDocIdSet.cs @@ -23,8 +23,8 @@ namespace Lucene.Net.Util using DocIdSet = Lucene.Net.Search.DocIdSet; using DocIdSetIterator = Lucene.Net.Search.DocIdSetIterator; - using MonotonicAppendingLongBuffer = Lucene.Net.Util.Packed.MonotonicAppendingLongBuffer; - using PackedInts = Lucene.Net.Util.Packed.PackedInts; + using MonotonicAppendingInt64Buffer = Lucene.Net.Util.Packed.MonotonicAppendingInt64Buffer; + using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s; /// <summary> /// <seealso cref="DocIdSet"/> implementation based on pfor-delta encoding. @@ -38,11 +38,11 @@ namespace Lucene.Net.Util { internal const int BLOCK_SIZE = 128; internal const int MAX_EXCEPTIONS = 24; // no more than 24 exceptions per block - internal static readonly PackedInts.IDecoder[] DECODERS = new PackedInts.IDecoder[32]; + internal static readonly PackedInt32s.IDecoder[] DECODERS = new PackedInt32s.IDecoder[32]; internal static readonly int[] ITERATIONS = new int[32]; internal static readonly int[] BYTE_BLOCK_COUNTS = new int[32]; internal static readonly int MAX_BYTE_BLOCK_COUNT; - internal static readonly MonotonicAppendingLongBuffer SINGLE_ZERO_BUFFER = new MonotonicAppendingLongBuffer(0, 64, PackedInts.COMPACT); + internal static readonly MonotonicAppendingInt64Buffer SINGLE_ZERO_BUFFER = new MonotonicAppendingInt64Buffer(0, 64, PackedInt32s.COMPACT); internal static readonly PForDeltaDocIdSet EMPTY = new PForDeltaDocIdSet(null, 0, int.MaxValue, SINGLE_ZERO_BUFFER, SINGLE_ZERO_BUFFER); internal static readonly int LAST_BLOCK = 1 << 5; // flag to indicate the last block internal static readonly int HAS_EXCEPTIONS = 1 << 6; @@ -55,7 +55,7 @@ namespace Lucene.Net.Util int maxByteBLockCount = 0; for (int i = 1; i < ITERATIONS.Length; ++i) { - DECODERS[i] = PackedInts.GetDecoder(PackedInts.Format.PACKED, PackedInts.VERSION_CURRENT, i); + DECODERS[i] = PackedInt32s.GetDecoder(PackedInt32s.Format.PACKED, PackedInt32s.VERSION_CURRENT, i); Debug.Assert(BLOCK_SIZE % DECODERS[i].ByteValueCount == 0); ITERATIONS[i] = BLOCK_SIZE / DECODERS[i].ByteValueCount; BYTE_BLOCK_COUNTS[i] = ITERATIONS[i] * DECODERS[i].ByteBlockCount; @@ -152,11 +152,11 @@ namespace Lucene.Net.Util internal virtual int PforBlockSize(int bitsPerValue, int numExceptions, int bitsPerException) { - PackedInts.Format format = PackedInts.Format.PACKED; - long blockSize = 1 + format.ByteCount(PackedInts.VERSION_CURRENT, BLOCK_SIZE, bitsPerValue); // header: number of bits per value + PackedInt32s.Format format = PackedInt32s.Format.PACKED; + long blockSize = 1 + format.ByteCount(PackedInt32s.VERSION_CURRENT, BLOCK_SIZE, bitsPerValue); // header: number of bits per value if (numExceptions > 0) { - blockSize += 2 + numExceptions + format.ByteCount(PackedInts.VERSION_CURRENT, numExceptions, bitsPerException); // indices of the exceptions - 2 additional bytes in case of exceptions: numExceptions and bitsPerException + blockSize += 2 + numExceptions + format.ByteCount(PackedInt32s.VERSION_CURRENT, numExceptions, bitsPerException); // indices of the exceptions - 2 additional bytes in case of exceptions: numExceptions and bitsPerException } if (bufferSize < BLOCK_SIZE) { @@ -230,7 +230,7 @@ namespace Lucene.Net.Util if (bitsPerValue > 0) { - PackedInts.IEncoder encoder = PackedInts.GetEncoder(PackedInts.Format.PACKED, PackedInts.VERSION_CURRENT, bitsPerValue); + PackedInt32s.IEncoder encoder = PackedInt32s.GetEncoder(PackedInt32s.Format.PACKED, PackedInt32s.VERSION_CURRENT, bitsPerValue); int numIterations = ITERATIONS[bitsPerValue]; encoder.Encode(buffer, 0, data.Bytes, data.Length, numIterations); data.Length += encoder.ByteBlockCount * numIterations; @@ -241,10 +241,10 @@ namespace Lucene.Net.Util Debug.Assert(bitsPerException > 0); data.WriteByte((byte)(sbyte)numExceptions); data.WriteByte((byte)(sbyte)bitsPerException); - PackedInts.IEncoder encoder = PackedInts.GetEncoder(PackedInts.Format.PACKED, PackedInts.VERSION_CURRENT, bitsPerException); + PackedInt32s.IEncoder encoder = PackedInt32s.GetEncoder(PackedInt32s.Format.PACKED, PackedInt32s.VERSION_CURRENT, bitsPerException); int numIterations = (numExceptions + encoder.ByteValueCount - 1) / encoder.ByteValueCount; encoder.Encode(exceptions, 0, data.Bytes, data.Length, numIterations); - data.Length += (int)PackedInts.Format.PACKED.ByteCount(PackedInts.VERSION_CURRENT, numExceptions, bitsPerException); + data.Length += (int)PackedInt32s.Format.PACKED.ByteCount(PackedInt32s.VERSION_CURRENT, numExceptions, bitsPerException); for (int i = 0; i < numExceptions; ++i) { data.WriteByte((byte)(sbyte)exceptionIndices[i]); @@ -328,7 +328,7 @@ namespace Lucene.Net.Util var dataArr = Arrays.CopyOf(data.Bytes, data.Length + MAX_BYTE_BLOCK_COUNT); int indexSize = (numBlocks - 1) / indexInterval + 1; - MonotonicAppendingLongBuffer docIDs, offsets; + MonotonicAppendingInt64Buffer docIDs, offsets; if (indexSize <= 1) { docIDs = offsets = SINGLE_ZERO_BUFFER; @@ -337,8 +337,8 @@ namespace Lucene.Net.Util { const int pageSize = 128; int initialPageCount = (indexSize + pageSize - 1) / pageSize; - docIDs = new MonotonicAppendingLongBuffer(initialPageCount, pageSize, PackedInts.COMPACT); - offsets = new MonotonicAppendingLongBuffer(initialPageCount, pageSize, PackedInts.COMPACT); + docIDs = new MonotonicAppendingInt64Buffer(initialPageCount, pageSize, PackedInt32s.COMPACT); + offsets = new MonotonicAppendingInt64Buffer(initialPageCount, pageSize, PackedInt32s.COMPACT); // Now build the index Iterator it = new Iterator(dataArr, cardinality, int.MaxValue, SINGLE_ZERO_BUFFER, SINGLE_ZERO_BUFFER); for (int k = 0; k < indexSize; ++k) @@ -365,10 +365,10 @@ namespace Lucene.Net.Util } internal readonly byte[] data; - internal readonly MonotonicAppendingLongBuffer docIDs, offsets; // for the index + internal readonly MonotonicAppendingInt64Buffer docIDs, offsets; // for the index internal readonly int cardinality, indexInterval; - internal PForDeltaDocIdSet(byte[] data, int cardinality, int indexInterval, MonotonicAppendingLongBuffer docIDs, MonotonicAppendingLongBuffer offsets) + internal PForDeltaDocIdSet(byte[] data, int cardinality, int indexInterval, MonotonicAppendingInt64Buffer docIDs, MonotonicAppendingInt64Buffer offsets) { this.data = data; this.cardinality = cardinality; @@ -402,7 +402,7 @@ namespace Lucene.Net.Util // index internal readonly int indexInterval; - internal readonly MonotonicAppendingLongBuffer docIDs, offsets; + internal readonly MonotonicAppendingInt64Buffer docIDs, offsets; internal readonly int cardinality; internal readonly byte[] data; @@ -416,7 +416,7 @@ namespace Lucene.Net.Util internal int blockIdx; internal int docID; - internal Iterator(byte[] data, int cardinality, int indexInterval, MonotonicAppendingLongBuffer docIDs, MonotonicAppendingLongBuffer offsets) + internal Iterator(byte[] data, int cardinality, int indexInterval, MonotonicAppendingInt64Buffer docIDs, MonotonicAppendingInt64Buffer offsets) { this.data = data; this.cardinality = cardinality; @@ -456,7 +456,7 @@ namespace Lucene.Net.Util int bitsPerException = data[offset++]; int numIterations = (numExceptions + DECODERS[bitsPerException].ByteValueCount - 1) / DECODERS[bitsPerException].ByteValueCount; DECODERS[bitsPerException].Decode(data, offset, nextExceptions, 0, numIterations); - offset += (int)PackedInts.Format.PACKED.ByteCount(PackedInts.VERSION_CURRENT, numExceptions, bitsPerException); + offset += (int)PackedInt32s.Format.PACKED.ByteCount(PackedInt32s.VERSION_CURRENT, numExceptions, bitsPerException); for (int i = 0; i < numExceptions; ++i) { nextDocs[data[offset++]] |= nextExceptions[i] << bitsPerValue; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Core/Util/Packed/AbstractAppendingLongBuffer.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Packed/AbstractAppendingLongBuffer.cs b/src/Lucene.Net.Core/Util/Packed/AbstractAppendingLongBuffer.cs index 0ea749c..1916751 100644 --- a/src/Lucene.Net.Core/Util/Packed/AbstractAppendingLongBuffer.cs +++ b/src/Lucene.Net.Core/Util/Packed/AbstractAppendingLongBuffer.cs @@ -21,8 +21,11 @@ namespace Lucene.Net.Util.Packed */ /// <summary> - /// Common functionality shared by <seealso cref="AppendingDeltaPackedLongBuffer"/> and <seealso cref="MonotonicAppendingLongBuffer"/>. </summary> - public abstract class AbstractAppendingLongBuffer : LongValues // LUCENENET NOTE: made public rather than internal because has public subclasses + /// Common functionality shared by <seealso cref="AppendingDeltaPackedInt64Buffer"/> and <seealso cref="MonotonicAppendingInt64Buffer"/>. + /// <para/> + /// NOTE: This was AbstractAppendingLongBuffer in Lucene + /// </summary> + public abstract class AbstractAppendingInt64Buffer : Int64Values // LUCENENET NOTE: made public rather than internal because has public subclasses { internal const int MIN_PAGE_SIZE = 64; @@ -31,18 +34,18 @@ namespace Lucene.Net.Util.Packed internal static readonly int MAX_PAGE_SIZE = 1 << 20; internal readonly int pageShift, pageMask; - internal PackedInts.Reader[] values; + internal PackedInt32s.Reader[] values; private long valuesBytes; internal int valuesOff; internal long[] pending; internal int pendingOff; internal float acceptableOverheadRatio; - internal AbstractAppendingLongBuffer(int initialBlockCount, int pageSize, float acceptableOverheadRatio) + internal AbstractAppendingInt64Buffer(int initialBlockCount, int pageSize, float acceptableOverheadRatio) { - values = new PackedInts.Reader[initialBlockCount]; + values = new PackedInt32s.Reader[initialBlockCount]; pending = new long[pageSize]; - pageShift = PackedInts.CheckBlockSize(pageSize, MIN_PAGE_SIZE, MAX_PAGE_SIZE); + pageShift = PackedInt32s.CheckBlockSize(pageSize, MIN_PAGE_SIZE, MAX_PAGE_SIZE); pageMask = pageSize - 1; valuesOff = 0; pendingOff = 0; @@ -102,7 +105,7 @@ namespace Lucene.Net.Util.Packed internal virtual void Grow(int newBlockCount) { - Array.Resize<PackedInts.Reader>(ref values, newBlockCount); + Array.Resize<PackedInt32s.Reader>(ref values, newBlockCount); } internal abstract void PackPendingValues(); @@ -145,13 +148,13 @@ namespace Lucene.Net.Util.Packed public sealed class Iterator { - private readonly AbstractAppendingLongBuffer outerInstance; + private readonly AbstractAppendingInt64Buffer outerInstance; internal long[] currentValues; internal int vOff, pOff; internal int currentCount; // number of entries of the current page - internal Iterator(AbstractAppendingLongBuffer outerInstance) + internal Iterator(AbstractAppendingInt64Buffer outerInstance) { this.outerInstance = outerInstance; vOff = pOff = 0;
