You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/03/24 02:02:33 UTC

[01/15] lucenenet git commit: Lucene.Net.Tests.Search.TestSearcherManager.TestSearcherManager_Mem(): Added timeout of 1 minute

Repository: lucenenet
Updated Branches:
  refs/heads/api-work d3621f0c3 -> f78116a4f


Lucene.Net.Tests.Search.TestSearcherManager.TestSearcherManager_Mem(): Added timeout of 1 minute


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/6d55c691
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/6d55c691
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/6d55c691

Branch: refs/heads/api-work
Commit: 6d55c691988a3486386a0c62a6c233f852f75fd0
Parents: d3621f0
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 23 22:27:57 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 23 22:27:57 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/Search/TestSearcherManager.cs | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6d55c691/src/Lucene.Net.Tests/Search/TestSearcherManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestSearcherManager.cs b/src/Lucene.Net.Tests/Search/TestSearcherManager.cs
index 8f96f39..2f53d74 100644
--- a/src/Lucene.Net.Tests/Search/TestSearcherManager.cs
+++ b/src/Lucene.Net.Tests/Search/TestSearcherManager.cs
@@ -1,3 +1,8 @@
+using NUnit.Framework;
+using Lucene.Net.Attributes;
+using Lucene.Net.Index;
+using Lucene.Net.Randomized.Generators;
+using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
 using System.Threading;
