lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [23/26] lucenenet git commit: Spatial: Modified member accessibility to match Lucene + fixed issues that were causing compile warnings
Date Fri, 25 Nov 2016 11:07:28 GMT
Spatial: Modified member accessibility to match Lucene + fixed issues that were causing compile
warnings


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

Branch: refs/heads/master
Commit: ad70ad88e1dc9bb948e7255d2c61604f020a6fd9
Parents: aa35405
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Fri Nov 18 01:33:52 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Fri Nov 25 17:58:29 2016 +0700

----------------------------------------------------------------------
 .../Prefix/IntersectsPrefixTreeFilter.cs               | 13 +++++++++++--
 .../Prefix/WithinPrefixTreeFilter.cs                   |  5 +----
 src/Lucene.Net.Spatial/Query/SpatialArgs.cs            |  2 +-
 src/Lucene.Net.Spatial/Query/SpatialArgsParser.cs      |  3 +--
 .../Serialized/SerializedDVStrategy.cs                 |  4 ++--
 src/Lucene.Net.Spatial/SpatialStrategy.cs              |  2 +-
 src/Lucene.Net.Spatial/Util/ValueSourceFilter.cs       |  4 ++--
 src/Lucene.Net.Spatial/Vector/DistanceValueSource.cs   |  2 +-
 src/Lucene.Net.Spatial/Vector/PointVectorStrategy.cs   | 12 ++++++------
 9 files changed, 26 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ad70ad88/src/Lucene.Net.Spatial/Prefix/IntersectsPrefixTreeFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/IntersectsPrefixTreeFilter.cs b/src/Lucene.Net.Spatial/Prefix/IntersectsPrefixTreeFilter.cs
index f3d697b..f5c288d 100644
--- a/src/Lucene.Net.Spatial/Prefix/IntersectsPrefixTreeFilter.cs
+++ b/src/Lucene.Net.Spatial/Prefix/IntersectsPrefixTreeFilter.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Index;
 using Lucene.Net.Search;
 using Lucene.Net.Spatial.Prefix.Tree;
+using Lucene.Net.Support;
 using Lucene.Net.Util;
 using Spatial4n.Core.Shapes;
 
@@ -47,6 +48,16 @@ namespace Lucene.Net.Spatial.Prefix
             return base.Equals(o) && hasIndexedLeaves == ((IntersectsPrefixTreeFilter)o).hasIndexedLeaves;
         }
 
