lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [06/37] lucenenet git commit: Lucene.Net.Codecs.BlockTerms.TermsIndexReaderBase refactor: Next > Next(), RamBytesUsed > RamBytesUsed()
Date Sun, 29 Jan 2017 13:27:28 GMT
Lucene.Net.Codecs.BlockTerms.TermsIndexReaderBase refactor: Next > Next(), RamBytesUsed
> RamBytesUsed()


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

Branch: refs/heads/api-work
Commit: 8bdeedc43c8759a8076c61fa228ebf3649bb8e8b
Parents: 2060fbb
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sun Jan 29 14:25:53 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Jan 29 14:25:53 2017 +0700

----------------------------------------------------------------------
 .../BlockTerms/BlockTermsReader.cs              |  4 +--
 .../BlockTerms/FixedGapTermsIndexReader.cs      | 34 ++++++++------------
 .../BlockTerms/TermsIndexReaderBase.cs          |  6 ++--
 .../BlockTerms/VariableGapTermsIndexReader.cs   | 23 ++++++-------
 4 files changed, 29 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8bdeedc4/src/Lucene.Net.Codecs/BlockTerms/BlockTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/BlockTerms/BlockTermsReader.cs b/src/Lucene.Net.Codecs/BlockTerms/BlockTermsReader.cs
index b0bdeed..e427beb 100644
--- a/src/Lucene.Net.Codecs/BlockTerms/BlockTermsReader.cs
+++ b/src/Lucene.Net.Codecs/BlockTerms/BlockTermsReader.cs
@@ -447,7 +447,7 @@ namespace Lucene.Net.Codecs.BlockTerms
                             // Target term is after current term
                             if (!_didIndexNext)
                             {
-                                _nextIndexTerm = _indexEnum.Next == -1 ? null : _indexEnum.Term;
+                                _nextIndexTerm = _indexEnum.Next() == -1 ? null : _indexEnum.Term;
                                 _didIndexNext = true;
                             }
 
@@ -953,7 +953,7 @@ namespace Lucene.Net.Codecs.BlockTerms
         public override long RamBytesUsed()
         {
             var sizeInBytes = (_postingsReader != null) ? _postingsReader.RamBytesUsed()
: 0;
-            sizeInBytes += (_indexReader != null) ? _indexReader.RamBytesUsed : 0;
+            sizeInBytes += (_indexReader != null) ? _indexReader.RamBytesUsed() : 0;
             return sizeInBytes;
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8bdeedc4/src/Lucene.Net.Codecs/BlockTerms/FixedGapTermsIndexReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/BlockTerms/FixedGapTermsIndexReader.cs b/src/Lucene.Net.Codecs/BlockTerms/FixedGapTermsIndexReader.cs
index c1551d8..8804803 100644
--- a/src/Lucene.Net.Codecs/BlockTerms/FixedGapTermsIndexReader.cs
+++ b/src/Lucene.Net.Codecs/BlockTerms/FixedGapTermsIndexReader.cs
@@ -257,23 +257,20 @@ namespace Lucene.Net.Codecs.BlockTerms
                 return _fieldIndex.TermsStart + _fieldIndex.TermsDictOffsets.Get(hi);
             }
 
-            public override long Next // LUCENENET TODO: Make into Next() method
+            public override long Next()
             {
-                get
-                {
-                    var idx = 1 + (int)(ord / _fgtir._totalIndexInterval);
-                    if (idx >= _fieldIndex.NumIndexTerms)
-                        return -1;
+                var idx = 1 + (int)(ord / _fgtir._totalIndexInterval);
+                if (idx >= _fieldIndex.NumIndexTerms)
+                    return -1;
 
-                    ord += _fgtir._totalIndexInterval;
+                ord += _fgtir._totalIndexInterval;
 
-                    var offset = _fieldIndex.TermOffsets.Get(idx);
-                    var length = (int)(_fieldIndex.TermOffsets.Get(1 + idx) - offset);
+                var offset = _fieldIndex.TermOffsets.Get(idx);
+                var length = (int)(_fieldIndex.TermOffsets.Get(1 + idx) - offset);
 
-                    _fgtir._termBytesReader.FillSlice(Term, _fieldIndex.TermBytesStart +
offset, length);
+                _fgtir._termBytesReader.FillSlice(Term, _fieldIndex.TermBytesStart + offset,
length);
 
-                    return _fieldIndex.TermsStart + _fieldIndex.TermsDictOffsets.Get(idx);
-                }
+                return _fieldIndex.TermsStart + _fieldIndex.TermsDictOffsets.Get(idx);
             }
 
             public override long Ord { get { return ord; } }