@@ -5,10 +10,6 @@ using System.Threading.Tasks;
 
 namespace Lucene.Net.Search
 {
-    using Index;
-    using Lucene.Net.Randomized.Generators;
-    using Lucene.Net.Support;
-    using NUnit.Framework;
     using Directory = Lucene.Net.Store.Directory;
     using DirectoryReader = Lucene.Net.Index.DirectoryReader;
     using Document = Documents.Document;
@@ -48,7 +49,11 @@ namespace Lucene.Net.Search
 
         private SearcherLifetimeManager.IPruner pruner;
 
-        [Test]
+#if !NETSTANDARD
+        // LUCENENET: There is no Timeout on NUnit for .NET Core.
+        [Timeout(60000)]
+#endif
+        [Test, HasTimeout]
         public virtual void TestSearcherManager_Mem()
         {
             pruner = new SearcherLifetimeManager.PruneByAge(TEST_NIGHTLY ? TestUtil.NextInt(Random(), 1, 20) : 1);


[14/15] lucenenet git commit: Lucene.Net.Core.Util.Fst: documentation comments

Posted by ni...@apache.org.
Lucene.Net.Core.Util.Fst: documentation comments


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/3724588b
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/3724588b
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/3724588b

Branch: refs/heads/api-work
Commit: 3724588b293b44ba493490233392b00f69820c31
Parents: 93f3f48
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Fri Mar 24 08:48:28 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Fri Mar 24 08:48:28 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/Fst/Builder.cs         |  61 +++++----
 .../Util/Fst/ByteSequenceOutputs.cs             |   4 +-
 src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs |  22 ++--
 src/Lucene.Net.Core/Util/Fst/BytesStore.cs      |  22 ++--
 .../Util/Fst/CharSequenceOutputs.cs             |   4 +-
 src/Lucene.Net.Core/Util/Fst/FST.cs             | 124 +++++++++++--------
 src/Lucene.Net.Core/Util/Fst/FSTEnum.cs         |  26 ++--
 .../Util/Fst/ForwardBytesReader.cs              |   2 +-
 .../Util/Fst/IntSequenceOutputs.cs              |   4 +-
 src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs  |  22 ++--
 src/Lucene.Net.Core/Util/Fst/NoOutputs.cs       |  10 +-
 src/Lucene.Net.Core/Util/Fst/NodeHash.cs        |  18 ++-
 src/Lucene.Net.Core/Util/Fst/Outputs.cs         |  28 ++---
 src/Lucene.Net.Core/Util/Fst/PairOutputs.cs     |   4 +-
 .../Util/Fst/PositiveIntOutputs.cs              |   4 +-
 .../Util/Fst/ReverseBytesReader.cs              |   2 +-
 src/Lucene.Net.Core/Util/Fst/Util.cs            | 118 +++++++++---------
 17 files changed, 253 insertions(+), 222 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/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 7cb2c16..d87b3b3 100644
--- a/src/Lucene.Net.Core/Util/Fst/Builder.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Builder.cs
@@ -29,23 +29,23 @@ namespace Lucene.Net.Util.Fst
     // build it?
 
     /// <summary>
-    /// Builds a minimal FST (maps an IntsRef term to an arbitrary
+    /// Builds a minimal FST (maps an <see cref="Int32sRef"/> term to an arbitrary
     /// output) from pre-sorted terms with outputs.  The FST
     /// becomes an FSA if you use NoOutputs.  The FST is written
     /// on-the-fly into a compact serialized format byte array, which can
     /// be saved to / loaded from a Directory or used directly
     /// for traversal.  The FST is always finite (no cycles).
     ///
-    /// <p>NOTE: The algorithm is described at
-    /// http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.24.3698</p>
+    /// <para/>NOTE: The algorithm is described at
+    /// http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.24.3698
     ///
-    /// <p>The parameterized type T is the output type.  See the
-    /// subclasses of <seealso cref="Outputs"/>.
+    /// <para/>The parameterized type <typeparam name="T"/> is the output type.  See the
+    /// subclasses of <see cref="Outputs{T}"/>.
     ///
-    /// <p>FSTs larger than 2.1GB are now possible (as of Lucene
+    /// <para/>FSTs larger than 2.1GB are now possible (as of Lucene
     /// 4.2).  FSTs containing more than 2.1B nodes are also now
     /// possible, however they cannot be packed.
-    ///
+    /// <para/>
     /// @lucene.experimental
     /// </summary>
     public class Builder<T> : Builder
@@ -99,9 +99,8 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Instantiates an FST/FSA builder without any pruning. A shortcut
-        /// to {@link #Builder(FST.INPUT_TYPE, int, int, boolean,
-        /// boolean, int, Outputs, FreezeTail, boolean, float,
-        /// boolean, int)} with pruning options turned off.
+        /// to <see cref="Builder.Builder(FST.INPUT_TYPE, int, int, bool, bool, int, Outputs{T}, FreezeTail{T}, bool, float, bool, 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, PackedInt32s.COMPACT, true, 15)
@@ -114,9 +113,9 @@ namespace Lucene.Net.Util.Fst
         /// tweaks. Read parameter documentation carefully.
         /// </summary>
         /// <param name="inputType">
-        ///    The input type (transition labels). Can be anything from <seealso cref="INPUT_TYPE"/>
+        ///    The input type (transition labels). Can be anything from <see cref="Lucene.Net.Util.Fst.FST.INPUT_TYPE"/>
         ///    enumeration. Shorter types will consume less memory. Strings (character sequences) are
-        ///    represented as <seealso cref="INPUT_TYPE#BYTE4"/> (full unicode codepoints).
+        ///    represented as <see cref="Lucene.Net.Util.Fst.FST.INPUT_TYPE.BYTE4"/> (full unicode codepoints).
         /// </param>
         /// <param name="minSuffixCount1">
         ///    If pruning the input graph during construction, this threshold is used for telling
@@ -127,36 +126,36 @@ namespace Lucene.Net.Util.Fst
         ///    (Note: only Mike McCandless knows what this one is really doing...)
         /// </param>
         /// <param name="doShareSuffix">
-        ///    If <code>true</code>, the shared suffixes will be compacted into unique paths.
+        ///    If <c>true</c>, the shared suffixes will be compacted into unique paths.
         ///    this requires an additional RAM-intensive hash map for lookups in memory. Setting this parameter to
-        ///    <code>false</code> creates a single suffix path for all input sequences. this will result in a larger
+        ///    <c>false</c> creates a single suffix path for all input sequences. this will result in a larger
         ///    FST, but requires substantially less memory and CPU during building.
         /// </param>
         /// <param name="doShareNonSingletonNodes">
-        ///    Only used if doShareSuffix is true.  Set this to
+        ///    Only used if <paramref name="doShareSuffix"/> is <c>true</c>.  Set this to
         ///    true to ensure FST is fully minimal, at cost of more
         ///    CPU and more RAM during building.
         /// </param>
         /// <param name="shareMaxTailLength">
-        ///    Only used if doShareSuffix is true.  Set this to
-        ///    Integer.MAX_VALUE to ensure FST is fully minimal, at cost of more
+        ///    Only used if <paramref name="doShareSuffix"/> is <c>true</c>.  Set this to
+        ///    <see cref="int.MaxValue"/> to ensure FST is fully minimal, at cost of more
         ///    CPU and more RAM during building.
         /// </param>
         /// <param name="outputs"> The output type for each input sequence. Applies only if building an FST. For
-        ///    FSA, use <seealso cref="NoOutputs.Singleton"/> and <seealso cref="NoOutputs.NoOutput"/> as the
+        ///    FSA, use <see cref="NoOutputs.Singleton"/> and <see cref="NoOutputs.NoOutput"/> as the
         ///    singleton output object.
         /// </param>
-        /// <param name="doPackFST"> Pass true to create a packed FST.
+        /// <param name="doPackFST"> Pass <c>true</c> to create a packed FST.
+        /// </param>
+        /// <param name="acceptableOverheadRatio"> How to trade speed for space when building the FST. this option 
+        ///    is only relevant when doPackFST is true. <see cref="PackedInt32s.GetMutable(int, int, float)"/>
         /// </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= 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
         ///    FST smaller but slower to traverse.
         /// </param>
         /// <param name="bytesPageBits"> How many bits wide to make each
-        ///    byte[] block in the BytesStore; if you know the FST
+        ///    <see cref="T:byte[]"/> block in the <see cref="BytesStore"/>; if you know the FST
         ///    will be large then make this larger.  For example 15
         ///    bits = 32768 byte pages. </param>
         public Builder(FST.INPUT_TYPE inputType, int minSuffixCount1, int minSuffixCount2, bool doShareSuffix, 
@@ -367,13 +366,13 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// It's OK to add the same input twice in a row with
-        ///  different outputs, as long as outputs impls the merge
-        ///  method. Note that input is fully consumed after this
-        ///  method is returned (so caller is free to reuse), but
-        ///  output is not.  So if your outputs are changeable (eg
-        ///  <seealso cref="ByteSequenceOutputs"/> or {@link
-        ///  IntSequenceOutputs}) then you cannot reuse across
-        ///  calls.
+        /// different outputs, as long as outputs impls the merge
+        /// method. Note that input is fully consumed after this
+        /// method is returned (so caller is free to reuse), but
+        /// output is not.  So if your outputs are changeable (eg
+        /// <see cref="ByteSequenceOutputs"/> or 
+        /// <see cref="Int32SequenceOutputs"/>) then you cannot reuse across
+        /// calls.
         /// </summary>
         public virtual void Add(Int32sRef input, T output)
         {
@@ -518,7 +517,7 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Returns final FST.  NOTE: this will return null if
-        ///  nothing is accepted by the FST.
+        /// nothing is accepted by the FST.
         /// </summary>
         public virtual FST<T> Finish()
         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/src/Lucene.Net.Core/Util/Fst/ByteSequenceOutputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/ByteSequenceOutputs.cs b/src/Lucene.Net.Core/Util/Fst/ByteSequenceOutputs.cs
index 7f41142..1c69881 100644
--- a/src/Lucene.Net.Core/Util/Fst/ByteSequenceOutputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/ByteSequenceOutputs.cs
@@ -24,9 +24,9 @@ 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="T:Outputs{BytesRef}"/> implementation where each output
     /// is a sequence of bytes.
-    ///
+    /// <para/>
     /// @lucene.experimental
     /// </summary>
     public sealed class ByteSequenceOutputs : Outputs<BytesRef>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs b/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs
index 9d985a8..7b0c6fe 100644
--- a/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs
+++ b/src/Lucene.Net.Core/Util/Fst/BytesRefFSTEnum.cs
@@ -20,8 +20,8 @@ namespace Lucene.Net.Util.Fst
      */
 
     /// <summary>
-    /// Enumerates all input (BytesRef) + output pairs in an
-    ///  FST.
+    /// Enumerates all input (<see cref="BytesRef"/>) + output pairs in an
+    /// FST.
     ///
     /// @lucene.experimental
     /// </summary>
@@ -35,8 +35,8 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// doFloor controls the behavior of advance: if it's true
-        ///  doFloor is true, advance positions to the biggest
-        ///  term before target.
+        /// doFloor is true, advance positions to the biggest
+        /// term before target.
         /// </summary>
         public BytesRefFSTEnum(FST<T> fst)
             : base(fst)
@@ -58,7 +58,7 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Seeks to smallest term that's >= target. </summary>
+        /// Seeks to smallest term that's &gt;= target. </summary>
         public BytesRefFSTEnum.InputOutput<T> SeekCeil(BytesRef target)
         {
             this.target = target;
@@ -68,7 +68,7 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Seeks to biggest term that's <= target. </summary>
+        /// Seeks to biggest term that's &lt;= target. </summary>
         public BytesRefFSTEnum.InputOutput<T> SeekFloor(BytesRef target)
         {
             this.target = target;
@@ -78,10 +78,10 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Seeks to exactly this term, returning null if the term
-        ///  doesn't exist.  this is faster than using {@link
-        ///  #seekFloor} or <seealso cref="#seekCeil"/> because it
-        ///  short-circuits as soon the match is not found.
+        /// Seeks to exactly this term, returning <c>null</c> if the term
+        /// doesn't exist.  This is faster than using
+        /// <see cref="SeekFloor"/> or <see cref="SeekCeil"/> because it
+        /// short-circuits as soon the match is not found.
         /// </summary>
         public BytesRefFSTEnum.InputOutput<T> SeekExact(BytesRef target)
         {
@@ -157,7 +157,7 @@ namespace Lucene.Net.Util.Fst
         { }
 
         /// <summary>
-        /// Holds a single input (BytesRef) + output pair. </summary>
+        /// Holds a single input (<see cref="BytesRef"/>) + output pair. </summary>
         public class InputOutput<T>
         {
             public BytesRef Input { get; set; }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/BytesStore.cs b/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
index 294165f..0d2e5da 100644
--- a/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
+++ b/src/Lucene.Net.Core/Util/Fst/BytesStore.cs
@@ -46,7 +46,7 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Pulls bytes from the provided IndexInput. </summary>
+        /// Pulls bytes from the provided <see cref="Store.IndexInput"/>. </summary>
         public BytesStore(DataInput @in, long numBytes, int maxBlockSize)
         {
             int blockSize = 2;
@@ -74,8 +74,8 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Absolute write byte; you must ensure dest is < max
-        ///  position written so far.
+        /// Absolute write byte; you must ensure dest is &lt; max
+        /// position written so far.
         /// </summary>
         public virtual void WriteByte(int dest, byte b)
         {
@@ -131,8 +131,8 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Absolute writeBytes without changing the current
-        ///  position.  Note: this cannot "grow" the bytes, so you
-        ///  must only call it on already written parts.
+        /// position.  Note: this cannot "grow" the bytes, so you
+        /// must only call it on already written parts.
         /// </summary>
         internal virtual void WriteBytes(long dest, byte[] b, int offset, int len)
         {
@@ -198,8 +198,8 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Absolute copy bytes self to self, without changing the
-        ///  position. Note: this cannot "grow" the bytes, so must
-        ///  only call it on already written parts.
+        /// position. Note: this cannot "grow" the bytes, so must
+        /// only call it on already written parts.
         /// </summary>
         public virtual void CopyBytes(long src, long dest, int len)
         {
@@ -265,7 +265,7 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Writes an int at the absolute position without
+        /// Writes an <see cref="int"/> at the absolute position without
         /// changing the current pointer.
         /// <para/>
         /// NOTE: This was writeInt() in Lucene
@@ -290,7 +290,7 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Reverse from srcPos, inclusive, to destPos, inclusive. </summary>
+        /// Reverse from <paramref name="srcPos"/>, inclusive, to <paramref name="destPos"/>, inclusive. </summary>
         public virtual void Reverse(long srcPos, long destPos)
         {
             Debug.Assert(srcPos < destPos);
@@ -363,7 +363,7 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Pos must be less than the max position written so far!
-        ///  Ie, you cannot "grow" the file with this!
+        /// i.e., you cannot "grow" the file with this!
         /// </summary>
         public virtual void Truncate(long newLen)
         {
@@ -400,7 +400,7 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Writes all of our bytes to the target <seealso cref="DataOutput"/>. </summary>
+        /// Writes all of our bytes to the target <see cref="DataOutput"/>. </summary>
         public virtual void WriteTo(DataOutput @out)
         {
             foreach (byte[] block in blocks)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/src/Lucene.Net.Core/Util/Fst/CharSequenceOutputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/CharSequenceOutputs.cs b/src/Lucene.Net.Core/Util/Fst/CharSequenceOutputs.cs
index 36e4297..dee3ef2 100644
--- a/src/Lucene.Net.Core/Util/Fst/CharSequenceOutputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/CharSequenceOutputs.cs
@@ -24,9 +24,9 @@ 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 characters.
-    ///
+    /// <para/>
     /// @lucene.experimental
     /// </summary>
     public sealed class CharSequenceOutputs : Outputs<CharsRef>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/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 4f290fe..8049e20 100644
--- a/src/Lucene.Net.Core/Util/Fst/FST.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FST.cs
@@ -50,13 +50,13 @@ namespace Lucene.Net.Util.Fst
 
     /// <summary>
     /// Represents an finite state machine (FST), using a
-    ///  compact byte[] format.
-    ///  <p> The format is similar to what's used by Morfologik
-    ///  (http://sourceforge.net/projects/morfologik).
-    ///
-    ///  <p> See the {@link Lucene.Net.Util.Fst package
-    ///      documentation} for some simple examples.
+    /// compact <see cref="T:byte[]"/> format.
+    /// <para/> The format is similar to what's used by Morfologik
+    /// (http://sourceforge.net/projects/morfologik).
     ///
+    /// <para/> See the <a href="https://lucene.apache.org/core/4_8_0/core/org/apache/lucene/util/fst/package-summary.html">
+    /// FST package documentation</a> for some simple examples.
+    /// <para/>
     /// @lucene.experimental
     /// </summary>
     public sealed class FST<T>
@@ -230,8 +230,8 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Load a previously saved FST; maxBlockBits allows you to
-        ///  control the size of the byte[] pages used to hold the FST bytes.
+        /// Load a previously saved FST; <paramref name="maxBlockBits"/> allows you to
+        /// control the size of the <see cref="T:byte[]"/> pages used to hold the FST bytes.
         /// </summary>
         public FST(DataInput @in, Outputs<T> outputs, int maxBlockBits)
         {
@@ -633,8 +633,8 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// returns true if the node at this address has any
-        ///  outgoing arcs
+        /// returns <c>true</c> if the node at this address has any
+        /// outgoing arcs
         /// </summary>
         public static bool TargetHasArcs(FST.Arc<T> arc)
         {
@@ -865,7 +865,7 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Fills virtual 'start' arc, ie, an empty incoming arc to
-        ///  the FST's start node
+        /// the FST's start node
         /// </summary>
         public FST.Arc<T> GetFirstArc(FST.Arc<T> arc)
         {
@@ -892,12 +892,12 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Follows the <code>follow</code> arc and reads the last
-        ///  arc of its target; this changes the provided
-        ///  <code>arc</code> (2nd arg) in-place and returns it.
+        /// Follows the <paramref name="follow"/> arc and reads the last
+        /// arc of its target; this changes the provided
+        /// <paramref name="arc"/> (2nd arg) in-place and returns it.
         /// </summary>
         /// <returns> Returns the second argument
-        /// (<code>arc</code>).  </returns>
+        /// (<paramref name="arc"/>).  </returns>
         public FST.Arc<T> ReadLastTargetArc(FST.Arc<T> follow, FST.Arc<T> arc, FST.BytesReader @in)
         {
             //System.out.println("readLast");
@@ -991,11 +991,11 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Follow the <code>follow</code> arc and read the first arc of its target;
-        /// this changes the provided <code>arc</code> (2nd arg) in-place and returns
+        /// Follow the <paramref name="follow"/> arc and read the first arc of its target;
+        /// this changes the provided <paramref name="arc"/> (2nd arg) in-place and returns
         /// it.
         /// </summary>
-        /// <returns> Returns the second argument (<code>arc</code>). </returns>
+        /// <returns> Returns the second argument (<paramref name="arc"/>). </returns>
         public FST.Arc<T> ReadFirstTargetArc(FST.Arc<T> follow, FST.Arc<T> arc, FST.BytesReader @in)
         {
             //int pos = address;
@@ -1063,9 +1063,9 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Checks if <code>arc</code>'s target state is in expanded (or vector) format.
+        /// Checks if <paramref name="arc"/>'s target state is in expanded (or vector) format.
         /// </summary>
-        /// <returns> Returns <code>true</code> if <code>arc</code> points to a state in an
+        /// <returns> Returns <c>true</c> if <paramref name="arc"/> points to a state in an
         /// expanded array format. </returns>
         internal bool IsExpandedTarget(FST.Arc<T> follow, FST.BytesReader @in)
         {
@@ -1100,8 +1100,8 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Peeks at next arc's label; does not alter arc.  Do
-        ///  not call this if arc.isLast()!
+        /// Peeks at next arc's label; does not alter <paramref name="arc"/>.  Do
+        /// not call this if arc.IsLast!
         /// </summary>
         public int ReadNextArcLabel(FST.Arc<T> arc, FST.BytesReader @in)
         {
@@ -1157,8 +1157,8 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Never returns null, but you should never call this if
-        ///  arc.isLast() is true.
+        /// Never returns <c>null</c>, but you should never call this if
+        /// arc.IsLast is <c>true</c>.
         /// </summary>
         public FST.Arc<T> ReadNextRealArc(FST.Arc<T> arc, FST.BytesReader @in)
         {
@@ -1278,8 +1278,8 @@ namespace Lucene.Net.Util.Fst
         // look automaton?
 
         /// <summary>
-        /// Finds an arc leaving the incoming arc, replacing the arc in place.
-        ///  this returns null if the arc was not found, else the incoming arc.
+        /// Finds an arc leaving the incoming <paramref name="arc"/>, replacing the arc in place.
+        /// this returns <c>null</c> if the arc was not found, else the incoming <paramref name="arc"/>.
         /// </summary>
         public FST.Arc<T> FindTargetArc(int labelToMatch, FST.Arc<T> follow, FST.Arc<T> arc, FST.BytesReader @in)
         {
@@ -1472,25 +1472,25 @@ namespace Lucene.Net.Util.Fst
         /// <summary>
         /// Nodes will be expanded if their depth (distance from the root node) is
         /// &lt;= this value and their number of arcs is &gt;=
-        /// <seealso cref="#FIXED_ARRAY_NUM_ARCS_SHALLOW"/>.
+        /// <see cref="FST.FIXED_ARRAY_NUM_ARCS_SHALLOW"/>.
         ///
-        /// <p>
+        /// <para/>
         /// Fixed array consumes more RAM but enables binary search on the arcs
         /// (instead of a linear scan) on lookup by arc label.
         /// </summary>
-        /// <returns> <code>true</code> if <code>node</code> should be stored in an
+        /// <returns> <c>true</c> if <paramref name="node"/> should be stored in an
         ///         expanded (array) form.
         /// </returns>
-        /// <seealso cref= #FIXED_ARRAY_NUM_ARCS_DEEP </seealso>
-        /// <seealso cref= Builder.UnCompiledNode#depth </seealso>
+        /// <seealso cref="FST.FIXED_ARRAY_NUM_ARCS_DEEP"/>
+        /// <seealso cref="Builder.UnCompiledNode{S}.Depth"/>
         private bool ShouldExpand(Builder.UnCompiledNode<T> node)
         {
             return allowArrayArcs && ((node.Depth <= FST.FIXED_ARRAY_SHALLOW_DISTANCE && node.NumArcs >= FST.FIXED_ARRAY_NUM_ARCS_SHALLOW) || node.NumArcs >= FST.FIXED_ARRAY_NUM_ARCS_DEEP);
         }
 
         /// <summary>
-        /// Returns a <seealso cref="FST.BytesReader"/> for this FST, positioned at
-        ///  position 0.
+        /// Returns a <see cref="FST.BytesReader"/> for this FST, positioned at
+        /// position 0.
         /// </summary>
         public FST.BytesReader GetBytesReader()
         {
@@ -1635,7 +1635,9 @@ namespace Lucene.Net.Util.Fst
         }
        */
 
-        // Creates a packed FST
+        /// <summary>
+        /// Creates a packed FST
+        /// </summary>
         private FST(FST.INPUT_TYPE inputType, Outputs<T> outputs, int bytesPageBits)
         {
             version = FST.VERSION_CURRENT;
@@ -1652,17 +1654,17 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Expert: creates an FST by packing this one.  this
-        ///  process requires substantial additional RAM (currently
-        ///  up to ~8 bytes per node depending on
-        ///  <code>acceptableOverheadRatio</code>), but then should
-        ///  produce a smaller FST.
+        /// Expert: creates an FST by packing this one.  This
+        /// process requires substantial additional RAM (currently
+        /// up to ~8 bytes per node depending on
+        /// <c>acceptableOverheadRatio</c>), but then should
+        /// produce a smaller FST.
         ///
-        ///  <p>The implementation of this method uses ideas from
-        ///  <a target="_blank" href="http://www.cs.put.poznan.pl/dweiss/site/publications/download/fsacomp.pdf">Smaller Representation of Finite State Automata</a>,
-        ///  which describes techniques to reduce the size of a FST.
-        ///  However, this is not a strict implementation of the
-        ///  algorithms described in this paper.
+        /// <para/>The implementation of this method uses ideas from
+        /// <a target="_blank" href="http://www.cs.put.poznan.pl/dweiss/site/publications/download/fsacomp.pdf">Smaller Representation of Finite State Automata</a>,
+        /// which describes techniques to reduce the size of a FST.
+        /// However, this is not a strict implementation of the
+        /// algorithms described in this paper.
         /// </summary>
         internal FST<T> Pack(int minInCountDeref, int maxDerefNodes, float acceptableOverheadRatio)
         {
@@ -2145,20 +2147,26 @@ namespace Lucene.Net.Util.Fst
 
         internal const int VERSION_CURRENT = VERSION_VINT32_TARGET;
 
-        // Never serialized; just used to represent the virtual
-        // final node w/ no arcs:
+        /// <summary>
+        /// Never serialized; just used to represent the virtual
+        /// final node w/ no arcs:
+        /// </summary>
         internal const long FINAL_END_NODE = -1;
 
-        // Never serialized; just used to represent the virtual
-        // non-final node w/ no arcs:
+        /// <summary>
+        /// Never serialized; just used to represent the virtual
+        /// non-final node w/ no arcs:
+        /// </summary>
         internal const long NON_FINAL_END_NODE = 0;
 
         /// <summary>
         /// If arc has this label then that arc is final/accepted </summary>
         public static readonly int END_LABEL = -1;
 
-        // returns true if the node at this address has any
-        // outgoing arcs
+        /// <summary>
+        /// returns <c>true</c> if the node at this address has any
+        /// outgoing arcs
+        /// </summary>
         public static bool TargetHasArcs<T>(Arc<T> arc)
         {
             return arc.Target > 0;
@@ -2201,7 +2209,7 @@ namespace Lucene.Net.Util.Fst
             public abstract long Position { get; set; }
 
             /// <summary>
-            /// Returns true if this reader uses reversed bytes
+            /// Returns <c>true</c> if this reader uses reversed bytes
             /// under-the-hood.
             /// </summary>
             /// <returns></returns>
@@ -2229,8 +2237,10 @@ namespace Lucene.Net.Util.Fst
 
             public T Output { get; set; }
 
-            // From node (ord or address); currently only used when
-            // building an FST w/ willPackFST=true:
+            /// <summary>
+            /// From node (ord or address); currently only used when
+            /// building an FST w/ willPackFST=true:
+            /// </summary>
             internal long Node { get; set; }
 
             /// <summary>
@@ -2242,10 +2252,14 @@ namespace Lucene.Net.Util.Fst
 
             public T NextFinalOutput { get; set; }
 
-            // address (into the byte[]), or ord/address if label == END_LABEL
+            /// <summary>
+            /// address (into the byte[]), or ord/address if label == END_LABEL
+            /// </summary>
             internal long NextArc { get; set; }
 
-            // This is non-zero if current arcs are fixed array:
+            /// <summary>
+            /// This is non-zero if current arcs are fixed array:
+            /// </summary>
             internal long PosArcsStart { get; set; }
 
             internal int BytesPerArc { get; set; }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs b/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs
index 56ac818..a378b39 100644
--- a/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FSTEnum.cs
@@ -21,8 +21,8 @@ namespace Lucene.Net.Util.Fst
      */
 
     /// <summary>
-    /// Can next() and advance() through the terms in an FST
-    ///
+    /// Can Next() and Advance() through the terms in an FST
+    /// <para/>
     /// @lucene.experimental
     /// </summary>
     public abstract class FSTEnum<T> // LUCENENET NOTE: changed from internal to public because has public subclasses
@@ -43,8 +43,8 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// doFloor controls the behavior of advance: if it's true
-        ///  doFloor is true, advance positions to the biggest
-        ///  term before target.
+        /// doFloor is true, advance positions to the biggest
+        /// term before target.
         /// </summary>
         protected FSTEnum(FST<T> fst)
         {
@@ -63,7 +63,7 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Rewinds enum state to match the shared prefix between
-        ///  current term and target term
+        /// current term and target term
         /// </summary>
         protected void RewindPrefix()
         {
@@ -132,7 +132,7 @@ namespace Lucene.Net.Util.Fst
         // SEEK_END)?  saves the eq check above?
 
         /// <summary>
-        /// Seeks to smallest term that's >= target. </summary>
+        /// Seeks to smallest term that's &gt;= target. </summary>
         protected virtual void DoSeekCeil()
         {
             //System.out.println("    advance len=" + target.length + " curlen=" + current.length);
@@ -303,7 +303,7 @@ namespace Lucene.Net.Util.Fst
         // TODO: should we return a status here (SEEK_FOUND / SEEK_NOT_FOUND /
         // SEEK_END)?  saves the eq check above?
         /// <summary>
-        /// Seeks to largest term that's <= target. </summary>
+        /// Seeks to largest term that's &lt;= target. </summary>
         protected virtual void DoSeekFloor()
         {
             // TODO: possibly caller could/should provide common
@@ -563,8 +563,10 @@ namespace Lucene.Net.Util.Fst
             }
         }
 
-        // Appends current arc, and then recurses from its target,
-        // appending first arc all the way to the final node
+        /// <summary>
+        /// Appends current arc, and then recurses from its target,
+        /// appending first arc all the way to the final node
+        /// </summary>
         private void PushFirst()
         {
             FST.Arc<T> arc = m_arcs[m_upto];
@@ -588,8 +590,10 @@ namespace Lucene.Net.Util.Fst
             }
         }
 
-        // Recurses from current arc, appending last arc all the
-        // way to the first final node
+        /// <summary>
+        /// Recurses from current arc, appending last arc all the
+        /// way to the first final node
+        /// </summary>
         private void PushLast()
         {
             FST.Arc<T> arc = m_arcs[m_upto];

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/src/Lucene.Net.Core/Util/Fst/ForwardBytesReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/ForwardBytesReader.cs b/src/Lucene.Net.Core/Util/Fst/ForwardBytesReader.cs
index 694f438..5d806b2 100644
--- a/src/Lucene.Net.Core/Util/Fst/ForwardBytesReader.cs
+++ b/src/Lucene.Net.Core/Util/Fst/ForwardBytesReader.cs
@@ -23,7 +23,7 @@ namespace Lucene.Net.Util.Fst
     // add a .skipBytes to DataInput.. hmm and .setPosition
 
     /// <summary>
-    /// Reads from a single byte[]. </summary>
+    /// Reads from a single <see cref="T:byte[]"/>. </summary>
     internal sealed class ForwardBytesReader : FST.BytesReader
     {
         private readonly byte[] bytes;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/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 1f586ba..76509b4 100644
--- a/src/Lucene.Net.Core/Util/Fst/IntSequenceOutputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/IntSequenceOutputs.cs
@@ -25,10 +25,10 @@ namespace Lucene.Net.Util.Fst
 
     /// <summary>
     /// An FST <see cref="Outputs{T}"/> implementation where each output
-    /// is a sequence of ints.
+    /// is a sequence of <see cref="int"/>s.
     /// <para/>
     /// NOTE: This was IntSequenceOutputs in Lucene
-    ///
+    /// <para/>
     /// @lucene.experimental
     /// </summary>
     public sealed class Int32SequenceOutputs : Outputs<Int32sRef>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/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 9fea57c..6ede82d 100644
--- a/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs
+++ b/src/Lucene.Net.Core/Util/Fst/IntsRefFSTEnum.cs
@@ -20,11 +20,11 @@ namespace Lucene.Net.Util.Fst
      */
 
     /// <summary>
-    /// Enumerates all input (IntsRef) + output pairs in an
+    /// Enumerates all input (<see cref="Int32sRef"/>) + output pairs in an
     /// FST.
     /// <para/>
     /// NOTE: This was IntsRefFSTEnum{T} in Lucene
-    ///
+    /// <para/>
     /// @lucene.experimental
     /// </summary>
     public sealed class Int32sRefFSTEnum<T> : FSTEnum<T>
@@ -37,8 +37,8 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// doFloor controls the behavior of advance: if it's true
-        ///  doFloor is true, advance positions to the biggest
-        ///  term before target.
+        /// doFloor is true, advance positions to the biggest
+        /// term before target.
         /// </summary>
         public Int32sRefFSTEnum(FST<T> fst)
             : base(fst)
@@ -60,7 +60,7 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Seeks to smallest term that's >= target. </summary>
+        /// Seeks to smallest term that's &gt;= target. </summary>
         public Int32sRefFSTEnum.InputOutput<T> SeekCeil(Int32sRef target)
         {
             this.target = target;
@@ -70,7 +70,7 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Seeks to biggest term that's <= target. </summary>
+        /// Seeks to biggest term that's &lt;= target. </summary>
         public Int32sRefFSTEnum.InputOutput<T> SeekFloor(Int32sRef target)
         {
             this.target = target;
@@ -80,10 +80,10 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Seeks to exactly this term, returning null if the term
-        ///  doesn't exist.  this is faster than using {@link
-        ///  #seekFloor} or <seealso cref="#seekCeil"/> because it
-        ///  short-circuits as soon the match is not found.
+        /// Seeks to exactly this term, returning <c>null</c> if the term
+        /// doesn't exist.  This is faster than using 
+        /// <see cref="SeekFloor"/> or <see cref="SeekCeil"/> because it
+        /// short-circuits as soon the match is not found.
         /// </summary>
         public Int32sRefFSTEnum.InputOutput<T> SeekExact(Int32sRef target)
         {
@@ -161,7 +161,7 @@ namespace Lucene.Net.Util.Fst
         { }
 
         /// <summary>
-        /// Holds a single input (IntsRef) + output pair. </summary>
+        /// Holds a single input (<see cref="Int32sRef"/>) + output pair. </summary>
         public class InputOutput<T>
         {
             public Int32sRef Input { get; set; }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/src/Lucene.Net.Core/Util/Fst/NoOutputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/NoOutputs.cs b/src/Lucene.Net.Core/Util/Fst/NoOutputs.cs
index 81a9946..ec36431 100644
--- a/src/Lucene.Net.Core/Util/Fst/NoOutputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/NoOutputs.cs
@@ -23,9 +23,9 @@ namespace Lucene.Net.Util.Fst
     using DataOutput = Lucene.Net.Store.DataOutput;
 
     /// <summary>
-    /// A null FST <seealso cref="Outputs"/> implementation; use this if
+    /// A null FST <see cref="Outputs{T}"/> implementation; use this if
     /// you just want to build an FSA.
-    ///
+    /// <para/>
     /// @lucene.experimental
     /// </summary>
     public sealed class NoOutputs : Outputs<object>
@@ -38,8 +38,10 @@ namespace Lucene.Net.Util.Fst
             {
             }
 
-            // NodeHash calls hashCode for this output; we fix this
-            // so we get deterministic hashing.
+            /// <summary>
+            /// NodeHash calls hashCode for this output; we fix this
+            /// so we get deterministic hashing.
+            /// </summary>
             public override int GetHashCode()
             {
                 return 42;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/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 67dc54e..ed20ea2 100644
--- a/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
+++ b/src/Lucene.Net.Core/Util/Fst/NodeHash.cs
@@ -23,7 +23,9 @@ namespace Lucene.Net.Util.Fst
     using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s;
     using PagedGrowableWriter = Lucene.Net.Util.Packed.PagedGrowableWriter;
 
-    // Used to dedup states (lookup already-frozen states)
+    /// <summary>
+    /// Used to dedup states (lookup already-frozen states)
+    /// </summary>
     internal sealed class NodeHash<T>
     {
         private PagedGrowableWriter table;
@@ -73,8 +75,10 @@ namespace Lucene.Net.Util.Fst
             return false;
         }
 
-        // hash code for an unfrozen node.  this must be identical
-        // to the frozen case (below)!!
+        /// <summary>
+        /// hash code for an unfrozen node.  this must be identical
+        /// to the frozen case (below)!!
+        /// </summary>
         private long Hash(Builder.UnCompiledNode<T> node)
         {
             const int PRIME = 31;
@@ -98,7 +102,9 @@ namespace Lucene.Net.Util.Fst
             return h & long.MaxValue;
         }
 
-        // hash code for a frozen node
+        /// <summary>
+        /// hash code for a frozen node
+        /// </summary>
         private long Hash(long node)
         {
             const int PRIME = 31;
@@ -162,7 +168,9 @@ namespace Lucene.Net.Util.Fst
             }
         }
 
-        // called only by rehash
+        /// <summary>
+        /// called only by rehash
+        /// </summary>
         private void AddNew(long address)
         {
             long pos = Hash(address) & mask;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/src/Lucene.Net.Core/Util/Fst/Outputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/Outputs.cs b/src/Lucene.Net.Core/Util/Fst/Outputs.cs
index d344b57..4b5677b 100644
--- a/src/Lucene.Net.Core/Util/Fst/Outputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Outputs.cs
@@ -24,9 +24,9 @@ namespace Lucene.Net.Util.Fst
     /// Represents the outputs for an FST, providing the basic
     /// algebra required for building and traversing the FST.
     ///
-    /// <p>Note that any operation that returns NO_OUTPUT must
-    /// return the same singleton object from {@link
-    /// #getNoOutput}.</p>
+    /// <para>Note that any operation that returns NO_OUTPUT must
+    /// return the same singleton object from
+    /// <see cref="NoOutput"/>.</para>
     ///
     /// @lucene.experimental
     /// </summary>
@@ -50,13 +50,13 @@ namespace Lucene.Net.Util.Fst
         public abstract T Add(T prefix, T output);
 
         /// <summary>
-        /// Encode an output value into a <seealso cref="DataOutput"/>. </summary>
+        /// Encode an output value into a <see cref="DataOutput"/>. </summary>
         public abstract void Write(T output, DataOutput @out);
 
         /// <summary>
-        /// Encode an final node output value into a {@link
-        ///  DataOutput}.  By default this just calls {@link #write(Object,
-        ///  DataOutput)}.
+        /// Encode an final node output value into a
+        /// <see cref="DataOutput"/>.  By default this just calls 
+        /// <see cref="Write(T, DataOutput)"/>.
         /// </summary>
         public virtual void WriteFinalOutput(T output, DataOutput @out)
         {
@@ -64,15 +64,15 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Decode an output value previously written with {@link
-        ///  #write(Object, DataOutput)}.
+        /// Decode an output value previously written with
+        /// <see cref="Write(T, DataOutput)"/>.
         /// </summary>
         public abstract T Read(DataInput @in);
 
         /// <summary>
-        /// Decode an output value previously written with {@link
-        ///  #writeFinalOutput(Object, DataOutput)}.  By default this
-        ///  just calls <seealso cref="#read(DataInput)"/>.
+        /// Decode an output value previously written with
+        /// <see cref="WriteFinalOutput(T, DataOutput)"/>.  By default this
+        /// just calls <see cref="Read(DataInput)"/>.
         /// </summary>
         public virtual T ReadFinalOutput(DataInput @in)
         {
@@ -81,8 +81,8 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// NOTE: this output is compared with == so you must
-        ///  ensure that all methods return the single object if
-        ///  it's really no output
+        /// ensure that all methods return the single object if
+        /// it's really no output
         /// </summary>
         public abstract T NoOutput { get; }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs b/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
index 5f52d71..7ba14ac 100644
--- a/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs
@@ -24,7 +24,7 @@ namespace Lucene.Net.Util.Fst
 
     /// <summary>
     /// An FST <see cref="Outputs{T}"/> implementation, holding two other outputs.
-    ///
+    /// <para/>
     /// @lucene.experimental
     /// </summary>
     public class PairOutputs<A, B> : Outputs<PairOutputs<A, B>.Pair>
@@ -78,7 +78,7 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Create a new Pair </summary>
+        /// Create a new <see cref="Pair"/> </summary>
         public virtual Pair NewPair(A a, B b)
         {
             if (a.Equals(outputs1.NoOutput))

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/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 4350dc9..8897054 100644
--- a/src/Lucene.Net.Core/Util/Fst/PositiveIntOutputs.cs
+++ b/src/Lucene.Net.Core/Util/Fst/PositiveIntOutputs.cs
@@ -24,8 +24,8 @@ namespace Lucene.Net.Util.Fst
     using DataOutput = Lucene.Net.Store.DataOutput;
 
     /// <summary>
-    /// An FST <seealso cref="Outputs{T}"/> implementation where each output
-    /// is a non-negative long value.
+    /// An FST <see cref="Outputs{T}"/> implementation where each output
+    /// is a non-negative <see cref="long?"/> value.
     /// <para/>
     /// NOTE: This was PositiveIntOutputs in Lucene
     ///

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/src/Lucene.Net.Core/Util/Fst/ReverseBytesReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/ReverseBytesReader.cs b/src/Lucene.Net.Core/Util/Fst/ReverseBytesReader.cs
index 3266aad..c64387c 100644
--- a/src/Lucene.Net.Core/Util/Fst/ReverseBytesReader.cs
+++ b/src/Lucene.Net.Core/Util/Fst/ReverseBytesReader.cs
@@ -18,7 +18,7 @@ namespace Lucene.Net.Util.Fst
      */
 
     /// <summary>
-    /// Reads in reverse from a single byte[]. </summary>
+    /// Reads in reverse from a single <see cref="T:byte[]"/>. </summary>
     internal sealed class ReverseBytesReader : FST.BytesReader
     {
         private readonly byte[] bytes;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3724588b/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 44bd4bc..b206948 100644
--- a/src/Lucene.Net.Core/Util/Fst/Util.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Util.cs
@@ -26,7 +26,7 @@ namespace Lucene.Net.Util.Fst
 
     /// <summary>
     /// Static helper methods.
-    ///
+    /// <para/>
     /// @lucene.experimental
     /// </summary>
     public sealed class Util // LUCENENET TODO: Fix naming conflict with containing namespace
@@ -36,8 +36,8 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Looks up the output for this input, or null if the
-        ///  input is not accepted.
+        /// Looks up the output for this input, or <c>null</c> if the
+        /// input is not accepted.
         /// </summary>
         public static T Get<T>(FST<T> fst, Int32sRef input)
         {
@@ -70,8 +70,8 @@ namespace Lucene.Net.Util.Fst
         // TODO: maybe a CharsRef version for BYTE2
 
         /// <summary>
-        /// Looks up the output for this input, or null if the
-        ///  input is not accepted
+        /// Looks up the output for this input, or <c>null</c> if the
+        /// input is not accepted
         /// </summary>
         public static T Get<T>(FST<T> fst, BytesRef input)
         {
@@ -105,17 +105,17 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Reverse lookup (lookup by output instead of by input),
-        ///  in the special case when your FSTs outputs are
-        ///  strictly ascending.  this locates the input/output
-        ///  pair where the output is equal to the target, and will
-        ///  return null if that output does not exist.
+        /// in the special case when your FSTs outputs are
+        /// strictly ascending.  This locates the input/output
+        /// pair where the output is equal to the target, and will
+        /// return <c>null</c> if that output does not exist.
         ///
-        ///  <p>NOTE: this only works with {@code FST<Long>}, only
-        ///  works when the outputs are ascending in order with
-        ///  the inputs.
-        ///  For example, simple ordinals (0, 1,
-        ///  2, ...), or file offets (when appending to a file)
-        ///  fit this.
+        /// <para/>NOTE: this only works with <see cref="T:FST{long?}"/>, only
+        /// works when the outputs are ascending in order with
+        /// the inputs.
+        /// For example, simple ordinals (0, 1,
+        /// 2, ...), or file offets (when appending to a file)
+        /// fit this.
         /// </summary>
         public static Int32sRef GetByOutput(FST<long?> fst, long targetOutput)
         {
@@ -132,8 +132,8 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Expert: like <seealso cref="Util#getByOutput(FST, long)"/> except reusing
-        /// BytesReader, initial and scratch Arc, and result.
+        /// Expert: like <see cref="Util.GetByOutput(FST{long?}, long)"/> except reusing
+        /// <see cref="FST.BytesReader"/>, initial and scratch Arc, and result.
         /// </summary>
         public static Int32sRef GetByOutput(FST<long?> fst, long targetOutput, FST.BytesReader @in, FST.Arc<long?> arc, FST.Arc<long?> scratchArc, Int32sRef result)
         {
@@ -294,8 +294,8 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Represents a path in TopNSearcher.
-        ///
-        ///  @lucene.experimental
+        /// <para/>
+        /// @lucene.experimental
         /// </summary>
         public class FSTPath<T>
         {
@@ -320,7 +320,7 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Compares first by the provided comparer, and then
-        ///  tie breaks by path.input.
+        /// tie breaks by <see cref="FSTPath{T}.Input"/>.
         /// </summary>
         private class TieBreakByInputComparer<T> : IComparer<FSTPath<T>>
         {
@@ -347,7 +347,7 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Utility class to find top N shortest paths from start
-        ///  point(s).
+        /// point(s).
         /// </summary>
         public class TopNSearcher<T>
         {
@@ -366,7 +366,7 @@ namespace Lucene.Net.Util.Fst
 
             /// <summary>
             /// Creates an unbounded TopNSearcher </summary>
-            /// <param name="fst"> the <seealso cref="Lucene.Net.Util.Fst.FST"/> to search on </param>
+            /// <param name="fst"> the <see cref="Lucene.Net.Util.Fst.FST{T}"/> to search on </param>
             /// <param name="topN"> the number of top scoring entries to retrieve </param>
             /// <param name="maxQueueDepth"> the maximum size of the queue of possible top entries </param>
             /// <param name="comparer"> the comparer to select the top N </param>
@@ -381,7 +381,9 @@ namespace Lucene.Net.Util.Fst
                 queue = new SortedSet<FSTPath<T>>(new TieBreakByInputComparer<T>(comparer));
             }
 
-            // If back plus this arc is competitive then add to queue:
+            /// <summary>
+            /// If back plus this arc is competitive then add to queue:
+            /// </summary>
             protected virtual void AddIfCompetitive(FSTPath<T> path)
             {
                 Debug.Assert(queue != null);
@@ -447,7 +449,7 @@ namespace Lucene.Net.Util.Fst
 
             /// <summary>
             /// Adds all leaving arcs, including 'finished' arc, if
-            ///  the node is final, from this node into the queue.
+            /// the node is final, from this node into the queue.
             /// </summary>
             public virtual void AddStartPaths(FST.Arc<T> node, T startOutput, bool allowEmptyString, Int32sRef input)
             {
@@ -641,8 +643,8 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Holds a single input (IntsRef) + output, returned by
-        ///  <seealso cref="#shortestPaths shortestPaths()"/>.
+        /// Holds a single input (<see cref="Int32sRef"/>) + output, returned by
+        /// <see cref="ShortestPaths"/>.
         /// </summary>
         public sealed class Result<T>
         {
@@ -657,14 +659,14 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Holds the results for a top N search using <seealso cref="TopNSearcher"/>
+        /// Holds the results for a top N search using <see cref="TopNSearcher{T}"/>
         /// </summary>
         public sealed class TopResults<T> : IEnumerable<Result<T>>
         {
             /// <summary>
-            /// <code>true</code> iff this is a complete result ie. if
+            /// <c>true</c> iff this is a complete result ie. if
             /// the specified queue size was large enough to find the complete list of results. this might
-            /// be <code>false</code> if the <seealso cref="TopNSearcher"/> rejected too many results.
+            /// be <c>false</c> if the <see cref="TopNSearcher{T}"/> rejected too many results.
             /// </summary>
             public bool IsComplete { get; private set; }
 
@@ -692,7 +694,7 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Starting from node, find the top N min cost
-        ///  completions to a final node.
+        /// completions to a final node.
         /// </summary>
         public static TopResults<T> ShortestPaths<T>(FST<T> fst, FST.Arc<T> fromNode, T startOutput, IComparer<T> comparer, int topN, bool allowEmptyString)
         {
@@ -707,36 +709,38 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Dumps an <seealso cref="FST"/> to a GraphViz's <code>dot</code> language description
+        /// Dumps an <see cref="FST{T}"/> to a GraphViz's <c>dot</c> language description
         /// for visualization. Example of use:
         ///
-        /// <pre class="prettyprint">
-        /// PrintWriter pw = new PrintWriter(&quot;out.dot&quot;);
-        /// Util.toDot(fst, pw, true, true);
-        /// pw.Dispose();
-        /// </pre>
+        /// <code>
+        /// using (TextWriter sw = new StreamWriter(&quot;out.dot&quot;))
+        /// {
+        ///     Util.ToDot(fst, sw, true, true);
+        /// }
+        /// </code>
         ///
         /// and then, from command line:
         ///
-        /// <pre>
+        /// <code>
         /// dot -Tpng -o out.png out.dot
-        /// </pre>
+        /// </code>
         ///
-        /// <p>
+        /// <para/>
         /// Note: larger FSTs (a few thousand nodes) won't even
-        /// render, don't bother.  If the FST is > 2.1 GB in size
+        /// render, don't bother.  If the FST is &gt; 2.1 GB in size
         /// then this method will throw strange exceptions.
+        /// <para/>
+        /// See also <a href="http://www.graphviz.org/">http://www.graphviz.org/</a>.
         /// </summary>
         /// <param name="sameRank">
-        ///          If <code>true</code>, the resulting <code>dot</code> file will try
-        ///          to order states in layers of breadth-first traversal. this may
+        ///          If <c>true</c>, the resulting <c>dot</c> file will try
+        ///          to order states in layers of breadth-first traversal. This may
         ///          mess up arcs, but makes the output FST's structure a bit clearer.
         /// </param>
         /// <param name="labelStates">
-        ///          If <code>true</code> states will have labels equal to their offsets in their
+        ///          If <c>true</c> states will have labels equal to their offsets in their
         ///          binary format. Expands the graph considerably.
         /// </param>
-        /// <seealso cref= "http://www.graphviz.org/" </seealso>
         public static void ToDot<T>(FST<T> fst, TextWriter @out, bool sameRank, bool labelStates)
         {
             const string expandedNodeColor = "blue";
@@ -948,7 +952,7 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Emit a single state in the <code>dot</code> language.
+        /// Emit a single state in the <c>dot</c> language.
         /// </summary>
         private static void EmitDotState(TextWriter @out, string name, string shape, string color, string label)
         {
@@ -975,8 +979,8 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Just maps each UTF16 unit (char) to the ints in an
-        ///  IntsRef.
+        /// Just maps each UTF16 unit (char) to the <see cref="int"/>s in an
+        /// <see cref="Int32sRef"/>.
         /// </summary>
         public static Int32sRef ToUTF16(string s, Int32sRef scratch)
         {
@@ -993,8 +997,8 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Decodes the Unicode codepoints from the provided
-        ///  CharSequence and places them in the provided scratch
-        ///  IntsRef, which must not be null, returning it.
+        /// <see cref="ICharSequence"/> and places them in the provided scratch
+        /// <see cref="Int32sRef"/>, which must not be <c>null</c>, returning it.
         /// </summary>
         public static Int32sRef ToUTF32(string s, Int32sRef scratch)
         {
@@ -1015,8 +1019,8 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Decodes the Unicode codepoints from the provided
-        ///  char[] and places them in the provided scratch
-        ///  IntsRef, which must not be null, returning it.
+        /// <see cref="T:char[]"/> and places them in the provided scratch
+        /// <see cref="Int32sRef"/>, which must not be <c>null</c>, returning it.
         /// </summary>
         public static Int32sRef ToUTF32(char[] s, int offset, int length, Int32sRef scratch)
         {
@@ -1036,8 +1040,8 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Just takes unsigned byte values from the BytesRef and
-        /// converts into an IntsRef.
+        /// Just takes unsigned byte values from the <see cref="BytesRef"/> and
+        /// converts into an <see cref="Int32sRef"/>.
         /// <para/>
         /// NOTE: This was toIntsRef() in Lucene
         /// </summary>
@@ -1053,8 +1057,8 @@ namespace Lucene.Net.Util.Fst
         }
 
         /// <summary>
-        /// Just converts IntsRef to BytesRef; you must ensure the
-        ///  int values fit into a byte.
+        /// Just converts <see cref="Int32sRef"/> to <see cref="BytesRef"/>; you must ensure the
+        /// <see cref="int"/> values fit into a <see cref="byte"/>.
         /// </summary>
         public static BytesRef ToBytesRef(Int32sRef input, BytesRef scratch)
         {
@@ -1082,13 +1086,13 @@ namespace Lucene.Net.Util.Fst
 
         /// <summary>
         /// Reads the first arc greater or equal that the given label into the provided
-        /// arc in place and returns it iff found, otherwise return <code>null</code>.
+        /// arc in place and returns it iff found, otherwise return <c>null</c>.
         /// </summary>
         /// <param name="label"> the label to ceil on </param>
         /// <param name="fst"> the fst to operate on </param>
         /// <param name="follow"> the arc to follow reading the label from </param>
         /// <param name="arc"> the arc to read into in place </param>
-        /// <param name="in"> the fst's <seealso cref="BytesReader"/> </param>
+        /// <param name="in"> the fst's <see cref="FST.BytesReader"/> </param>
         public static FST.Arc<T> ReadCeilArc<T>(int label, FST<T> fst, FST.Arc<T> follow, FST.Arc<T> arc, FST.BytesReader @in)
         {
             // TODO maybe this is a useful in the FST class - we could simplify some other code like FSTEnum?


[08/15] lucenenet git commit: BUG: Lucene.Net.Core.Support (ValueHashSet + ValueList): Corrected GetHashSet() so it doesn't depend on the order of the elements

Posted by ni...@apache.org.
BUG: Lucene.Net.Core.Support (ValueHashSet + ValueList): Corrected GetHashSet() so it doesn't depend on the order of the elements


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/4ed5d336
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/4ed5d336
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/4ed5d336

Branch: refs/heads/api-work
Commit: 4ed5d336f92461db989e628ed735d712f983e7b8
Parents: 50bbf51
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 23 23:51:25 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 23 23:51:25 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Support/ValueHashSet.cs | 2 +-
 src/Lucene.Net.Core/Support/ValueList.cs    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4ed5d336/src/Lucene.Net.Core/Support/ValueHashSet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/ValueHashSet.cs b/src/Lucene.Net.Core/Support/ValueHashSet.cs
index 0421fcb..6227ae7 100644
--- a/src/Lucene.Net.Core/Support/ValueHashSet.cs
+++ b/src/Lucene.Net.Core/Support/ValueHashSet.cs
@@ -62,7 +62,7 @@ namespace Lucene.Net.Support
                 T obj = i.Current;
                 if (!EqualityComparer<T>.Default.Equals(obj, default(T)))
                 {
-                    h = HashHelpers.CombineHashCodes(h, obj.GetHashCode());
+                    h += obj.GetHashCode();
                 }
             }
             return h;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4ed5d336/src/Lucene.Net.Core/Support/ValueList.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/ValueList.cs b/src/Lucene.Net.Core/Support/ValueList.cs
index d09874e..d67ce5c 100644
--- a/src/Lucene.Net.Core/Support/ValueList.cs
+++ b/src/Lucene.Net.Core/Support/ValueList.cs
@@ -59,7 +59,7 @@ namespace Lucene.Net.Support
                 T obj = i.Current;
                 if (!EqualityComparer<T>.Default.Equals(obj, default(T)))
                 {
-                    h = HashHelpers.CombineHashCodes(h, obj.GetHashCode());
+                    h += obj.GetHashCode();
                 }
             }
             return h;


[04/15] lucenenet git commit: Lucene.Net.Core.Util.ClosableThreadLocal (DisposableThreadLocal): Changed back to original implementation that uses AtomicInt32 rather than Interlocked (fixed a bug in MaybePurge() in the process)

Posted by ni...@apache.org.
Lucene.Net.Core.Util.ClosableThreadLocal (DisposableThreadLocal): Changed back to original implementation that uses AtomicInt32 rather than Interlocked (fixed a bug in MaybePurge() in the process)


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/d7c5af91
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/d7c5af91
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/d7c5af91

Branch: refs/heads/api-work
Commit: d7c5af91e627447a55cfe1716a2b6691cf9d81df
Parents: 5e4b01a
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 23 22:53:19 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 23 22:53:19 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/CloseableThreadLocal.cs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d7c5af91/src/Lucene.Net.Core/Util/CloseableThreadLocal.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/CloseableThreadLocal.cs b/src/Lucene.Net.Core/Util/CloseableThreadLocal.cs
index 5d21cd3..239316c 100644
--- a/src/Lucene.Net.Core/Util/CloseableThreadLocal.cs
+++ b/src/Lucene.Net.Core/Util/CloseableThreadLocal.cs
@@ -66,8 +66,7 @@ namespace Lucene.Net.Util
         // purge.  After purge, we set this to
         // PURGE_MULTIPLIER * stillAliveCount.  this keeps
         // amortized cost of purging linear.
-        //private readonly AtomicInteger CountUntilPurge = new AtomicInteger(PURGE_MULTIPLIER);
-        private int countUntilPurge = PURGE_MULTIPLIER;
+        private readonly AtomicInt32 countUntilPurge = new AtomicInt32(PURGE_MULTIPLIER);
 
         protected internal virtual T InitialValue() // LUCENENET NOTE: Sometimes returns new instance - not a good candidate for a property
         {
@@ -110,7 +109,7 @@ namespace Lucene.Net.Util
 
         private void MaybePurge()
         {
-            if (Interlocked.Decrement(ref countUntilPurge) == 0)
+            if (countUntilPurge.GetAndDecrement() == 0)
             {
                 Purge();
             }
@@ -154,7 +153,7 @@ namespace Lucene.Net.Util
                     nextCount = 1000000;
                 }
 
-                Interlocked.Exchange(ref countUntilPurge, nextCount);
+                countUntilPurge.Set(nextCount);
             }
         }
 


[15/15] lucenenet git commit: PERFORMANCE: Lucene.Net.Core.Store (FSDirectory + SimpleFSDirectory): Removed chunking from read and write operations, since FileStream already takes care of this (better)

Posted by ni...@apache.org.
PERFORMANCE: Lucene.Net.Core.Store (FSDirectory + SimpleFSDirectory): Removed chunking from read and write operations, since FileStream already takes care of this (better)


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/f78116a4
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/f78116a4
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/f78116a4

Branch: refs/heads/api-work
Commit: f78116a4fae11a9ba130cccff543065aa8254554
Parents: 3724588
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Fri Mar 24 08:59:03 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Fri Mar 24 08:59:03 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Store/FSDirectory.cs       | 36 +++++++++++--------
 src/Lucene.Net.Core/Store/SimpleFSDirectory.cs | 39 ++++++++++++---------
 2 files changed, 45 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f78116a4/src/Lucene.Net.Core/Store/FSDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/FSDirectory.cs b/src/Lucene.Net.Core/Store/FSDirectory.cs
index 7627eb7..3530799 100644
--- a/src/Lucene.Net.Core/Store/FSDirectory.cs
+++ b/src/Lucene.Net.Core/Store/FSDirectory.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.IO;
 using System.Linq;// Used only for WRITE_LOCK_NAME in deprecated create=true case:
 
@@ -463,11 +464,12 @@ namespace Lucene.Net.Store
         /// </summary>
         protected class FSIndexOutput : BufferedIndexOutput
         {
-            /// <summary>
-            /// The maximum chunk size is 8192 bytes, because <seealso cref="RandomAccessFile"/> mallocs
-            /// a native buffer outside of stack if the write buffer size is larger.
-            /// </summary>
-            private const int CHUNK_SIZE = 8192;
+            // LUCENENET specific: chunk size not needed
+            ///// <summary>
+            ///// The maximum chunk size is 8192 bytes, because <seealso cref="RandomAccessFile"/> mallocs
+            ///// a native buffer outside of stack if the write buffer size is larger.
+            ///// </summary>
+            //private const int CHUNK_SIZE = 8192;
 
             private readonly FSDirectory parent;
             internal readonly string name;
@@ -475,7 +477,7 @@ namespace Lucene.Net.Store
             private volatile bool isOpen; // remember if the file is open, so that we don't try to close it more than once
 
             public FSIndexOutput(FSDirectory parent, string name)
-                : base(CHUNK_SIZE)
+                : base(/*CHUNK_SIZE*/)
             {
                 this.parent = parent;
                 this.name = name;
@@ -485,14 +487,20 @@ namespace Lucene.Net.Store
 
             protected internal override void FlushBuffer(byte[] b, int offset, int size)
             {
-                //Debug.Assert(IsOpen);
-                while (size > 0)
-                {
-                    int toWrite = Math.Min(CHUNK_SIZE, size);
-                    file.Write(b, offset, toWrite);
-                    offset += toWrite;
-                    size -= toWrite;
-                }
+                Debug.Assert(isOpen);
+                //while (size > 0)
+                //{
+                //    int toWrite = Math.Min(CHUNK_SIZE, size);
+                //    file.Write(b, offset, toWrite);
+                //    offset += toWrite;
+                //    size -= toWrite;
+                //}
+
+                // LUCENENET specific: FileStream is already optimized to write natively
+                // if over the buffer size that is passed through its constructor. So,
+                // all we need to do is Write().
+                file.Write(b, offset, size);
+
                 //Debug.Assert(size == 0);
             }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f78116a4/src/Lucene.Net.Core/Store/SimpleFSDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/SimpleFSDirectory.cs b/src/Lucene.Net.Core/Store/SimpleFSDirectory.cs
index 2a93d8c..22b778d 100644
--- a/src/Lucene.Net.Core/Store/SimpleFSDirectory.cs
+++ b/src/Lucene.Net.Core/Store/SimpleFSDirectory.cs
@@ -118,11 +118,12 @@ namespace Lucene.Net.Store
         /// </summary>
         protected internal class SimpleFSIndexInput : BufferedIndexInput
         {
-            /// <summary>
-            /// The maximum chunk size is 8192 bytes, because <seealso cref="RandomAccessFile"/> mallocs
-            /// a native buffer outside of stack if the read buffer size is larger.
-            /// </summary>
-            private const int CHUNK_SIZE = 8192;
+            // LUCENENET specific: chunk size not needed
+            ///// <summary>
+            ///// The maximum chunk size is 8192 bytes, because <seealso cref="RandomAccessFile"/> mallocs
+            ///// a native buffer outside of stack if the read buffer size is larger.
+            ///// </summary>
+            //private const int CHUNK_SIZE = 8192;
 
             /// <summary>
             /// the file channel we will read from </summary>
@@ -195,17 +196,23 @@ namespace Lucene.Net.Store
 
                     try
                     {
-                        while (total < len)
-                        {
-                            int toRead = Math.Min(CHUNK_SIZE, len - total);
-                            int i = m_file.Read(b, offset + total, toRead);
-                            if (i < 0) // be defensive here, even though we checked before hand, something could have changed
-                            {
-                                throw new EndOfStreamException("read past EOF: " + this + " off: " + offset + " len: " + len + " total: " + total + " chunkLen: " + toRead + " end: " + m_end);
-                            }
-                            Debug.Assert(i > 0, "RandomAccessFile.read with non zero-length toRead must always read at least one byte");
-                            total += i;
-                        }
+                        //while (total < len)
+                        //{
+                        //    int toRead = Math.Min(CHUNK_SIZE, len - total);
+                        //    int i = m_file.Read(b, offset + total, toRead);
+                        //    if (i < 0) // be defensive here, even though we checked before hand, something could have changed
+                        //    {
+                        //        throw new EndOfStreamException("read past EOF: " + this + " off: " + offset + " len: " + len + " total: " + total + " chunkLen: " + toRead + " end: " + m_end);
+                        //    }
+                        //    Debug.Assert(i > 0, "RandomAccessFile.read with non zero-length toRead must always read at least one byte");
+                        //    total += i;
+                        //}
+
+                        // LUCENENET specific: FileStream is already optimized to read natively
+                        // using the buffer size that is passed through its constructor. So,
+                        // all we need to do is Read().
+                        total = m_file.Read(b, offset, len);
+
                         Debug.Assert(total == len);
                     }
                     catch (System.IO.IOException ioe)


[09/15] lucenenet git commit: PERFORMANCE: Lucene.Net.Core.Util.Unicode.Util.ToCharArray(): Optimized method by removing reliance on exceptions and instead proactively resize the array to accommodate any surrogate pairs. Solution provided by Vincent Van

Posted by ni...@apache.org.
PERFORMANCE: Lucene.Net.Core.Util.Unicode.Util.ToCharArray(): Optimized method by removing reliance on exceptions and instead proactively resize the array to accommodate any surrogate pairs. Solution provided by Vincent Van Den Berghe.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/f5d02d6d
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/f5d02d6d
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/f5d02d6d

Branch: refs/heads/api-work
Commit: f5d02d6df1913835b077336120b9dbd4f0f4fb56
Parents: 4ed5d33
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Fri Mar 24 01:51:37 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Fri Mar 24 01:51:37 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/UnicodeUtil.cs | 46 +++++++++++++---------------
 1 file changed, 22 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f5d02d6d/src/Lucene.Net.Core/Util/UnicodeUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/UnicodeUtil.cs b/src/Lucene.Net.Core/Util/UnicodeUtil.cs
index 2f9833c..c3bb61e 100644
--- a/src/Lucene.Net.Core/Util/UnicodeUtil.cs
+++ b/src/Lucene.Net.Core/Util/UnicodeUtil.cs
@@ -120,7 +120,7 @@ namespace Lucene.Net.Util
         private const long HALF_SHIFT = 10;
         private const long HALF_MASK = 0x3FFL;
 
-        private const int SURROGATE_OFFSET = Character.MIN_SUPPLEMENTARY_CODE_POINT - (UNI_SUR_HIGH_START << (int) HALF_SHIFT) - UNI_SUR_LOW_START;
+        private const int SURROGATE_OFFSET = Character.MIN_SUPPLEMENTARY_CODE_POINT - (UNI_SUR_HIGH_START << (int)HALF_SHIFT) - UNI_SUR_LOW_START;
 
         /// <summary>
         /// Encode characters from a char[] source, starting at
@@ -495,7 +495,7 @@ namespace Lucene.Net.Util
             return true;
         }
 
-        public static bool ValidUTF16String(char[] s, int size) 
+        public static bool ValidUTF16String(char[] s, int size)
         {
             for (int i = 0; i < size; i++)
             {
@@ -700,7 +700,7 @@ namespace Lucene.Net.Util
         /// <exception cref="IndexOutOfBoundsException"> If the offset or count are out of bounds. </exception>
         public static string NewString(int[] codePoints, int offset, int count)
         {
-            var chars = ToCharArray(codePoints, offset, count);
+            char[] chars = ToCharArray(codePoints, offset, count);
             return new string(chars);
         }
 
@@ -713,12 +713,16 @@ namespace Lucene.Net.Util
         /// <param name="offset"> The start of the text in the code point array </param>
         /// <param name="count"> The number of code points </param>
         /// <returns> a char array representing the code points between offset and count </returns>
+        // LUCENENET NOTE: This code was originally in the NewString() method (above).
+        // It has been refactored from the original to remove the exception throw/catch and
+        // instead proactively resizes the array instead of relying on excpetions.
         public static char[] ToCharArray(int[] codePoints, int offset, int count)
         {
             if (count < 0)
             {
                 throw new System.ArgumentException();
             }
+            // LUCENENET: as a first approximation, assume each codepoint is 1 character
             char[] chars = new char[count];
             int w = 0;
             for (int r = offset, e = offset + count; r < e; ++r)
@@ -728,30 +732,24 @@ namespace Lucene.Net.Util
                 {
                     throw new System.ArgumentException();
                 }
-                while (true)
+                if (cp < 0x010000)
                 {
-                    try
-                    {
-                        if (cp < 0x010000)
-                        {
-                            chars[w] = (char)cp;
-                            w++;
-                        }
-                        else
-                        {
-                            chars[w] = (char)(LEAD_SURROGATE_OFFSET_ + (cp >> LEAD_SURROGATE_SHIFT_));
-                            chars[w + 1] = (char)(TRAIL_SURROGATE_MIN_VALUE + (cp & TRAIL_SURROGATE_MASK_));
-                            w += 2;
-                        }
-                        break;
-                    }
-                    catch (System.IndexOutOfRangeException)
+                    chars[w++] = (char)cp;
+                }
+                else
+                {
+                    chars[w++] = (char)(LEAD_SURROGATE_OFFSET_ + (cp >> LEAD_SURROGATE_SHIFT_));
+                    // LUCENENET: resize to the exact length: it's slightly faster to check if the resize is needed
+                    if (w >= chars.Length)
                     {
-                        int newlen = (int)(Math.Ceiling((double)codePoints.Length * (w + 2) / (r - offset + 1)));
-                        char[] temp = new char[newlen];
-                        Array.Copy(chars, 0, temp, 0, w);
-                        chars = temp;
+                        Array.Resize(ref chars, chars.Length + (e - r) * 2 - 1);
                     }
+                    chars[w++] = (char)(TRAIL_SURROGATE_MIN_VALUE + (cp & TRAIL_SURROGATE_MASK_));
+                }
+                // LUCENENET: resize to the exact length: it's slightly faster to check if the resize is needed
+                if (w != chars.Length)
+                {
+                    Array.Resize(ref chars, w);
                 }
             }
 


[03/15] lucenenet git commit: Lucene.Net.Core.Util.DoubleBarrelLRUCache: Changed back to original implementation that uses AtomicInt32 rather than Interlocked.

Posted by ni...@apache.org.
Lucene.Net.Core.Util.DoubleBarrelLRUCache: Changed back to original implementation that uses AtomicInt32 rather than Interlocked.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/5e4b01a2
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/5e4b01a2
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/5e4b01a2

Branch: refs/heads/api-work
Commit: 5e4b01a26f210b7d4265907ff6890347da085761
Parents: dc04c72
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 23 22:45:37 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 23 22:45:37 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/DoubleBarrelLRUCache.cs | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5e4b01a2/src/Lucene.Net.Core/Util/DoubleBarrelLRUCache.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/DoubleBarrelLRUCache.cs b/src/Lucene.Net.Core/Util/DoubleBarrelLRUCache.cs
index 7944090..0bd5d2e 100644
--- a/src/Lucene.Net.Core/Util/DoubleBarrelLRUCache.cs
+++ b/src/Lucene.Net.Core/Util/DoubleBarrelLRUCache.cs
@@ -1,6 +1,6 @@
+using Lucene.Net.Support;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
-using System.Threading;
 
 namespace Lucene.Net.Util
 {
@@ -46,8 +46,7 @@ namespace Lucene.Net.Util
         private readonly IDictionary<TKey, TValue> cache1;
         private readonly IDictionary<TKey, TValue> cache2;
 
-        //private readonly AtomicInteger Countdown;
-        private int countdown;
+        private readonly AtomicInt32 countdown;
 
         private volatile bool swapped;
         private readonly int maxSize;
@@ -55,7 +54,7 @@ namespace Lucene.Net.Util
         public DoubleBarrelLRUCache(int maxCount)
         {
             this.maxSize = maxCount;
-            Interlocked.Exchange(ref countdown, maxCount);
+            countdown = new AtomicInt32(maxCount);
             cache1 = new ConcurrentDictionary<TKey, TValue>();
             cache2 = new ConcurrentDictionary<TKey, TValue>();
         }
@@ -105,7 +104,7 @@ namespace Lucene.Net.Util
             }
             primary[key] = value;
 
-            if (Interlocked.Decrement(ref countdown) == 0)
+            if (countdown.DecrementAndGet() == 0)
             {
                 // Time to swap
 
@@ -122,7 +121,7 @@ namespace Lucene.Net.Util
                 swapped = !swapped;
 
                 // Third, reset countdown
-                Interlocked.Exchange(ref countdown, maxSize);
+                countdown.Set(maxSize);
             }
         }
     }


[05/15] lucenenet git commit: Lucene.Net.Core.Util.Counter: Changed back to original implementation that uses AtomicInt64 rather than Interlocked

Posted by ni...@apache.org.
Lucene.Net.Core.Util.Counter: Changed back to original implementation that uses AtomicInt64 rather than Interlocked


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/cccf0c5a
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/cccf0c5a
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/cccf0c5a

Branch: refs/heads/api-work
Commit: cccf0c5aebfd3c13c03d0aa5e72423f008bff1a7
Parents: d7c5af9
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 23 23:01:02 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 23 23:01:02 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/Counter.cs | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/cccf0c5a/src/Lucene.Net.Core/Util/Counter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Counter.cs b/src/Lucene.Net.Core/Util/Counter.cs
index ef44474..099b8ee 100644
--- a/src/Lucene.Net.Core/Util/Counter.cs
+++ b/src/Lucene.Net.Core/Util/Counter.cs
@@ -1,4 +1,4 @@
-using System.Threading;
+using Lucene.Net.Support;
 
 namespace Lucene.Net.Util
 {
@@ -58,7 +58,7 @@ namespace Lucene.Net.Util
         /// <returns> a new counter. </returns>
         public static Counter NewCounter(bool threadSafe)
         {
-            return threadSafe ? (Counter)new AtomicCounter() : (Counter)new SerialCounter();
+            return threadSafe ? (Counter)new AtomicCounter() : new SerialCounter();
         }
 
         private sealed class SerialCounter : Counter
@@ -78,24 +78,16 @@ namespace Lucene.Net.Util
 
         private sealed class AtomicCounter : Counter
         {
-            //internal readonly AtomicLong Count = new AtomicLong();
-            private long count;
+            private readonly AtomicInt64 count = new AtomicInt64();
 
             public override long AddAndGet(long delta)
             {
-                return Interlocked.Add(ref count, delta);
+                return count.AddAndGet(delta);
             }
 
             public override long Get()
             {
-                //LUCENE TO-DO read operations atomic in 64 bit
-                /*if (IntPtr.Size == 4)
-                {
-                    long Count_ = 0;
-                    Interlocked.Exchange(ref Count_, (long)Count);
-                    return (int)Interlocked.Read(ref Count_);
-                }*/
-                return count;
+                return count.Get();
             }
         }
     }


[10/15] lucenenet git commit: BUG: Lucene.Net.Core.Util.UnicodeUtil: counter for char array size not accurate and causing Lucene.Net.Misc.Util.Fst.TestFSTsMisc.TestRandomWords() to fail. Changed initial array size to count * 2 and removed resize logic, s

Posted by ni...@apache.org.
BUG: Lucene.Net.Core.Util.UnicodeUtil: counter for char array size not accurate and causing Lucene.Net.Misc.Util.Fst.TestFSTsMisc.TestRandomWords() to fail. Changed initial array size to count * 2 and removed resize logic, since we trim off the excess anyway at the end. Also added a threashhold of 1024 - if the count is greater than this we do a pre-loop to determine the exact amount of memory to allocate.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/631cfa7a
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/631cfa7a
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/631cfa7a

Branch: refs/heads/api-work
Commit: 631cfa7ad37187c918b068fef77797fffd0bfff8
Parents: f5d02d6
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Fri Mar 24 06:24:41 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Fri Mar 24 06:28:21 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/UnicodeUtil.cs | 35 +++++++++++++++++-----------
 1 file changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/631cfa7a/src/Lucene.Net.Core/Util/UnicodeUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/UnicodeUtil.cs b/src/Lucene.Net.Core/Util/UnicodeUtil.cs
index c3bb61e..31a998c 100644
--- a/src/Lucene.Net.Core/Util/UnicodeUtil.cs
+++ b/src/Lucene.Net.Core/Util/UnicodeUtil.cs
@@ -715,15 +715,34 @@ namespace Lucene.Net.Util
         /// <returns> a char array representing the code points between offset and count </returns>
         // LUCENENET NOTE: This code was originally in the NewString() method (above).
         // It has been refactored from the original to remove the exception throw/catch and
-        // instead proactively resizes the array instead of relying on excpetions.
+        // instead proactively resizes the array instead of relying on excpetions + copy operations
         public static char[] ToCharArray(int[] codePoints, int offset, int count)
         {
             if (count < 0)
             {
                 throw new System.ArgumentException();
             }
-            // LUCENENET: as a first approximation, assume each codepoint is 1 character
-            char[] chars = new char[count];
+            int countThreashhold = 1024; // If the number of chars exceeds this, we count them instead of allocating count * 2
+            // LUCENENET: as a first approximation, assume each codepoint 
+            // is 2 characters (since it cannot be longer than this)
+            int arrayLength = count * 2;
+            // LUCENENET: if we go over the threashhold, count the number of 
+            // chars we will need so we can allocate the precise amount of memory
+            if (count > countThreashhold)
+            {
+                arrayLength = 0;
+                for (int r = offset, e = offset + count; r < e; ++r)
+                {
+                    arrayLength += codePoints[r] < 0x010000 ? 1 : 2;
+                }
+                if (arrayLength < 1)
+                {
+                    arrayLength = count * 2;
+                }
+            }
+            // Initialize our array to our exact or oversized length.
+            // It is now safe to assume we have enough space for all of the characters.
+            char[] chars = new char[arrayLength];
             int w = 0;
             for (int r = offset, e = offset + count; r < e; ++r)
             {
@@ -739,18 +758,8 @@ namespace Lucene.Net.Util
                 else
                 {
                     chars[w++] = (char)(LEAD_SURROGATE_OFFSET_ + (cp >> LEAD_SURROGATE_SHIFT_));
-                    // LUCENENET: resize to the exact length: it's slightly faster to check if the resize is needed
-                    if (w >= chars.Length)
-                    {
-                        Array.Resize(ref chars, chars.Length + (e - r) * 2 - 1);
-                    }
                     chars[w++] = (char)(TRAIL_SURROGATE_MIN_VALUE + (cp & TRAIL_SURROGATE_MASK_));
                 }
-                // LUCENENET: resize to the exact length: it's slightly faster to check if the resize is needed
-                if (w != chars.Length)
-                {
-                    Array.Resize(ref chars, w);
-                }
             }
 
             var result = new char[w];


[12/15] lucenenet git commit: Lucene.Net.Misc.Index.Sorter: Reviewed EarlyTerminatingSortingCollector, Sorter, SortingAtomicReader, and SortingMergePolicy line-by-line and fixed some formatting issues, naming issues, and documentation issues

Posted by ni...@apache.org.
Lucene.Net.Misc.Index.Sorter: Reviewed EarlyTerminatingSortingCollector, Sorter, SortingAtomicReader, and SortingMergePolicy line-by-line and fixed some formatting issues, naming issues, and documentation issues


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/3b122d0c
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/3b122d0c
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/3b122d0c

Branch: refs/heads/api-work
Commit: 3b122d0c42942d4322e11adbcbf9bd81c2afe3be
Parents: f6c7515
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Fri Mar 24 04:28:07 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Fri Mar 24 06:28:23 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Misc/Index/Sorter/Sorter.cs      |  35 ++--
 .../Index/Sorter/SortingAtomicReader.cs         | 168 +++++++++----------
 .../Index/Sorter/SortingMergePolicy.cs          |  14 +-
 3 files changed, 102 insertions(+), 115 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3b122d0c/src/Lucene.Net.Misc/Index/Sorter/Sorter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Misc/Index/Sorter/Sorter.cs b/src/Lucene.Net.Misc/Index/Sorter/Sorter.cs
index 841bead..3af8d32 100644
--- a/src/Lucene.Net.Misc/Index/Sorter/Sorter.cs
+++ b/src/Lucene.Net.Misc/Index/Sorter/Sorter.cs
@@ -32,7 +32,7 @@ namespace Lucene.Net.Index.Sorter
     /// </summary>
     internal sealed class Sorter
     {
-        internal readonly Sort sort_Renamed;
+        internal readonly Sort sort;
 
         /// <summary>
         /// Creates a new Sorter to sort the index with <paramref name="sort"/>.
@@ -43,20 +43,19 @@ namespace Lucene.Net.Index.Sorter
             {
                 throw new System.ArgumentException("Cannot sort an index with a Sort that refers to the relevance score");
             }
-            this.sort_Renamed = sort;
+            this.sort = sort;
         }
 
         /// <summary>
         /// A permutation of doc IDs. For every document ID between <c>0</c> and
-        /// <see cref="IndexReader.MaxDoc"/>, <code>OldToNew(NewToOld(docID))</code> must
-        /// return <code>docID</code>.
+        /// <see cref="IndexReader.MaxDoc"/>, <c>OldToNew(NewToOld(docID))</c> must
+        /// return <c>docID</c>.
         /// </summary>
         internal abstract class DocMap
         {
-
             /// <summary>
             /// Given a doc ID from the original index, return its ordinal in the
-            ///  sorted index. 
+            /// sorted index. 
             /// </summary>
             public abstract int OldToNew(int docID);
 
@@ -67,7 +66,7 @@ namespace Lucene.Net.Index.Sorter
 
             /// <summary>
             /// Return the number of documents in this map. This must be equal to the
-            /// <see cref="AtomicReader.LiveDocs">number of documents</see> of the
+            /// <see cref="IndexReader.MaxDoc"/> number of documents of the
             /// <see cref="AtomicReader"/> which is sorted. 
             /// </summary>
             public abstract int Count { get; }
@@ -98,23 +97,21 @@ namespace Lucene.Net.Index.Sorter
         /// </summary>
         internal abstract class DocComparer : IComparer<int>
         {
-
             /// <summary>
-            /// Compare docID1 against docID2. The contract for the return value is the
+            /// Compare <paramref name="docID1"/> against <paramref name="docID2"/>. The contract for the return value is the
             /// same as <see cref="IComparer{T}.Compare(T, T)"/>. 
             /// </summary>
             public abstract int Compare(int docID1, int docID2);
-
         }
 
         private sealed class DocValueSorter : TimSorter
         {
+            private readonly int[] docs;
+            private readonly Sorter.DocComparer comparer;
+            private readonly int[] tmp;
 
-            internal readonly int[] docs;
-            internal readonly Sorter.DocComparer comparer;
-            internal readonly int[] tmp;
-
-            internal DocValueSorter(int[] docs, Sorter.DocComparer comparer) : base(docs.Length / 64)
+            internal DocValueSorter(int[] docs, Sorter.DocComparer comparer) 
+                : base(docs.Length / 64)
             {
                 this.docs = docs;
                 this.comparer = comparer;
@@ -257,9 +254,8 @@ namespace Lucene.Net.Index.Sorter
         /// </summary>
         internal DocMap Sort(AtomicReader reader)
         {
-            SortField[] fields = sort_Renamed.GetSort();
+            SortField[] fields = sort.GetSort();
             int[] reverseMul = new int[fields.Length];
-
             FieldComparer[] comparers = new FieldComparer[fields.Length];
 
             for (int i = 0; i < fields.Length; i++)
@@ -324,7 +320,7 @@ namespace Lucene.Net.Index.Sorter
         {
             get
             {
-                return sort_Renamed.ToString();
+                return sort.ToString();
             }
         }
 
@@ -337,7 +333,8 @@ namespace Lucene.Net.Index.Sorter
 
         private class ScorerAnonymousInnerClassHelper : Scorer
         {
-            public ScorerAnonymousInnerClassHelper() : base(null)
+            public ScorerAnonymousInnerClassHelper() 
+                : base(null)
             {
             }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3b122d0c/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs b/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs
index e874b88..f14f71d 100644
--- a/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs
+++ b/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs
@@ -1,10 +1,10 @@
-\ufeffusing System;
-using System.Diagnostics;
-using Lucene.Net.Search;
+\ufeffusing Lucene.Net.Search;
 using Lucene.Net.Store;
+using Lucene.Net.Support;
 using Lucene.Net.Util;
 using Lucene.Net.Util.Automaton;
-using Lucene.Net.Support;
+using System;
+using System.Diagnostics;
 
 namespace Lucene.Net.Index.Sorter
 {
@@ -43,15 +43,13 @@ namespace Lucene.Net.Index.Sorter
     /// </summary>
     public class SortingAtomicReader : FilterAtomicReader
     {
-
         private class SortingFields : FilterFields
         {
+            private readonly Sorter.DocMap docMap;
+            private readonly FieldInfos infos;
 
-            internal readonly Sorter.DocMap docMap;
-            internal readonly FieldInfos infos;
-
-            public SortingFields(Fields @in, FieldInfos infos, Sorter.DocMap docMap)
-                : base(@in)
+            public SortingFields(Fields input, FieldInfos infos, Sorter.DocMap docMap)
+                : base(input)
             {
                 this.docMap = docMap;
                 this.infos = infos;
@@ -73,11 +71,11 @@ namespace Lucene.Net.Index.Sorter
 
         private class SortingTerms : FilterTerms
         {
+            private readonly Sorter.DocMap docMap;
+            private readonly IndexOptions indexOptions;
 
-            internal readonly Sorter.DocMap docMap;
-            internal readonly IndexOptions indexOptions;
-
-            public SortingTerms(Terms input, IndexOptions indexOptions, Sorter.DocMap docMap) : base(input)
+            public SortingTerms(Terms input, IndexOptions indexOptions, Sorter.DocMap docMap) 
+                : base(input)
             {
                 this.docMap = docMap;
                 this.indexOptions = indexOptions;
@@ -96,12 +94,11 @@ namespace Lucene.Net.Index.Sorter
 
         private class SortingTermsEnum : FilterTermsEnum
         {
+            private readonly Sorter.DocMap docMap; // pkg-protected to avoid synthetic accessor methods
+            private readonly IndexOptions indexOptions;
 
-            internal readonly Sorter.DocMap docMap; // pkg-protected to avoid synthetic accessor methods
-            internal readonly IndexOptions indexOptions;
-
-            public SortingTermsEnum(TermsEnum @in, Sorter.DocMap docMap, IndexOptions indexOptions)
-                : base(@in)
+            public SortingTermsEnum(TermsEnum input, Sorter.DocMap docMap, IndexOptions indexOptions)
+                : base(input)
             {
                 this.docMap = docMap;
                 this.indexOptions = indexOptions;
@@ -196,13 +193,12 @@ namespace Lucene.Net.Index.Sorter
 
         private class SortingBinaryDocValues : BinaryDocValues
         {
+            private readonly BinaryDocValues @in;
+            private readonly Sorter.DocMap docMap;
 
-            internal readonly BinaryDocValues @in;
-            internal readonly Sorter.DocMap docMap;
-
-            internal SortingBinaryDocValues(BinaryDocValues @in, Sorter.DocMap docMap)
+            internal SortingBinaryDocValues(BinaryDocValues input, Sorter.DocMap docMap)
             {
-                this.@in = @in;
+                this.@in = input;
                 this.docMap = docMap;
             }
 
@@ -214,13 +210,12 @@ namespace Lucene.Net.Index.Sorter
 
         private class SortingNumericDocValues : NumericDocValues
         {
+            private readonly NumericDocValues @in;
+            private readonly Sorter.DocMap docMap;
 
-            internal readonly NumericDocValues @in;
-            internal readonly Sorter.DocMap docMap;
-
-            public SortingNumericDocValues(NumericDocValues @in, Sorter.DocMap docMap)
+            public SortingNumericDocValues(NumericDocValues input, Sorter.DocMap docMap)
             {
-                this.@in = @in;
+                this.@in = input;
                 this.docMap = docMap;
             }
 
@@ -232,13 +227,12 @@ namespace Lucene.Net.Index.Sorter
 
         private class SortingBits : IBits
         {
+            private readonly IBits @in;
+            private readonly Sorter.DocMap docMap;
 
-            internal readonly IBits @in;
-            internal readonly Sorter.DocMap docMap;
-
-            public SortingBits(IBits @in, Sorter.DocMap docMap)
+            public SortingBits(IBits input, Sorter.DocMap docMap)
             {
-                this.@in = @in;
+                this.@in = input;
                 this.docMap = docMap;
             }
 
@@ -255,13 +249,12 @@ namespace Lucene.Net.Index.Sorter
 
         private class SortingSortedDocValues : SortedDocValues
         {
+            private readonly SortedDocValues @in;
+            private readonly Sorter.DocMap docMap;
 
-            internal readonly SortedDocValues @in;
-            internal readonly Sorter.DocMap docMap;
-
-            internal SortingSortedDocValues(SortedDocValues @in, Sorter.DocMap docMap)
+            internal SortingSortedDocValues(SortedDocValues input, Sorter.DocMap docMap)
             {
-                this.@in = @in;
+                this.@in = input;
                 this.docMap = docMap;
             }
 
@@ -296,13 +289,12 @@ namespace Lucene.Net.Index.Sorter
 
         private class SortingSortedSetDocValues : SortedSetDocValues
         {
+            private readonly SortedSetDocValues @in;
+            private readonly Sorter.DocMap docMap;
 
-            internal readonly SortedSetDocValues @in;
-            internal readonly Sorter.DocMap docMap;
-
-            internal SortingSortedSetDocValues(SortedSetDocValues @in, Sorter.DocMap docMap)
+            internal SortingSortedSetDocValues(SortedSetDocValues input, Sorter.DocMap docMap)
             {
-                this.@in = @in;
+                this.@in = input;
                 this.docMap = docMap;
             }
 
@@ -337,16 +329,15 @@ namespace Lucene.Net.Index.Sorter
 
         internal class SortingDocsEnum : FilterDocsEnum
         {
-
-            internal sealed class DocFreqSorter : TimSorter
+            private sealed class DocFreqSorter : TimSorter
             {
+                private int[] docs;
+                private int[] freqs;
+                private readonly int[] tmpDocs;
+                private int[] tmpFreqs;
 
-                internal int[] docs;
-                internal int[] freqs;
-                internal readonly int[] tmpDocs;
-                internal int[] tmpFreqs;
-
-                public DocFreqSorter(int maxDoc) : base(maxDoc / 64)
+                public DocFreqSorter(int maxDoc) 
+                    : base(maxDoc / 64)
                 {
                     this.tmpDocs = new int[maxDoc / 64];
                 }
@@ -413,16 +404,16 @@ namespace Lucene.Net.Index.Sorter
                 }
             }
 
-            internal readonly int maxDoc;
-            internal readonly DocFreqSorter sorter;
-            internal int[] docs;
-            internal int[] freqs;
-            internal int docIt = -1;
-            internal readonly int upto;
-            internal readonly bool withFreqs;
+            private readonly int maxDoc;
+            private readonly DocFreqSorter sorter;
+            private int[] docs;
+            private int[] freqs;
+            private int docIt = -1;
+            private readonly int upto;
+            private readonly bool withFreqs;
 
-            internal SortingDocsEnum(int maxDoc, SortingDocsEnum reuse, DocsEnum @in, bool withFreqs, Sorter.DocMap docMap)
-                    : base(@in)
+            internal SortingDocsEnum(int maxDoc, SortingDocsEnum reuse, DocsEnum input, bool withFreqs, Sorter.DocMap docMap)
+                : base(input)
             {
                 this.maxDoc = maxDoc;
                 this.withFreqs = withFreqs;
@@ -453,7 +444,7 @@ namespace Lucene.Net.Index.Sorter
                     {
                         freqs = new int[docs.Length];
                     }
-                    while ((doc = @in.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
+                    while ((doc = input.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
                     {
                         if (i >= docs.Length)
                         {
@@ -461,14 +452,14 @@ namespace Lucene.Net.Index.Sorter
                             freqs = ArrayUtil.Grow(freqs, freqs.Length + 1);
                         }
                         docs[i] = docMap.OldToNew(doc);
-                        freqs[i] = @in.Freq;
+                        freqs[i] = input.Freq;
                         ++i;
                     }
                 }
                 else
                 {
                     freqs = null;
-                    while ((doc = @in.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
+                    while ((doc = input.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
                     {
                         if (i >= docs.Length)
                         {
@@ -533,7 +524,6 @@ namespace Lucene.Net.Index.Sorter
 
         internal class SortingDocsAndPositionsEnum : FilterDocsAndPositionsEnum
         {
-
             /// <summary>
             /// A <see cref="TimSorter"/> which sorts two parallel arrays of doc IDs and
             /// offsets in one go. Everytime a doc ID is 'swapped', its correponding offset
@@ -541,13 +531,13 @@ namespace Lucene.Net.Index.Sorter
             /// </summary>
             internal sealed class DocOffsetSorter : TimSorter
             {
+                private int[] docs;
+                private long[] offsets;
+                private readonly int[] tmpDocs;
+                private readonly long[] tmpOffsets;
 
-                internal int[] docs;
-                internal long[] offsets;
-                internal readonly int[] tmpDocs;
-                internal readonly long[] tmpOffsets;
-
-                public DocOffsetSorter(int maxDoc) : base(maxDoc / 64)
+                public DocOffsetSorter(int maxDoc) 
+                    : base(maxDoc / 64)
                 {
                     this.tmpDocs = new int[maxDoc / 64];
                     this.tmpOffsets = new long[maxDoc / 64];
@@ -599,23 +589,23 @@ namespace Lucene.Net.Index.Sorter
                 }
             }
 
-            internal readonly int maxDoc;
-            internal readonly DocOffsetSorter sorter;
-            internal int[] docs;
-            internal long[] offsets;
-            internal readonly int upto;
+            private readonly int maxDoc;
+            private readonly DocOffsetSorter sorter;
+            private int[] docs;
+            private long[] offsets;
+            private readonly int upto;
 
-            internal readonly IndexInput postingInput;
-            internal readonly bool storeOffsets;
+            private readonly IndexInput postingInput;
+            private readonly bool storeOffsets;
 
-            internal int docIt = -1;
-            internal int pos;
-            internal int startOffset = -1;
-            internal int endOffset = -1;
-            internal readonly BytesRef payload;
-            internal int currFreq;
+            private int docIt = -1;
+            private int pos;
+            private int startOffset = -1;
+            private int endOffset = -1;
+            private readonly BytesRef payload;
+            private int currFreq;
 
-            internal readonly RAMFile file;
+            private readonly RAMFile file;
 
             internal SortingDocsAndPositionsEnum(int maxDoc, SortingDocsAndPositionsEnum reuse, DocsAndPositionsEnum @in, Sorter.DocMap docMap, bool storeOffsets)
                 : base(@in)
@@ -679,7 +669,7 @@ namespace Lucene.Net.Index.Sorter
                 return docs == ((SortingDocsAndPositionsEnum)other).docs;
             }
 
-            internal virtual void AddPositions(DocsAndPositionsEnum @in, IndexOutput @out)
+            private void AddPositions(DocsAndPositionsEnum @in, IndexOutput @out)
             {
                 int freq = @in.Freq;
                 @out.WriteVInt32(freq);
@@ -801,7 +791,7 @@ namespace Lucene.Net.Index.Sorter
         /// </summary>
         public static AtomicReader Wrap(AtomicReader reader, Sort sort)
         {
-            return Wrap(reader, (new Sorter(sort)).Sort(reader));
+            return Wrap(reader, new Sorter(sort).Sort(reader));
         }
 
         /// <summary>
@@ -816,13 +806,13 @@ namespace Lucene.Net.Index.Sorter
             }
             if (reader.MaxDoc != docMap.Count)
             {
-                throw new System.ArgumentException("reader.maxDoc() should be equal to docMap.size(), got" + reader.MaxDoc + " != " + docMap.Count);
+                throw new System.ArgumentException("reader.MaxDoc should be equal to docMap.Count, got" + reader.MaxDoc + " != " + docMap.Count);
             }
             Debug.Assert(Sorter.IsConsistent(docMap));
             return new SortingAtomicReader(reader, docMap);
         }
 
-        internal readonly Sorter.DocMap docMap; // pkg-protected to avoid synthetic accessor methods
+        private readonly Sorter.DocMap docMap; // pkg-protected to avoid synthetic accessor methods
 
         private SortingAtomicReader(AtomicReader @in, Sorter.DocMap docMap) : base(@in)
         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/3b122d0c/src/Lucene.Net.Misc/Index/Sorter/SortingMergePolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Misc/Index/Sorter/SortingMergePolicy.cs b/src/Lucene.Net.Misc/Index/Sorter/SortingMergePolicy.cs
index 770c00b..2853157 100644
--- a/src/Lucene.Net.Misc/Index/Sorter/SortingMergePolicy.cs
+++ b/src/Lucene.Net.Misc/Index/Sorter/SortingMergePolicy.cs
@@ -1,6 +1,5 @@
 \ufeffusing Lucene.Net.Search;
 using Lucene.Net.Store;
-using Lucene.Net.Support;
 using Lucene.Net.Util;
 using Lucene.Net.Util.Packed;
 using System;
@@ -51,7 +50,7 @@ namespace Lucene.Net.Index.Sorter
         /// Put in the <see cref="SegmentInfo.Diagnostics">diagnostics</see> to denote that
         /// this segment is sorted.
         /// </summary>
-        public const string SORTER_ID_PROP = "sorter";
+        public static readonly string SORTER_ID_PROP = "sorter";
 
         internal class SortingOneMerge : OneMerge
         {
@@ -132,7 +131,7 @@ namespace Lucene.Net.Index.Sorter
             {
                 if (unsortedReaders == null)
                 {
-                    throw new InvalidOperationException("Invalid state");
+                    throw new InvalidOperationException();
                 }
                 if (docMap == null)
                 {
@@ -164,7 +163,6 @@ namespace Lucene.Net.Index.Sorter
                     return mergeState.DocMaps[0].Get(newWithDeletes);
                 }
             }
-
         }
 
         internal class SortingMergeSpecification : MergeSpecification
@@ -184,7 +182,7 @@ namespace Lucene.Net.Index.Sorter
 
             public override string SegString(Directory dir)
             {
-                return "SortingMergeSpec(" + base.SegString(dir) + ", sorter=" + outerInstance.sorter + ")";
+                return "SortingMergeSpecification(" + base.SegString(dir) + ", sorter=" + outerInstance.sorter + ")";
             }
 
         }
@@ -198,8 +196,10 @@ namespace Lucene.Net.Index.Sorter
             {
                 SegmentReader segReader = (SegmentReader)reader;
                 IDictionary<string, string> diagnostics = segReader.SegmentInfo.Info.Diagnostics;
-                var diagnosticsSort = diagnostics.ContainsKey(SORTER_ID_PROP) ? diagnostics[SORTER_ID_PROP] : null;
-                if (diagnostics != null && sort.ToString().Equals(diagnosticsSort))
+                string diagnosticsSort;
+                if (diagnostics != null 
+                    && diagnostics.TryGetValue(SORTER_ID_PROP, out diagnosticsSort)
+                    && sort.ToString().Equals(diagnosticsSort))
                 {
                     return true;
                 }


[13/15] lucenenet git commit: BUG: Lucene.Net.TestFramework.Util.LuceneTestCase: Use dir.OpenInput() to determine if a file exists, just like in Lucene and always catch exceptions so we can return false if it doesn't

Posted by ni...@apache.org.
BUG: Lucene.Net.TestFramework.Util.LuceneTestCase: Use dir.OpenInput() to determine if a file exists, just like in Lucene and always catch exceptions so we can return false if it doesn't


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/93f3f483
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/93f3f483
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/93f3f483

Branch: refs/heads/api-work
Commit: 93f3f48315b8c87d0d63840a091468eae53f58f6
Parents: 3b122d0
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Fri Mar 24 05:05:32 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Fri Mar 24 06:28:23 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/93f3f483/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 878168a..8d2e0f8 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -2644,18 +2644,19 @@ namespace Lucene.Net.Util
         /// </summary>
         public static bool SlowFileExists(Directory dir, string fileName)
         {
-#pragma warning disable 612, 618
-            return dir.FileExists(fileName);
-#pragma warning restore 612, 618
-            /*try
+            try
             {
                 dir.OpenInput(fileName, IOContext.DEFAULT).Dispose();
                 return true;
             }
-            catch (FileNotFoundException e)
+            catch (FileNotFoundException)
             {
                 return false;
-            }*/
+            }
+            catch (NoSuchFileException)
+            {
+                return false;
+            }
         }
 
         /// <summary>


[11/15] lucenenet git commit: Lucene.Net.Core.Index (AtomicReader + AtomicReaderContext): documentation comments

Posted by ni...@apache.org.
Lucene.Net.Core.Index (AtomicReader + AtomicReaderContext): documentation comments


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/f6c7515c
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/f6c7515c
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/f6c7515c

Branch: refs/heads/api-work
Commit: f6c7515c8ff4e483538257d450f25776f3d9f1de
Parents: 631cfa7
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Fri Mar 24 02:11:34 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Fri Mar 24 06:28:22 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Index/AtomicReader.cs       | 129 ++++++++++---------
 .../Index/AtomicReaderContext.cs                |   4 +-
 2 files changed, 70 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f6c7515c/src/Lucene.Net.Core/Index/AtomicReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/AtomicReader.cs b/src/Lucene.Net.Core/Index/AtomicReader.cs
index 3d5260a..3e4f1eb 100644
--- a/src/Lucene.Net.Core/Index/AtomicReader.cs
+++ b/src/Lucene.Net.Core/Index/AtomicReader.cs
@@ -24,26 +24,26 @@ namespace Lucene.Net.Index
     using IBits = Lucene.Net.Util.IBits;
 
     /// <summary>
-    /// {@code AtomicReader} is an abstract class, providing an interface for accessing an
+    /// <see cref="AtomicReader"/> is an abstract class, providing an interface for accessing an
     /// index.  Search of an index is done entirely through this abstract interface,
-    /// so that any subclass which implements it is searchable. IndexReaders implemented
+    /// so that any subclass which implements it is searchable. <see cref="IndexReader"/>s implemented
     /// by this subclass do not consist of several sub-readers,
     /// they are atomic. They support retrieval of stored fields, doc values, terms,
     /// and postings.
     ///
-    /// <p>For efficiency, in this API documents are often referred to via
+    /// <para/>For efficiency, in this API documents are often referred to via
     /// <i>document numbers</i>, non-negative integers which each name a unique
     /// document in the index.  These document numbers are ephemeral -- they may change
     /// as documents are added to and deleted from an index.  Clients should thus not
     /// rely on a given document having the same number between sessions.
     ///
-    /// <p>
-    /// <a name="thread-safety"></a><p><b>NOTE</b>: {@link
-    /// IndexReader} instances are completely thread
+    /// <para/>
+    /// <b>NOTE</b>: <see cref="IndexReader"/>
+    /// instances are completely thread
     /// safe, meaning multiple threads can call any of its methods,
     /// concurrently.  If your application requires external
     /// synchronization, you should <b>not</b> synchronize on the
-    /// <code>IndexReader</code> instance; use your own
+    /// <see cref="IndexReader"/> instance; use your own
     /// (non-Lucene) objects instead.
     /// </summary>
     public abstract class AtomicReader : IndexReader
@@ -57,9 +57,9 @@ namespace Lucene.Net.Index
 
         /// <summary>
         /// Sole constructor. (For invocation by subclass
-        ///  constructors, typically implicit.)
+        /// constructors, typically implicit.)
         /// </summary>
-        protected internal AtomicReader()
+        protected AtomicReader()
             : base()
         {
             InitializeInstanceFields();
@@ -74,6 +74,11 @@ namespace Lucene.Net.Index
             }
         }
 
+        /// <summary>
+        /// LUCENENET specific propety that allows access to
+        /// the context as <see cref="AtomicReaderContext"/>,
+        /// which prevents the need to cast.
+        /// </summary>
         public AtomicReaderContext AtomicContext
         {
             get
@@ -84,9 +89,8 @@ namespace Lucene.Net.Index
         }
 
         /// <summary>
-        /// Returns true if there are norms stored for this field. </summary>
-        /// @deprecated (4.0) use <seealso cref="#getFieldInfos()"/> and check <seealso cref="FieldInfo#hasNorms()"/>
-        ///                   for the field instead.
+        /// Returns true if there are norms stored for this <paramref name="field"/>.
+        /// </summary>
         [Obsolete("(4.0) use FieldInfos and check FieldInfo.HasNorms for the field instead.")]
         public bool HasNorms(string field)
         {
@@ -97,8 +101,8 @@ namespace Lucene.Net.Index
         }
 
         /// <summary>
-        /// Returns <seealso cref="Fields"/> for this reader.
-        /// this method may return null if the reader has no
+        /// Returns <see cref="Index.Fields"/> for this reader.
+        /// this property may return <c>null</c> if the reader has no
         /// postings.
         /// </summary>
         public abstract Fields Fields { get; }
@@ -127,9 +131,9 @@ namespace Lucene.Net.Index
         }
 
         /// <summary>
-        /// Returns the number of documents containing the term
-        /// <code>t</code>.  this method returns 0 if the term or
-        /// field does not exists.  this method does not take into
+        /// Returns the number of documents containing the <paramref name="term"/>. 
+        /// This method returns 0 if the term or
+        /// field does not exist. This method does not take into
         /// account deleted documents that have not yet been merged
         /// away.
         /// </summary>
@@ -187,7 +191,7 @@ namespace Lucene.Net.Index
         }
 
         /// <summary>
-        /// this may return null if the field does not exist. </summary>
+        /// This may return <c>null</c> if the field does not exist. </summary>
         public Terms GetTerms(string field) // LUCENENET specific: Renamed from Terms()
         {
             Fields fields = Fields;
@@ -199,10 +203,11 @@ namespace Lucene.Net.Index
         }
 
         /// <summary>
-        /// Returns <seealso cref="DocsEnum"/> for the specified term.
-        ///  this will return null if either the field or
-        ///  term does not exist. </summary>
-        ///  <seealso cref= TermsEnum#docs(Bits, DocsEnum)  </seealso>
+        /// Returns <see cref="DocsEnum"/> for the specified term.
+        /// This will return <c>null</c> if either the field or
+        /// term does not exist.
+        /// </summary>
+        /// <seealso cref="TermsEnum.Docs(IBits, DocsEnum)"/>
         public DocsEnum GetTermDocsEnum(Term term) // LUCENENET specific: Renamed from TermDocsEnum()
         {
             Debug.Assert(term.Field != null);
@@ -224,10 +229,10 @@ namespace Lucene.Net.Index
         }
 
         /// <summary>
-        /// Returns <seealso cref="DocsAndPositionsEnum"/> for the specified
-        ///  term.  this will return null if the
-        ///  field or term does not exist or positions weren't indexed. </summary>
-        ///  <seealso cref= TermsEnum#docsAndPositions(Bits, DocsAndPositionsEnum)  </seealso>
+        /// Returns <see cref="DocsAndPositionsEnum"/> for the specified
+        /// term. This will return <c>null</c> if the
+        /// field or term does not exist or positions weren't indexed. </summary>
+        /// <seealso cref="TermsEnum.DocsAndPositions(IBits, DocsAndPositionsEnum)"/>
         public DocsAndPositionsEnum GetTermPositionsEnum(Term term) // LUCENENET specific: Renamed from TermPositionsEnum()
         {
             Debug.Assert(term.Field != null);
@@ -249,78 +254,80 @@ namespace Lucene.Net.Index
         }
 
         /// <summary>
-        /// Returns <seealso cref="NumericDocValues"/> for this field, or
-        ///  null if no <seealso cref="NumericDocValues"/> were indexed for
-        ///  this field.  The returned instance should only be
-        ///  used by a single thread.
+        /// Returns <see cref="NumericDocValues"/> for this field, or
+        /// null if no <see cref="NumericDocValues"/> were indexed for
+        /// this field. The returned instance should only be
+        /// used by a single thread.
         /// </summary>
         public abstract NumericDocValues GetNumericDocValues(string field);
 
         /// <summary>
-        /// Returns <seealso cref="BinaryDocValues"/> for this field, or
-        ///  null if no <seealso cref="BinaryDocValues"/> were indexed for
-        ///  this field.  The returned instance should only be
-        ///  used by a single thread.
+        /// Returns <see cref="BinaryDocValues"/> for this field, or
+        /// <c>null</c> if no <see cref="BinaryDocValues"/> were indexed for
+        /// this field. The returned instance should only be
+        /// used by a single thread.
         /// </summary>
         public abstract BinaryDocValues GetBinaryDocValues(string field);
 
         /// <summary>
-        /// Returns <seealso cref="SortedDocValues"/> for this field, or
-        ///  null if no <seealso cref="SortedDocValues"/> were indexed for
-        ///  this field.  The returned instance should only be
-        ///  used by a single thread.
+        /// Returns <see cref="SortedDocValues"/> for this field, or
+        /// <c>null</c> if no <see cref="SortedDocValues"/> were indexed for
+        /// this field. The returned instance should only be
+        /// used by a single thread.
         /// </summary>
         public abstract SortedDocValues GetSortedDocValues(string field);
 
         /// <summary>
-        /// Returns <seealso cref="SortedSetDocValues"/> for this field, or
-        ///  null if no <seealso cref="SortedSetDocValues"/> were indexed for
-        ///  this field.  The returned instance should only be
-        ///  used by a single thread.
+        /// Returns <see cref="SortedSetDocValues"/> for this field, or
+        /// <c>null</c> if no <see cref="SortedSetDocValues"/> were indexed for
+        /// this field. The returned instance should only be
+        /// used by a single thread.
         /// </summary>
         public abstract SortedSetDocValues GetSortedSetDocValues(string field);
 
         /// <summary>
-        /// Returns a <seealso cref="IBits"/> at the size of <code>reader.maxDoc()</code>,
-        ///  with turned on bits for each docid that does have a value for this field,
-        ///  or null if no DocValues were indexed for this field. The
-        ///  returned instance should only be used by a single thread
+        /// Returns a <see cref="IBits"/> at the size of <c>reader.MaxDoc</c>,
+        /// with turned on bits for each docid that does have a value for this field,
+        /// or <c>null</c> if no <see cref="DocValues"/> were indexed for this field. The
+        /// returned instance should only be used by a single thread.
         /// </summary>
         public abstract IBits GetDocsWithField(string field);
 
         /// <summary>
-        /// Returns <seealso cref="NumericDocValues"/> representing norms
-        ///  for this field, or null if no <seealso cref="NumericDocValues"/>
-        ///  were indexed. The returned instance should only be
-        ///  used by a single thread.
+        /// Returns <see cref="NumericDocValues"/> representing norms
+        /// for this field, or <c>null</c> if no <see cref="NumericDocValues"/>
+        /// were indexed. The returned instance should only be
+        /// used by a single thread.
         /// </summary>
         public abstract NumericDocValues GetNormValues(string field);
 
         /// <summary>
-        /// Get the <seealso cref="FieldInfos"/> describing all fields in
+        /// Get the <see cref="Index.FieldInfos"/> describing all fields in
         /// this reader.
+        /// <para/>
         /// @lucene.experimental
         /// </summary>
         public abstract FieldInfos FieldInfos { get; }
 
         /// <summary>
-        /// Returns the <seealso cref="IBits"/> representing live (not
-        ///  deleted) docs.  A set bit indicates the doc ID has not
-        ///  been deleted.  If this method returns null it means
-        ///  there are no deleted documents (all documents are
-        ///  live).
-        ///
-        ///  The returned instance has been safely published for
-        ///  use by multiple threads without additional
-        ///  synchronization.
+        /// Returns the <see cref="IBits"/> representing live (not
+        /// deleted) docs.  A set bit indicates the doc ID has not
+        /// been deleted.  If this method returns <c>null</c> it means
+        /// there are no deleted documents (all documents are
+        /// live).
+        /// <para/>
+        /// The returned instance has been safely published for
+        /// use by multiple threads without additional
+        /// synchronization.
         /// </summary>
         public abstract IBits LiveDocs { get; }
 
         /// <summary>
         /// Checks consistency of this reader.
-        /// <p>
+        /// <para/>
         /// Note that this may be costly in terms of I/O, e.g.
         /// may involve computing a checksum value against large data files.
+        /// <para/>
         /// @lucene.internal
         /// </summary>
         public abstract void CheckIntegrity();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f6c7515c/src/Lucene.Net.Core/Index/AtomicReaderContext.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/AtomicReaderContext.cs b/src/Lucene.Net.Core/Index/AtomicReaderContext.cs
index 8f7d2eb..5551c6d 100644
--- a/src/Lucene.Net.Core/Index/AtomicReaderContext.cs
+++ b/src/Lucene.Net.Core/Index/AtomicReaderContext.cs
@@ -21,7 +21,7 @@ namespace Lucene.Net.Index
      */
 
     /// <summary>
-    /// <seealso cref="IndexReaderContext"/> for <seealso cref="AtomicReader"/> instances.
+    /// <see cref="IndexReaderContext"/> for <see cref="Index.AtomicReader"/> instances.
     /// </summary>
     public sealed class AtomicReaderContext : IndexReaderContext
     {
@@ -37,7 +37,7 @@ namespace Lucene.Net.Index
         private readonly IList<AtomicReaderContext> leaves;
 
         /// <summary>
-        /// Creates a new <seealso cref="AtomicReaderContext"/>
+        /// Creates a new <see cref="AtomicReaderContext"/>
         /// </summary>
         internal AtomicReaderContext(CompositeReaderContext parent, AtomicReader reader, int ord, int docBase, int leafOrd, int leafDocBase)
             : base(parent, ord, docBase)


[07/15] lucenenet git commit: Lucene.Net.Core.Util.SetOnce: Changed back to original implementation that uses AtomicBoolean rather than Interlocked. Also added a class generic constraint to revert back to using the volatile keyword and fixed the test to

Posted by ni...@apache.org.
Lucene.Net.Core.Util.SetOnce: Changed back to original implementation that uses AtomicBoolean rather than Interlocked. Also added a class generic constraint to revert back to using the volatile keyword and fixed the test to use a reference type for testing.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/50bbf51b
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/50bbf51b
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/50bbf51b

Branch: refs/heads/api-work
Commit: 50bbf51be1674906a4457cf155d86284a79feb73
Parents: d9f979c
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 23 23:18:44 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 23 23:35:01 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/SetOnce.cs      | 33 +++++++++----------
 src/Lucene.Net.Tests/Util/TestSetOnce.cs | 47 +++++++++++++++++----------
 2 files changed, 45 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/50bbf51b/src/Lucene.Net.Core/Util/SetOnce.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/SetOnce.cs b/src/Lucene.Net.Core/Util/SetOnce.cs
index 2710842..2ac06fe 100644
--- a/src/Lucene.Net.Core/Util/SetOnce.cs
+++ b/src/Lucene.Net.Core/Util/SetOnce.cs
@@ -1,5 +1,5 @@
+using Lucene.Net.Support;
 using System;
-using System.Threading;
 
 namespace Lucene.Net.Util
 {
@@ -23,16 +23,16 @@ namespace Lucene.Net.Util
     /// <summary>
     /// A convenient class which offers a semi-immutable object wrapper
     /// implementation which allows one to set the value of an object exactly once,
-    /// and retrieve it many times. If <seealso cref="#set(Object)"/> is called more than once,
-    /// <seealso cref="AlreadySetException"/> is thrown and the operation
+    /// and retrieve it many times. If <see cref="Set(T)"/> is called more than once,
+    /// <see cref="AlreadySetException"/> is thrown and the operation
     /// will fail.
-    ///
+    /// <para/>
     /// @lucene.experimental
     /// </summary>
-    public sealed class SetOnce<T>
+    public sealed class SetOnce<T> where T : class // LUCENENET specific - added class constraint so we don't accept value types (which cannot be volatile)
     {
         /// <summary>
-        /// Thrown when <seealso cref="SetOnce#set(Object)"/> is called more than once. </summary>
+        /// Thrown when <see cref="SetOnce.Set(T)"/> is called more than once. </summary>
         // LUCENENET: All exeption classes should be marked serializable
 #if FEATURE_SERIALIZABLE
         [Serializable]
@@ -45,37 +45,36 @@ namespace Lucene.Net.Util
             }
         }
 
-        private T obj = default(T);
-        private int set;
+        private volatile T obj = default(T);
+        private readonly AtomicBoolean set;
 
         /// <summary>
         /// A default constructor which does not set the internal object, and allows
-        /// setting it by calling <seealso cref="#set(Object)"/>.
+        /// setting it by calling <see cref="Set(T)"/>.
         /// </summary>
         public SetOnce()
         {
-            set = 0;
+            set = new AtomicBoolean(false);
         }
 
         /// <summary>
         /// Creates a new instance with the internal object set to the given object.
-        /// Note that any calls to <seealso cref="#set(Object)"/> afterwards will result in
-        /// <seealso cref="AlreadySetException"/>
+        /// Note that any calls to <see cref="Set(T)"/> afterwards will result in
+        /// <see cref="AlreadySetException"/>
         /// </summary>
         /// <exception cref="AlreadySetException"> if called more than once </exception>
-        /// <seealso cref= #set(Object) </seealso>
+        /// <seealso cref="Set(T)"/>
         public SetOnce(T obj)
         {
             this.obj = obj;
-            set = 1;
+            set = new AtomicBoolean(true);
         }
 
         /// <summary>
         /// Sets the given object. If the object has already been set, an exception is thrown. </summary>
         public void Set(T obj)
         {
-            //if (set.compareAndSet(false, true))
-            if (Interlocked.CompareExchange(ref set, 1, 0) == 0)
+            if (set.CompareAndSet(false, true))
             {
                 this.obj = obj;
             }
@@ -86,7 +85,7 @@ namespace Lucene.Net.Util
         }
 
         /// <summary>
-        /// Returns the object set by <seealso cref="#set(Object)"/>. </summary>
+        /// Returns the object set by <see cref="Set(T)"/>. </summary>
         public T Get()
         {
             return obj;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/50bbf51b/src/Lucene.Net.Tests/Util/TestSetOnce.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Util/TestSetOnce.cs b/src/Lucene.Net.Tests/Util/TestSetOnce.cs
index fd53d74..e54c080 100644
--- a/src/Lucene.Net.Tests/Util/TestSetOnce.cs
+++ b/src/Lucene.Net.Tests/Util/TestSetOnce.cs
@@ -1,7 +1,8 @@
-using System.Threading;
 using Lucene.Net.Support;
 using NUnit.Framework;
 using System;
+using System.Globalization;
+using System.Threading;
 
 namespace Lucene.Net.Util
 {
@@ -25,10 +26,20 @@ namespace Lucene.Net.Util
     [TestFixture]
     public class TestSetOnce : LuceneTestCase
     {
+        private class Integer // LUCENENET specific class for testing (since int? is not a reference type)
+        {
+            public Integer(int value)
+            {
+                this.value = value;
+            }
+
+            internal int value;
+        }
+
         private sealed class SetOnceThread : ThreadClass
         {
-            internal SetOnce<int?> Set;
-            internal bool Success = false;
+            internal SetOnce<Integer> set;
+            internal bool success = false;
             internal readonly Random RAND;
 
             public SetOnceThread(Random random)
@@ -41,8 +52,8 @@ namespace Lucene.Net.Util
                 try
                 {
                     Sleep(RAND.Next(10)); // sleep for a short time
-                    Set.Set(new int?(Convert.ToInt32(Name.Substring(2))));
-                    Success = true;
+                    set.Set(new Integer(Convert.ToInt32(Name.Substring(2), CultureInfo.InvariantCulture)));
+                    success = true;
                 }
 #if !NETSTANDARD
                 catch (ThreadInterruptedException)
@@ -54,7 +65,7 @@ namespace Lucene.Net.Util
                 {
                     // TODO: change exception type
                     // expected.
-                    Success = false;
+                    success = false;
                 }
             }
         }
@@ -62,38 +73,38 @@ namespace Lucene.Net.Util
         [Test]
         public virtual void TestEmptyCtor()
         {
-            SetOnce<int?> set = new SetOnce<int?>();
+            SetOnce<Integer> set = new SetOnce<Integer>();
             Assert.IsNull(set.Get());
         }
 
         [Test]
         public virtual void TestSettingCtor()
         {
-            SetOnce<int?> set = new SetOnce<int?>(new int?(5));
-            Assert.AreEqual(5, (int)set.Get());
-            Assert.Throws<SetOnce<int?>.AlreadySetException>(() => set.Set(new int?(7)));
+            SetOnce<Integer> set = new SetOnce<Integer>(new Integer(5));
+            Assert.AreEqual(5, set.Get().value);
+            Assert.Throws<SetOnce<Integer>.AlreadySetException>(() => set.Set(new Integer(7)));
         }
 
         [Test]
         public virtual void TestSetOnce_mem()
         {
-            SetOnce<int?> set = new SetOnce<int?>();
-            set.Set(new int?(5));
-            Assert.AreEqual(5, (int)set.Get());
-            Assert.Throws<SetOnce<int?>.AlreadySetException>(() => set.Set(new int?(7)));
+            SetOnce<Integer> set = new SetOnce<Integer>();
+            set.Set(new Integer(5));
+            Assert.AreEqual(5, set.Get().value);
+            Assert.Throws<SetOnce<Integer>.AlreadySetException>(() => set.Set(new Integer(7)));
         }
 
         [Test]
         public virtual void TestSetMultiThreaded()
         {
-            SetOnce<int?> set = new SetOnce<int?>();
+            SetOnce<Integer> set = new SetOnce<Integer>();
             SetOnceThread[] threads = new SetOnceThread[10];
             Random random = Random();
             for (int i = 0; i < threads.Length; i++)
             {
                 threads[i] = new SetOnceThread(random);
                 threads[i].Name = "t-" + (i + 1);
-                threads[i].Set = set;
+                threads[i].set = set;
             }
 
             foreach (ThreadClass t in threads)
@@ -108,10 +119,10 @@ namespace Lucene.Net.Util
 
             foreach (SetOnceThread t in threads)
             {
-                if (t.Success)
+                if (t.success)
                 {
                     int expectedVal = Convert.ToInt32(t.Name.Substring(2));
-                    Assert.AreEqual(expectedVal, t.Set.Get(), "thread " + t.Name);
+                    Assert.AreEqual(expectedVal, t.set.Get().value, "thread " + t.Name);
                 }
             }
         }


[06/15] lucenenet git commit: Lucene.Net.Core.Util.PrintStreamInfoStream: Changed back to original implementation that uses AtomicInt32 rather than Interlocked, fixing a bug in the process

Posted by ni...@apache.org.
Lucene.Net.Core.Util.PrintStreamInfoStream: Changed back to original implementation that uses AtomicInt32 rather than Interlocked, fixing a bug in the process


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/d9f979c1
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/d9f979c1
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/d9f979c1

Branch: refs/heads/api-work
Commit: d9f979c1f65ef04d6f98045cae6f4ff81ef33073
Parents: cccf0c5
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 23 23:04:15 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 23 23:04:15 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/PrintStreamInfoStream.cs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d9f979c1/src/Lucene.Net.Core/Util/PrintStreamInfoStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/PrintStreamInfoStream.cs b/src/Lucene.Net.Core/Util/PrintStreamInfoStream.cs
index 7a171d6..ba473db 100644
--- a/src/Lucene.Net.Core/Util/PrintStreamInfoStream.cs
+++ b/src/Lucene.Net.Core/Util/PrintStreamInfoStream.cs
@@ -1,3 +1,4 @@
+using Lucene.Net.Support;
 using System;
 using System.IO;
 using System.Threading;
@@ -30,14 +31,14 @@ namespace Lucene.Net.Util
     public class PrintStreamInfoStream : InfoStream
     {
         // Used for printing messages
-        private static int MESSAGE_ID = 0;
+        private static readonly AtomicInt32 MESSAGE_ID = new AtomicInt32();
 
         protected readonly int m_messageID;
 
         protected readonly TextWriter m_stream;
 
         public PrintStreamInfoStream(TextWriter stream)
-            : this(stream, Interlocked.Increment(ref MESSAGE_ID))
+            : this(stream, MESSAGE_ID.GetAndIncrement())
         {
         }
 


[02/15] lucenenet git commit: BUG: Lucene.Net.TestFramework.Codecs.RAMOnly.RAMOnlyPostingsFormat.FieldsConsumer(): Corrected call to AtomicInt64 from IncrementAndGet() to GetAndIncrement()

Posted by ni...@apache.org.
BUG: Lucene.Net.TestFramework.Codecs.RAMOnly.RAMOnlyPostingsFormat.FieldsConsumer(): Corrected call to AtomicInt64 from IncrementAndGet() to GetAndIncrement()


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/dc04c72c
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/dc04c72c
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/dc04c72c

Branch: refs/heads/api-work
Commit: dc04c72c297be0aab81f1b98466843aa115b10f6
Parents: 6d55c69
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Mar 23 22:32:05 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Mar 23 22:32:05 2017 +0700

----------------------------------------------------------------------
 .../Codecs/RAMOnly/RAMOnlyPostingsFormat.cs                        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/dc04c72c/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs b/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs
index 766e218..712d18d 100644
--- a/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs
@@ -668,7 +668,7 @@ namespace Lucene.Net.Codecs.RAMOnly
 
         public override FieldsConsumer FieldsConsumer(SegmentWriteState writeState)
         {
-            int id = (int)NextID.IncrementAndGet();
+            int id = (int)NextID.GetAndIncrement();
 
             // TODO -- ok to do this up front instead of
             // on close....?  should be ok?