This is an automated email from the ASF dual-hosted git repository.
nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git
The following commit(s) were added to refs/heads/master by this push:
new 2b2f3de Lucene.Net.Spatial.Util.ShapeFieldCache: Removed unnecessary
array allocation
2b2f3de is described below
commit 2b2f3dea7726df97b65cc8011a36c46ff8bbb3d4
Author: Shad Storhaug <[email protected]>
AuthorDate: Mon Aug 3 02:39:51 2020 +0700
Lucene.Net.Spatial.Util.ShapeFieldCache: Removed unnecessary array
allocation
---
src/Lucene.Net.Spatial/Util/ShapeFieldCache.cs | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/src/Lucene.Net.Spatial/Util/ShapeFieldCache.cs
b/src/Lucene.Net.Spatial/Util/ShapeFieldCache.cs
index b57ca75..33f6f50 100644
--- a/src/Lucene.Net.Spatial/Util/ShapeFieldCache.cs
+++ b/src/Lucene.Net.Spatial/Util/ShapeFieldCache.cs
@@ -33,19 +33,12 @@ namespace Lucene.Net.Spatial.Util
public class ShapeFieldCache<T> where T : IShape
{
private readonly IList<T>[] cache;
- public int DefaultLength
- {
- get => defaultLength;
- set => defaultLength = value;
- }
- private int defaultLength;
+ public int DefaultLength { get; set; }
public ShapeFieldCache(int length, int defaultLength)
{
- IList<int> test = new int[66];
-
cache = new IList<T>[length];
- this.defaultLength = defaultLength;
+ this.DefaultLength = defaultLength;
}
public virtual void Add(int docid, T s)
@@ -53,7 +46,7 @@ namespace Lucene.Net.Spatial.Util
IList<T> list = cache[docid];
if (list == null)
{
- list = cache[docid] = new List<T>(defaultLength);
+ list = cache[docid] = new List<T>(DefaultLength);
}
list.Add(s);
}