lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [1/3] lucenenet git commit: init bytesref on each iteration
Date Sat, 11 Apr 2015 18:48:21 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master 31a43f02a -> c83d8e80a


init bytesref on each iteration


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

Branch: refs/heads/master
Commit: 07648a3b20ea9055bbae91cc5cf529c8fe1fc3f3
Parents: 31a43f0
Author: Laimonas Simutis <laimis@gmail.com>
Authored: Sat Apr 11 09:01:53 2015 -0400
Committer: Laimonas Simutis <laimis@gmail.com>
Committed: Sat Apr 11 09:01:53 2015 -0400

----------------------------------------------------------------------
 .../Index/BinaryDocValuesWriter.cs              | 115 +------------------
 1 file changed, 2 insertions(+), 113 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/07648a3b/src/Lucene.Net.Core/Index/BinaryDocValuesWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/BinaryDocValuesWriter.cs b/src/Lucene.Net.Core/Index/BinaryDocValuesWriter.cs
index a1b527d..ee460e4 100644
--- a/src/Lucene.Net.Core/Index/BinaryDocValuesWriter.cs
+++ b/src/Lucene.Net.Core/Index/BinaryDocValuesWriter.cs
@@ -128,28 +128,8 @@ namespace Lucene.Net.Index
             int maxDoc = state.SegmentInfo.DocCount;
             Bytes.Freeze(false);
             dvConsumer.AddBinaryField(FieldInfo, GetBytesIterator(maxDoc));
-            //dvConsumer.AddBinaryField(FieldInfo, new IterableAnonymousInnerClassHelper(this,
maxDoc));
         }
 
-        /*
-	  private class IterableAnonymousInnerClassHelper : IEnumerable<BytesRef>
-	  {
-		  private readonly BinaryDocValuesWriter OuterInstance;
-
-		  private int MaxDoc;
-
-		  public IterableAnonymousInnerClassHelper(BinaryDocValuesWriter outerInstance, int maxDoc)
-		  {
-			  this.OuterInstance = outerInstance;
-			  this.MaxDoc = maxDoc;
-		  }
-
-		  public virtual IEnumerator<BytesRef> GetEnumerator()
-		  {
-			 return new BytesIterator(OuterInstance, MaxDoc);
-		  }
-	  }*/
-
         internal override void Abort()
         {
         }
@@ -158,7 +138,6 @@ namespace Lucene.Net.Index
         {
             // Use yield return instead of ucsom IEnumerable
 
-            BytesRef value = new BytesRef();
             AppendingDeltaPackedLongBuffer.Iterator lengthsIterator = Lengths.GetIterator();
             int size = (int)Lengths.Size();
             DataInput bytesIterator = Bytes.DataInput;
@@ -167,10 +146,11 @@ namespace Lucene.Net.Index
 
             while (upto < maxDoc)
             {
-                BytesRef v;
+                BytesRef v = null;
                 if (upto < size)
                 {
                     int length = (int)lengthsIterator.Next();
+                    var value = new BytesRef();
                     value.Grow(length);
                     value.Length = length;
                     bytesIterator.ReadBytes(value.Bytes, value.Offset, value.Length);
@@ -179,102 +159,11 @@ namespace Lucene.Net.Index
                     {
                         v = value;
                     }
-                    else
-                    {
-                        v = null;
-                    }
-                }
-                else
-                {
-                    v = null;
                 }
 
                 upto++;
                 yield return v;
             }
         }
-
-        /*
-	  // iterates over the values we have in ram
-	  private class BytesIterator : IEnumerator<BytesRef>
-	  {
-		  internal bool InstanceFieldsInitialized = false;
-
-		  internal virtual void InitializeInstanceFields()
-		  {
-			  LengthsIterator = OuterInstance.Lengths.Iterator();
-              BytesIterator_Renamed = OuterInstance.Bytes.DataInput;
-              Size = (int)OuterInstance.Lengths.Size();
-		  }
-
-		  private readonly BinaryDocValuesWriter OuterInstance;
-
-		internal readonly BytesRef Value = new BytesRef();
-		internal AppendingDeltaPackedLongBuffer.Iterator LengthsIterator;
-		internal DataInput BytesIterator_Renamed;
-		internal int Size;
-		internal readonly int MaxDoc;
-		internal int Upto;
-
-		internal BytesIterator(BinaryDocValuesWriter outerInstance, int maxDoc)
-		{
-			this.OuterInstance = outerInstance;
-
-			if (!InstanceFieldsInitialized)
-			{
-				InitializeInstanceFields();
-				InstanceFieldsInitialized = true;
-			}
-		  this.MaxDoc = maxDoc;
-		}
-
-		public override bool HasNext()
-		{
-		  return Upto < MaxDoc;
-		}
-
-		public override BytesRef Next()
-		{
-		  if (!HasNext())
-		  {
-			throw new NoSuchElementException();
-		  }
-		  BytesRef v;
-		  if (Upto < Size)
-		  {
-			int length = (int) LengthsIterator.Next();
-			Value.Grow(length);
-			Value.Length = length;
-			try
-			{
-			  BytesIterator_Renamed.ReadBytes(Value.Bytes, Value.Offset, Value.Length);
-			}
-			catch (System.IO.IOException ioe)
-			{
-			  // Should never happen!
-			  throw new Exception(ioe.ToString(), ioe);
-			}
-            if (OuterInstance.DocsWithField.Get(Upto))
-			{
-			  v = Value;
-			}
-			else
-			{
-			  v = null;
-			}
-		  }
-		  else
-		  {
-			v = null;
-		  }
-		  Upto++;
-		  return v;
-		}
-
-		public override void Remove()
-		{
-		  throw new System.NotSupportedException();
-		}
-	  }*/
     }
 }
\ No newline at end of file


Mime
View raw message