@@ -522,16 +519,13 @@ namespace Lucene.Net.Codecs.BlockTerms
             input.Seek(dirOffset);
         }
 
-        public override long RamBytesUsed
+        public override long RamBytesUsed()
         {
-            get
-            {
-                var sizeInBytes = ((_termBytes != null) ? _termBytes.RamBytesUsed() : 0)
+
-                                  ((_termBytesReader != null) ? _termBytesReader.RamBytesUsed()
: 0);
+            var sizeInBytes = ((_termBytes != null) ? _termBytes.RamBytesUsed() : 0) +
+                                ((_termBytesReader != null) ? _termBytesReader.RamBytesUsed()
: 0);
 
-                return _fields.Values.Aggregate(sizeInBytes,
-                    (current, entry) => (current + entry.CoreIndex.RamBytesUsed));
-            }
+            return _fields.Values.Aggregate(sizeInBytes,
+                (current, entry) => (current + entry.CoreIndex.RamBytesUsed));
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8bdeedc4/src/Lucene.Net.Codecs/BlockTerms/TermsIndexReaderBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/BlockTerms/TermsIndexReaderBase.cs b/src/Lucene.Net.Codecs/BlockTerms/TermsIndexReaderBase.cs
index 02bff18..76ee43c 100644
--- a/src/Lucene.Net.Codecs/BlockTerms/TermsIndexReaderBase.cs
+++ b/src/Lucene.Net.Codecs/BlockTerms/TermsIndexReaderBase.cs
@@ -59,10 +59,10 @@ namespace Lucene.Net.Codecs.BlockTerms
             /// to term; returns file pointer index (into the main
             /// terms index file) for that term 
             /// </summary>
-            public abstract long Seek(BytesRef term); 
+            public abstract long Seek(BytesRef term);
 
             /// <summary>Returns -1 at end</summary>
-            public abstract long Next { get; } // LUCENENET TODO: Make Next()
+            public abstract long Next();
 
             public abstract BytesRef Term { get; }
 
@@ -80,6 +80,6 @@ namespace Lucene.Net.Codecs.BlockTerms
         }
 
         /// <summary>Returns approximate RAM bytes used</summary>
-        public abstract long RamBytesUsed { get; } // LUCENENET TODO: Make RamBytesUsed()
+        public abstract long RamBytesUsed();
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8bdeedc4/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs b/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs
index 164830b..f6dc09d 100644
--- a/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs
+++ b/src/Lucene.Net.Codecs/BlockTerms/VariableGapTermsIndexReader.cs
@@ -143,29 +143,26 @@ namespace Lucene.Net.Codecs.BlockTerms
             public override long Seek(BytesRef target)
             {
                 _current = _fstEnum.SeekFloor(target);
-                return _current.Output.GetValueOrDefault(); // LUCENENET NOTE: Not sure what
to return if OutPut is null, so we are returning 0
+                return _current.Output.GetValueOrDefault(); // LUCENENET NOTE: Not sure what
to return if Output is null, so we are returning 0
             }
 
-            public override long Next
+            public override long Next()
             {
-                get
-                {
-                    _current = _fstEnum.Next();
-                    if (_current == null)
-                        return -1;
+                _current = _fstEnum.Next();
+                if (_current == null)
+                    return -1;
 
-                    return _current.Output.Value;
-                }
+                return _current.Output.Value;
             }
 
             public override long Ord
             {
-                get { throw new NotImplementedException(); }
+                get { throw new NotSupportedException(); } 
             }
 
             public override long Seek(long ord)
             {
-                throw new NotImplementedException();
+                throw new NotSupportedException();
             }
         }
 
@@ -267,9 +264,9 @@ namespace Lucene.Net.Codecs.BlockTerms
             input.Seek(dirOffset);
         }
 
-        public override long RamBytesUsed
+        public override long RamBytesUsed()
         {
-            get { return _fields.Values.Sum(entry => entry.RamBytesUsed()); }
+            return _fields.Values.Sum(entry => entry.RamBytesUsed());
         }
     }
 }


Mime
View raw message