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/06/22 05:25:12 UTC

[11/38] lucenenet git commit: API: Lucene.Net.Util.PrintStreamInfoStream: Marked obsolete and created TextWriterInfoStream class to replace it, which is more sensible in .NET.

API: Lucene.Net.Util.PrintStreamInfoStream: Marked obsolete and created TextWriterInfoStream class to replace it, which is more sensible in .NET.


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

Branch: refs/heads/master
Commit: a6b5a87fe15f5a7013f0f9b8cc176984686af4e9
Parents: f4dfbb8
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sat Jun 17 13:52:53 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sat Jun 17 13:52:53 2017 +0700

----------------------------------------------------------------------
 .../ThreadedIndexingAndSearchingTestCase.cs     |  4 ++--
 .../Search/ShardSearchingTestBase.cs            |  4 ++--
 .../Util/TestRuleSetupAndRestoreClassEnv.cs     |  2 +-
 .../Index/TestDocInverterPerFieldErrorInfo.cs   |  6 ++---
 .../TestIndexWriterOutOfFileDescriptors.cs      |  4 ++--
 src/Lucene.Net/Index/IndexWriterConfig.cs       |  6 ++---
 src/Lucene.Net/Util/PrintStreamInfoStream.cs    | 25 ++++++++++++++++----
 7 files changed, 34 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6b5a87f/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs b/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
index f386508..31b91a1 100644
--- a/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
@@ -45,7 +45,7 @@ namespace Lucene.Net.Index
 
     using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
     using PhraseQuery = Lucene.Net.Search.PhraseQuery;
-    using PrintStreamInfoStream = Lucene.Net.Util.PrintStreamInfoStream;
+    using TextWriterInfoStream = Lucene.Net.Util.TextWriterInfoStream;
     using Query = Lucene.Net.Search.Query;
     using ScoreDoc = Lucene.Net.Search.ScoreDoc;
     using Sort = Lucene.Net.Search.Sort;
@@ -821,7 +821,7 @@ namespace Lucene.Net.Index
             }
         }
 
-        private class PrintStreamInfoStreamAnonymousInnerClassHelper : PrintStreamInfoStream
+        private class PrintStreamInfoStreamAnonymousInnerClassHelper : TextWriterInfoStream
         {
             private readonly ThreadedIndexingAndSearchingTestCase outerInstance;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6b5a87f/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs b/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs
index dbcfc46..e70ec1a 100644
--- a/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs
+++ b/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs
@@ -33,7 +33,7 @@ namespace Lucene.Net.Search
 
     using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
     using OpenMode = Lucene.Net.Index.OpenMode;
-    using PrintStreamInfoStream = Lucene.Net.Util.PrintStreamInfoStream;
+    using TextWriterInfoStream = Lucene.Net.Util.TextWriterInfoStream;
     using Term = Lucene.Net.Index.Term;
     using TermContext = Lucene.Net.Index.TermContext;
     using TestUtil = Lucene.Net.Util.TestUtil;
@@ -548,7 +548,7 @@ namespace Lucene.Net.Search
                 iwc.SetOpenMode(OpenMode.CREATE);
                 if (VERBOSE)
                 {
-                    iwc.SetInfoStream(new PrintStreamInfoStream(Console.Out));
+                    iwc.SetInfoStream(new TextWriterInfoStream(Console.Out));
                 }
                 Writer = new IndexWriter(Dir, iwc);
                 Mgr = new SearcherManager(Writer, true, null);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6b5a87f/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
index 2c392ec..2766e4b 100644
--- a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
@@ -284,7 +284,7 @@ namespace Lucene.Net.Util
             }
         }
 