+        /// <summary>
+        /// LUCENENET specific: need to override GetHashCode to 
+        /// prevent a compiler warning and realistically, the hash code
+        /// should work similarly to Equals.
+        /// </summary>
+        public override int GetHashCode()
+        {
+            return HashHelpers.CombineHashCodes(base.GetHashCode(), hasIndexedLeaves.GetHashCode());
+        }
+
         /// <exception cref="System.IO.IOException"></exception>
         public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
         {
@@ -57,13 +68,11 @@ namespace Lucene.Net.Spatial.Prefix
 
         private sealed class _VisitorTemplate_55 : VisitorTemplate
         {
-            private readonly IntersectsPrefixTreeFilter outerInstance;
             private FixedBitSet results;
 
             public _VisitorTemplate_55(IntersectsPrefixTreeFilter outerInstance, AtomicReaderContext
context, Bits acceptDocs, bool hasIndexedLeaves)
                 : base(outerInstance, context, acceptDocs, hasIndexedLeaves)
             {
-                this.outerInstance = outerInstance;
             }
 
             protected internal override void Start()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ad70ad88/src/Lucene.Net.Spatial/Prefix/WithinPrefixTreeFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/WithinPrefixTreeFilter.cs b/src/Lucene.Net.Spatial/Prefix/WithinPrefixTreeFilter.cs
index 8021cd0..f78dfb9 100644
--- a/src/Lucene.Net.Spatial/Prefix/WithinPrefixTreeFilter.cs
+++ b/src/Lucene.Net.Spatial/Prefix/WithinPrefixTreeFilter.cs
@@ -153,8 +153,6 @@ namespace Lucene.Net.Spatial.Prefix
 
         private sealed class _VisitorTemplate_121 : VisitorTemplate
         {
-            private readonly WithinPrefixTreeFilter outerInstance;
-
             private FixedBitSet inside;
             private FixedBitSet outside;
             private SpatialRelation visitRelation;
@@ -163,7 +161,6 @@ namespace Lucene.Net.Spatial.Prefix
                 Bits acceptDocs, bool hasIndexedLeaves)
                 : base(outerInstance, context, acceptDocs, hasIndexedLeaves)
             {
-                this.outerInstance = outerInstance;
             }
 
             protected internal override void Start()
@@ -181,7 +178,7 @@ namespace Lucene.Net.Spatial.Prefix
             protected internal override IEnumerator<Cell> FindSubCellsToVisit(Cell
cell)
             {
                 //use buffered query shape instead of orig.  Works with null too.
-                return cell.GetSubCells(outerInstance.bufferedQueryShape).GetEnumerator();
+                return cell.GetSubCells(((WithinPrefixTreeFilter)outerInstance).bufferedQueryShape).GetEnumerator();
             }
 
             protected internal override bool Visit(Cell cell)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ad70ad88/src/Lucene.Net.Spatial/Query/SpatialArgs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Query/SpatialArgs.cs b/src/Lucene.Net.Spatial/Query/SpatialArgs.cs
index d5921c8..15dc0f1 100644
--- a/src/Lucene.Net.Spatial/Query/SpatialArgs.cs
+++ b/src/Lucene.Net.Spatial/Query/SpatialArgs.cs
@@ -87,7 +87,7 @@ namespace Lucene.Net.Spatial.Queries
         /// <summary>
         /// Check if the arguments make sense -- throw an exception if not
         /// </summary>
-        public void Validate()
+        public virtual void Validate()
         {
             if (Operation.IsTargetNeedsArea && !Shape.HasArea)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ad70ad88/src/Lucene.Net.Spatial/Query/SpatialArgsParser.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Query/SpatialArgsParser.cs b/src/Lucene.Net.Spatial/Query/SpatialArgsParser.cs
index 280ce8e..db0f4ca 100644
--- a/src/Lucene.Net.Spatial/Query/SpatialArgsParser.cs
+++ b/src/Lucene.Net.Spatial/Query/SpatialArgsParser.cs
@@ -73,7 +73,7 @@ namespace Lucene.Net.Spatial.Queries
         /// <exception cref="ArgumentException">if the parameters don't make sense
or an add-on parameter is unknown</exception>
         /// <exception cref="ParseException">If there is a problem parsing the string</exception>
         /// <exception cref="InvalidShapeException">When the coordinates are invalid
for the shape</exception>
-        public SpatialArgs Parse(string v, SpatialContext ctx)
+        public virtual SpatialArgs Parse(string v, SpatialContext ctx)
         {
             int idx = v.IndexOf('(');
             int edx = v.LastIndexOf(')');
@@ -174,6 +174,5 @@ namespace Lucene.Net.Spatial.Queries
 
             return map;
         }
-
     }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ad70ad88/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs b/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
index 33926ee..d85ce1e 100644
--- a/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
+++ b/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
@@ -191,14 +191,14 @@ namespace Lucene.Net.Spatial.Serialized
                         this.acceptDocs = acceptDocs;
                     }
 
-                    public bool Get(int index)
+                    public virtual bool Get(int index)
                     {
                         if (acceptDocs != null && !acceptDocs.Get(index))
                             return false;
                         return predFuncValues.BoolVal(index);
                     }
 
-                    public int Length()
+                    public virtual int Length()
                     {
                         return context.Reader.MaxDoc;
                     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ad70ad88/src/Lucene.Net.Spatial/SpatialStrategy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/SpatialStrategy.cs b/src/Lucene.Net.Spatial/SpatialStrategy.cs
index cc679e2..a9bbde1 100644
--- a/src/Lucene.Net.Spatial/SpatialStrategy.cs
+++ b/src/Lucene.Net.Spatial/SpatialStrategy.cs
@@ -52,7 +52,7 @@ namespace Lucene.Net.Spatial
     public abstract class SpatialStrategy
     {
         protected readonly SpatialContext ctx;
-        protected readonly string fieldName;
+        private readonly string fieldName;
 
         /// <summary>
         /// Constructs the spatial strategy with its mandatory arguments.

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ad70ad88/src/Lucene.Net.Spatial/Util/ValueSourceFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Util/ValueSourceFilter.cs b/src/Lucene.Net.Spatial/Util/ValueSourceFilter.cs
index 32a5bd9..1abfa09 100644
--- a/src/Lucene.Net.Spatial/Util/ValueSourceFilter.cs
+++ b/src/Lucene.Net.Spatial/Util/ValueSourceFilter.cs
@@ -32,8 +32,8 @@ namespace Lucene.Net.Spatial.Util
     {
         //TODO see https://issues.apache.org/jira/browse/LUCENE-4251  (move out of spatial
& improve)
 
-        readonly Filter startingFilter;
-        readonly ValueSource source;
+        internal readonly Filter startingFilter;
+        internal readonly ValueSource source;
         public readonly double min;
         public readonly double max;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ad70ad88/src/Lucene.Net.Spatial/Vector/DistanceValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Vector/DistanceValueSource.cs b/src/Lucene.Net.Spatial/Vector/DistanceValueSource.cs
index 5a4cbd0..6f1dfb6 100644
--- a/src/Lucene.Net.Spatial/Vector/DistanceValueSource.cs
+++ b/src/Lucene.Net.Spatial/Vector/DistanceValueSource.cs
@@ -34,8 +34,8 @@ namespace Lucene.Net.Spatial.Vector
     /// </summary>
     public class DistanceValueSource : ValueSource
     {
-        private readonly IPoint from;
         private readonly PointVectorStrategy strategy;
+        private readonly IPoint from;
         private readonly double multiplier;
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ad70ad88/src/Lucene.Net.Spatial/Vector/PointVectorStrategy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Vector/PointVectorStrategy.cs b/src/Lucene.Net.Spatial/Vector/PointVectorStrategy.cs
index 19c9dc8..3526291 100644
--- a/src/Lucene.Net.Spatial/Vector/PointVectorStrategy.cs
+++ b/src/Lucene.Net.Spatial/Vector/PointVectorStrategy.cs
@@ -44,7 +44,7 @@ namespace Lucene.Net.Spatial.Vector
         private readonly string fieldNameX;
         private readonly string fieldNameY;
 
-        public int precisionStep = 8; // same as solr default
+        private int precisionStep = 8; // same as solr default
 
         public PointVectorStrategy(SpatialContext ctx, string fieldNamePrefix)
             : base(ctx, fieldNamePrefix)
@@ -53,7 +53,7 @@ namespace Lucene.Net.Spatial.Vector
             this.fieldNameY = fieldNamePrefix + SUFFIX_Y;
         }
 
-        public int PrecisionStep
+        public virtual int PrecisionStep
         {
             set
             {
@@ -63,12 +63,12 @@ namespace Lucene.Net.Spatial.Vector
             }
         }
 
-        public string FieldNameX
+        internal virtual string FieldNameX
         {
             get { return fieldNameX; }
         }
 
-        public string FieldNameY
+        internal virtual string FieldNameY
         {
             get { return fieldNameY; }
         }
@@ -85,7 +85,7 @@ namespace Lucene.Net.Spatial.Vector
         /// <summary>
         /// See <see cref="CreateIndexableFields(IShape)"/>
         /// </summary>
-        public Field[] CreateIndexableFields(IPoint point)
+        public virtual Field[] CreateIndexableFields(IPoint point)
         {
             FieldType doubleFieldType = new FieldType(DoubleField.TYPE_NOT_STORED)
             {
@@ -147,7 +147,7 @@ namespace Lucene.Net.Spatial.Vector
         }
 
         //TODO this is basically old code that hasn't been verified well and should probably
be removed
-        public Query MakeQueryDistanceScore(SpatialArgs args)
+        public virtual Query MakeQueryDistanceScore(SpatialArgs args)
         {
             // For starters, just limit the bbox
             var shape = args.Shape;


Mime
View raw message