lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject lucenenet git commit: Cleanup
Date Fri, 16 Jan 2015 14:22:41 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master af14fbcae -> 5eeb32236


Cleanup


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

Branch: refs/heads/master
Commit: 5eeb32236acfdb76ce40818620cd919a380ac71b
Parents: af14fbc
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Fri Jan 16 16:22:29 2015 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Fri Jan 16 16:22:29 2015 +0200

----------------------------------------------------------------------
 src/Lucene.Net.Core/Support/BitSetSupport.cs | 14 +++++++-------
 src/Lucene.Net.Core/Util/DocIdBitSet.cs      |  8 ++++----
 2 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5eeb3223/src/Lucene.Net.Core/Support/BitSetSupport.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/BitSetSupport.cs b/src/Lucene.Net.Core/Support/BitSetSupport.cs
index 8c66cac..dfd4e4e 100644
--- a/src/Lucene.Net.Core/Support/BitSetSupport.cs
+++ b/src/Lucene.Net.Core/Support/BitSetSupport.cs
@@ -82,9 +82,9 @@ namespace Lucene.Net.Support
         // Produces a bitwise-or of the two BitArrays without requiring they be the same
length
         public static BitArray Or_UnequalLengths(this BitArray bitsA, BitArray bitsB)
         {
-            BitArray shorter = bitsA.Length < bitsB.Length ? bitsA : bitsB;
-            BitArray longer = bitsA.Length >= bitsB.Length ? bitsA : bitsB;
-            BitArray bits = new BitArray(longer.Length);
+            var shorter = bitsA.Length < bitsB.Length ? bitsA : bitsB;
+            var longer = bitsA.Length >= bitsB.Length ? bitsA : bitsB;
+            var bits = new BitArray(longer.Length);
             for (int i = 0; i < longer.Length; i++)
             {
                 if (i >= shorter.Length)
@@ -103,9 +103,9 @@ namespace Lucene.Net.Support
         // Produces a bitwise-xor of the two BitArrays without requiring they be the same
length
         public static BitArray Xor_UnequalLengths(this BitArray bitsA, BitArray bitsB)
         {
-            BitArray shorter = bitsA.Length < bitsB.Length ? bitsA : bitsB;
-            BitArray longer = bitsA.Length >= bitsB.Length ? bitsA : bitsB;
-            BitArray bits = new BitArray(longer.Length);
+            var shorter = bitsA.Length < bitsB.Length ? bitsA : bitsB;
+            var longer = bitsA.Length >= bitsB.Length ? bitsA : bitsB;
+            var bits = new BitArray(longer.Length);
             for (int i = 0; i < longer.Length; i++)
             {
                 if (i >= shorter.Length)
@@ -233,7 +233,7 @@ namespace Lucene.Net.Support
         // Prevents exceptions from being thrown when the index is too high.
         public static bool SafeGet(this BitArray a, int loc)
         {
-            return loc >= a.Count ? false : a.Get(loc);
+            return loc < a.Count && a.Get(loc);
         }
 
         //Emulates the Java BitSet.Set() method. Required to reconcile differences between
Java BitSet and C# BitArray

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5eeb3223/src/Lucene.Net.Core/Util/DocIdBitSet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/DocIdBitSet.cs b/src/Lucene.Net.Core/Util/DocIdBitSet.cs
index 2c71cbb..6a08161 100644
--- a/src/Lucene.Net.Core/Util/DocIdBitSet.cs
+++ b/src/Lucene.Net.Core/Util/DocIdBitSet.cs
@@ -79,8 +79,8 @@ namespace Lucene.Net.Util
 
         private class DocIdBitSetIterator : DocIdSetIterator
         {
-            internal int DocId;
-            internal BitArray bitSet;
+            private int DocId;
+            private readonly BitArray bitSet;
 
             internal DocIdBitSetIterator(BitArray bitSet)
             {
@@ -96,7 +96,7 @@ namespace Lucene.Net.Util
             public override int NextDoc()
             {
                 // (docId + 1) on next line requires -1 initial value for docNr:
-                int d = BitSetSupport.NextSetBit(bitSet, DocId + 1);
+                var d = bitSet.NextSetBit(DocId + 1);
                 // -1 returned by BitSet.nextSetBit() when exhausted
                 DocId = d == -1 ? NO_MORE_DOCS : d;
                 return DocId;
@@ -104,7 +104,7 @@ namespace Lucene.Net.Util
 
             public override int Advance(int target)
             {
-                int d = BitSetSupport.NextSetBit(bitSet, target);
+                int d = bitSet.NextSetBit(target);
                 // -1 returned by BitSet.nextSetBit() when exhausted
                 DocId = d == -1 ? NO_MORE_DOCS : d;
                 return DocId;


Mime
View raw message