-        internal class ThreadNameFixingPrintStreamInfoStream : PrintStreamInfoStream
+        internal class ThreadNameFixingPrintStreamInfoStream : TextWriterInfoStream
         {
             public ThreadNameFixingPrintStreamInfoStream(TextWriter @out)
                 : base(@out)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6b5a87f/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs b/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs
index 64ed379..a01074d 100644
--- a/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs
+++ b/src/Lucene.Net.Tests/Index/TestDocInverterPerFieldErrorInfo.cs
@@ -31,7 +31,7 @@ namespace Lucene.Net.Index
     using FieldType = FieldType;
     using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
     using MockTokenizer = Lucene.Net.Analysis.MockTokenizer;
-    using PrintStreamInfoStream = Lucene.Net.Util.PrintStreamInfoStream;
+    using TextWriterInfoStream = Lucene.Net.Util.TextWriterInfoStream;
     using TextField = TextField;
     using TokenFilter = Lucene.Net.Analysis.TokenFilter;
     using Tokenizer = Lucene.Net.Analysis.Tokenizer;
@@ -93,7 +93,7 @@ namespace Lucene.Net.Index
             IndexWriterConfig c = new IndexWriterConfig(TEST_VERSION_CURRENT, new ThrowingAnalyzer());
             ByteArrayOutputStream infoBytes = new ByteArrayOutputStream();
             StreamWriter infoPrintStream = new StreamWriter(infoBytes, Encoding.UTF8);
-            PrintStreamInfoStream printStreamInfoStream = new PrintStreamInfoStream(infoPrintStream);
+            TextWriterInfoStream printStreamInfoStream = new TextWriterInfoStream(infoPrintStream);
             c.SetInfoStream(printStreamInfoStream);
             writer = new IndexWriter(dir, c);
             Document doc = new Document();
@@ -122,7 +122,7 @@ namespace Lucene.Net.Index
             IndexWriterConfig c = new IndexWriterConfig(TEST_VERSION_CURRENT, new ThrowingAnalyzer());
             ByteArrayOutputStream infoBytes = new ByteArrayOutputStream();
             StreamWriter infoPrintStream = new StreamWriter(infoBytes, Encoding.UTF8);
-            PrintStreamInfoStream printStreamInfoStream = new PrintStreamInfoStream(infoPrintStream);
+            TextWriterInfoStream printStreamInfoStream = new TextWriterInfoStream(infoPrintStream);
             c.SetInfoStream(printStreamInfoStream);
             writer = new IndexWriter(dir, c);
             Document doc = new Document();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6b5a87f/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs
index 517019e..3f33b35 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterOutOfFileDescriptors.cs
@@ -31,7 +31,7 @@ namespace Lucene.Net.Index
 
     using MockAnalyzer = Lucene.Net.Analysis.MockAnalyzer;
     using MockDirectoryWrapper = Lucene.Net.Store.MockDirectoryWrapper;
-    using PrintStreamInfoStream = Lucene.Net.Util.PrintStreamInfoStream;
+    using TextWriterInfoStream = Lucene.Net.Util.TextWriterInfoStream;
     using TestUtil = Lucene.Net.Util.TestUtil;
 
     [TestFixture]
@@ -69,7 +69,7 @@ namespace Lucene.Net.Index
                     {
                         // Do this ourselves instead of relying on LTC so
                         // we see incrementing messageID:
-                        iwc.SetInfoStream(new PrintStreamInfoStream(Console.Out));
+                        iwc.SetInfoStream(new TextWriterInfoStream(Console.Out));
                     }
                     var ms = iwc.MergeScheduler;
                     if (ms is IConcurrentMergeScheduler)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6b5a87f/src/Lucene.Net/Index/IndexWriterConfig.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Index/IndexWriterConfig.cs b/src/Lucene.Net/Index/IndexWriterConfig.cs
index b2ed2b8..300dca3 100644
--- a/src/Lucene.Net/Index/IndexWriterConfig.cs
+++ b/src/Lucene.Net/Index/IndexWriterConfig.cs
@@ -27,7 +27,7 @@ namespace Lucene.Net.Index
     using IndexingChain = Lucene.Net.Index.DocumentsWriterPerThread.IndexingChain;
     using IndexReaderWarmer = Lucene.Net.Index.IndexWriter.IndexReaderWarmer;
     using InfoStream = Lucene.Net.Util.InfoStream;
-    using PrintStreamInfoStream = Lucene.Net.Util.PrintStreamInfoStream;
+    using TextWriterInfoStream = Lucene.Net.Util.TextWriterInfoStream;
     using Similarity = Lucene.Net.Search.Similarities.Similarity;
 
     /// <summary>
@@ -664,7 +664,7 @@ namespace Lucene.Net.Index
         }
 
         /// <summary>
-        /// Convenience method that uses <see cref="PrintStreamInfoStream"/> to write to the passed in <see cref="TextWriter"/>. 
+        /// Convenience method that uses <see cref="TextWriterInfoStream"/> to write to the passed in <see cref="TextWriter"/>. 
         /// Must not be <c>null</c>.
         /// </summary>
         public IndexWriterConfig SetInfoStream(TextWriter printStream)
@@ -673,7 +673,7 @@ namespace Lucene.Net.Index
             {
                 throw new System.ArgumentException("printStream must not be null");
             }
-            return SetInfoStream(new PrintStreamInfoStream(printStream));
+            return SetInfoStream(new TextWriterInfoStream(printStream));
         }
 
         // LUCENENET NOTE: These were only here for casting purposes, but since we are

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a6b5a87f/src/Lucene.Net/Util/PrintStreamInfoStream.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Util/PrintStreamInfoStream.cs b/src/Lucene.Net/Util/PrintStreamInfoStream.cs
index 455e273..ebbb8d3 100644
--- a/src/Lucene.Net/Util/PrintStreamInfoStream.cs
+++ b/src/Lucene.Net/Util/PrintStreamInfoStream.cs
@@ -23,12 +23,29 @@ namespace Lucene.Net.Util
      */
 
     /// <summary>
-    /// InfoStream implementation over a <see cref="TextWriter"/>
+    /// LUCENENET specific stub to assist with migration to <see cref="TextWriterInfoStream"/>.
+    /// </summary>
+    [Obsolete("Use TextWriterInfoStream in .NET. This class is provided only to assist with the transition.")]
+    public class PrintStreamInfoStream : TextWriterInfoStream
+    {
+        public PrintStreamInfoStream(TextWriter stream)
+            : base(stream)
+        { }
+
+        public PrintStreamInfoStream(TextWriter stream, int messageID)
+            : base(stream, messageID)
+        { }
+    }
+
+    /// <summary>
+    /// <see cref="InfoStream"/> implementation over a <see cref="TextWriter"/>
     /// such as <see cref="Console.Out"/>.
     /// <para/>
+    /// NOTE: This is analogous to PrintStreamInfoStream in Lucene.
+    /// <para/>
     /// @lucene.internal
     /// </summary>
-    public class PrintStreamInfoStream : InfoStream // LUCENENET TODO: API - Rename to TextWriterInfoStream
+    public class TextWriterInfoStream : InfoStream
     {
         // Used for printing messages
         private static readonly AtomicInt32 MESSAGE_ID = new AtomicInt32();
@@ -37,12 +54,12 @@ namespace Lucene.Net.Util
 
         protected readonly TextWriter m_stream;
 
-        public PrintStreamInfoStream(TextWriter stream)
+        public TextWriterInfoStream(TextWriter stream)
             : this(stream, MESSAGE_ID.GetAndIncrement())
         {
         }
 
-        public PrintStreamInfoStream(TextWriter stream, int messageID)
+        public TextWriterInfoStream(TextWriter stream, int messageID)
         {
             this.m_stream = stream;
             this.m_messageID = messageID;