lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [1/5] lucenenet git commit: Lucene.net.Core.Store (IOContext + RateLimitedDirectoryWrapper): Made UsageContext enum non-nullable
Date Thu, 26 Jan 2017 05:28:07 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/api-work 1ebaad01e -> 53ab67133


Lucene.net.Core.Store (IOContext + RateLimitedDirectoryWrapper): Made UsageContext enum non-nullable


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

Branch: refs/heads/api-work
Commit: fa628285e6a6bdaeb154c4e4f9c530dcb43b0fa6
Parents: 1ebaad0
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Thu Jan 26 10:19:35 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Thu Jan 26 10:19:35 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Store/IOContext.cs                   | 10 +++++-----
 src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa628285/src/Lucene.Net.Core/Store/IOContext.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/IOContext.cs b/src/Lucene.Net.Core/Store/IOContext.cs
index d4e73d9..8573544 100644
--- a/src/Lucene.Net.Core/Store/IOContext.cs
+++ b/src/Lucene.Net.Core/Store/IOContext.cs
@@ -38,13 +38,13 @@ namespace Lucene.Net.Store
             MERGE,
             READ,
             FLUSH,
-            DEFAULT // LUCENENET TODO: Eliminate nullables and make this value 0
+            DEFAULT = 0 // LUCENENET NOTE: 0 is the default for any value type, so when not
initialized, this is the value we get
         }
 
         /// <summary>
         /// An object of a enumerator Context type
         /// </summary>
-        public UsageContext? Context { get; private set; } // LUCENENET TODO: eliminate the
nullable ?
+        public UsageContext Context { get; private set; }
 
         public MergeInfo MergeInfo { get; private set; }
 
@@ -72,7 +72,7 @@ namespace Lucene.Net.Store
             this.FlushInfo = flushInfo;
         }
 
-        public IOContext(UsageContext? context)
+        public IOContext(UsageContext context)
             : this(context, null)
         {
         }
@@ -90,7 +90,7 @@ namespace Lucene.Net.Store
         {
         }
 
-        private IOContext(UsageContext? context, MergeInfo mergeInfo)
+        private IOContext(UsageContext context, MergeInfo mergeInfo)
         {
             Debug.Assert(context != UsageContext.MERGE || mergeInfo != null, "MergeInfo must
not be null if context is MERGE");
             Debug.Assert(context != UsageContext.FLUSH, "Use IOContext(FlushInfo) to create
a FLUSH IOContext");
@@ -116,7 +116,7 @@ namespace Lucene.Net.Store
         {
             const int prime = 31;
             int result = 1;
-            result = prime * result + ((Context == null) ? 0 : Context.GetHashCode());
+            result = prime * result + /*((Context == null) ? 0 :*/ Context.GetHashCode()/*)*/;
// LUCENENET NOTE: Enum can never be null in .NET
             result = prime * result + ((FlushInfo == null) ? 0 : FlushInfo.GetHashCode());
             result = prime * result + ((MergeInfo == null) ? 0 : MergeInfo.GetHashCode());
             result = prime * result + (ReadOnce ? 1231 : 1237);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa628285/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs b/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
index 05b9c7a..d3fa8c0 100644
--- a/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
+++ b/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
@@ -33,7 +33,7 @@ namespace Lucene.Net.Store
         // we need to be volatile here to make sure we see all the values that are set
         // / modified concurrently
         //private volatile RateLimiter[] ContextRateLimiters = new RateLimiter[Enum.GetValues(typeof(IOContext.Context_e)).Length];
-        private readonly IDictionary<IOContext.UsageContext?, RateLimiter> _contextRateLimiters
= new ConcurrentDictionary<IOContext.UsageContext?, RateLimiter>();
+        private readonly IDictionary<IOContext.UsageContext, RateLimiter> _contextRateLimiters
= new ConcurrentDictionary<IOContext.UsageContext, RateLimiter>();
 
         public RateLimitedDirectoryWrapper(Directory wrapped)
             : base(wrapped)
@@ -64,9 +64,9 @@ namespace Lucene.Net.Store
             m_input.Copy(to, src, dest, context);
         }
 
-        private RateLimiter GetRateLimiter(IOContext.UsageContext? context) // LUCENENET
TODO: Can we get rid of the nullable?
+        private RateLimiter GetRateLimiter(IOContext.UsageContext context)
         {
-            Debug.Assert(context != null);
+            //Debug.Assert(context != null); // LUCENENET NOTE: In .NET, enum can never be
null
             RateLimiter ret;
             return _contextRateLimiters.TryGetValue(context, out ret) ? ret : null;
         }
@@ -89,7 +89,7 @@ namespace Lucene.Net.Store
         ///           if context is <code>null</code> </exception>
         /// <exception cref="AlreadyClosedException"> if the <seealso cref="Directory"/>
is already closed
         /// @lucene.experimental </exception>
-        public void SetMaxWriteMBPerSec(double? mbPerSec, IOContext.UsageContext? context)
// LUCENENET TODO: Can we get rid of the nullables?
+        public void SetMaxWriteMBPerSec(double? mbPerSec, IOContext.UsageContext context)
// LUCENENET TODO: Can we get rid of the nullables?
         {
             EnsureOpen();
             if (context == null)


Mime
View raw message