You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/01/31 17:56:20 UTC
[47/50] [abbrv] lucenenet git commit: Lucene.Net.Spatial refactor:
Renamed protected fields camelCase prefixed with m_
Lucene.Net.Spatial refactor: Renamed protected fields camelCase prefixed with m_
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/22daadab
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/22daadab
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/22daadab
Branch: refs/heads/api-work
Commit: 22daadab747c248dfed74bf5da406b28924e7e94
Parents: 18f6f7c
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Feb 1 00:10:28 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Wed Feb 1 00:10:28 2017 +0700
----------------------------------------------------------------------
.../Prefix/AbstractPrefixTreeFilter.cs | 58 ++++++++++----------
.../Prefix/AbstractVisitingPrefixTreeFilter.cs | 42 +++++++-------
.../Prefix/ContainsPrefixTreeFilter.cs | 40 +++++++-------
.../Prefix/IntersectsPrefixTreeFilter.cs | 6 +-
.../Prefix/PrefixTreeStrategy.cs | 30 +++++-----
.../Prefix/RecursivePrefixTreeStrategy.cs | 20 +++----
.../Prefix/TermQueryPrefixTreeStrategy.cs | 4 +-
src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs | 26 ++++-----
.../Prefix/Tree/GeohashPrefixTree.cs | 16 +++---
.../Prefix/Tree/QuadPrefixTree.cs | 26 ++++-----
.../Prefix/Tree/SpatialPrefixTree.cs | 18 +++---
.../Prefix/Tree/SpatialPrefixTreeFactory.cs | 20 +++----
.../Prefix/WithinPrefixTreeFilter.cs | 20 +++----
.../Serialized/SerializedDVStrategy.cs | 6 +-
src/Lucene.Net.Spatial/SpatialStrategy.cs | 12 ++--
.../Util/CachingDoubleValueSource.cs | 18 +++---
.../Util/ShapeFieldCacheProvider.cs | 12 ++--
17 files changed, 187 insertions(+), 187 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/src/Lucene.Net.Spatial/Prefix/AbstractPrefixTreeFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/AbstractPrefixTreeFilter.cs b/src/Lucene.Net.Spatial/Prefix/AbstractPrefixTreeFilter.cs
index bd50961..1df2ee2 100644
--- a/src/Lucene.Net.Spatial/Prefix/AbstractPrefixTreeFilter.cs
+++ b/src/Lucene.Net.Spatial/Prefix/AbstractPrefixTreeFilter.cs
@@ -30,17 +30,17 @@ namespace Lucene.Net.Spatial.Prefix
/// </summary>
public abstract class AbstractPrefixTreeFilter : Filter
{
- protected internal readonly IShape queryShape;
- protected internal readonly string fieldName;
- protected internal readonly SpatialPrefixTree grid;//not in equals/hashCode since it's implied for a specific field
- protected internal readonly int detailLevel;
+ protected internal readonly IShape m_queryShape;
+ protected internal readonly string m_fieldName;
+ protected internal readonly SpatialPrefixTree m_grid;//not in equals/hashCode since it's implied for a specific field
+ protected internal readonly int m_detailLevel;
public AbstractPrefixTreeFilter(IShape queryShape, string fieldName, SpatialPrefixTree grid, int detailLevel)
{
- this.queryShape = queryShape;
- this.fieldName = fieldName;
- this.grid = grid;
- this.detailLevel = detailLevel;
+ this.m_queryShape = queryShape;
+ this.m_fieldName = fieldName;
+ this.m_grid = grid;
+ this.m_detailLevel = detailLevel;
}
public override bool Equals(object o)
@@ -54,15 +54,15 @@ namespace Lucene.Net.Spatial.Prefix
return false;
}
var that = (AbstractPrefixTreeFilter)o;
- if (detailLevel != that.detailLevel)
+ if (m_detailLevel != that.m_detailLevel)
{
return false;
}
- if (!fieldName.Equals(that.fieldName))
+ if (!m_fieldName.Equals(that.m_fieldName))
{
return false;
}
- if (!queryShape.Equals(that.queryShape))
+ if (!m_queryShape.Equals(that.m_queryShape))
{
return false;
}
@@ -71,9 +71,9 @@ namespace Lucene.Net.Spatial.Prefix
public override int GetHashCode()
{
- int result = queryShape.GetHashCode();
- result = 31 * result + fieldName.GetHashCode();
- result = 31 * result + detailLevel;
+ int result = m_queryShape.GetHashCode();
+ result = 31 * result + m_fieldName.GetHashCode();
+ result = 31 * result + m_detailLevel;
return result;
}
@@ -85,36 +85,36 @@ namespace Lucene.Net.Spatial.Prefix
/// </summary>
public abstract class BaseTermsEnumTraverser
{
- protected readonly AbstractPrefixTreeFilter outerInstance;
- protected readonly AtomicReaderContext context;
- protected IBits acceptDocs;
- protected readonly int maxDoc;
+ protected readonly AbstractPrefixTreeFilter m_outerInstance;
+ protected readonly AtomicReaderContext m_context;
+ protected IBits m_acceptDocs;
+ protected readonly int m_maxDoc;
- protected TermsEnum termsEnum;//remember to check for null in getDocIdSet
- protected DocsEnum docsEnum;
+ protected TermsEnum m_termsEnum;//remember to check for null in getDocIdSet
+ protected DocsEnum m_docsEnum;
public BaseTermsEnumTraverser(AbstractPrefixTreeFilter outerInstance, AtomicReaderContext context, IBits acceptDocs)
{
- this.outerInstance = outerInstance;
+ this.m_outerInstance = outerInstance;
- this.context = context;
+ this.m_context = context;
AtomicReader reader = context.AtomicReader;
- this.acceptDocs = acceptDocs;
- maxDoc = reader.MaxDoc;
- Terms terms = reader.Terms(outerInstance.fieldName);
+ this.m_acceptDocs = acceptDocs;
+ m_maxDoc = reader.MaxDoc;
+ Terms terms = reader.Terms(outerInstance.m_fieldName);
if (terms != null)
{
- termsEnum = terms.GetIterator(null);
+ m_termsEnum = terms.GetIterator(null);
}
}
protected virtual void CollectDocs(FixedBitSet bitSet)
{
//WARN: keep this specialization in sync
- Debug.Assert(termsEnum != null);
- docsEnum = termsEnum.Docs(acceptDocs, docsEnum, DocsEnum.FLAG_NONE);
+ Debug.Assert(m_termsEnum != null);
+ m_docsEnum = m_termsEnum.Docs(m_acceptDocs, m_docsEnum, DocsEnum.FLAG_NONE);
int docid;
- while ((docid = docsEnum.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
+ while ((docid = m_docsEnum.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
{
bitSet.Set(docid);
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/src/Lucene.Net.Spatial/Prefix/AbstractVisitingPrefixTreeFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/AbstractVisitingPrefixTreeFilter.cs b/src/Lucene.Net.Spatial/Prefix/AbstractVisitingPrefixTreeFilter.cs
index 0c89180..d4a58e9 100644
--- a/src/Lucene.Net.Spatial/Prefix/AbstractVisitingPrefixTreeFilter.cs
+++ b/src/Lucene.Net.Spatial/Prefix/AbstractVisitingPrefixTreeFilter.cs
@@ -43,13 +43,13 @@ namespace Lucene.Net.Spatial.Prefix
// Historical note: this code resulted from a refactoring of RecursivePrefixTreeFilter,
// which in turn came out of SOLR-2155
- protected internal readonly int prefixGridScanLevel;//at least one less than grid.getMaxLevels()
+ protected readonly int m_prefixGridScanLevel;//at least one less than grid.getMaxLevels()
public AbstractVisitingPrefixTreeFilter(IShape queryShape, string fieldName, SpatialPrefixTree grid,
int detailLevel, int prefixGridScanLevel)
: base(queryShape, fieldName, grid, detailLevel)
{
- this.prefixGridScanLevel = Math.Max(0, Math.Min(prefixGridScanLevel, grid.MaxLevels - 1));
+ this.m_prefixGridScanLevel = Math.Max(0, Math.Min(prefixGridScanLevel, grid.MaxLevels - 1));
Debug.Assert(detailLevel <= grid.MaxLevels);
}
@@ -116,7 +116,7 @@ namespace Lucene.Net.Spatial.Prefix
*/
- protected internal readonly bool hasIndexedLeaves;//if false then we can skip looking for them
+ protected readonly bool m_hasIndexedLeaves;//if false then we can skip looking for them
private VNode curVNode;//current pointer, derived from query shape
private BytesRef curVNodeTerm = new BytesRef();//curVNode.cell's term.
@@ -128,24 +128,24 @@ namespace Lucene.Net.Spatial.Prefix
bool hasIndexedLeaves)
: base(outerInstance, context, acceptDocs)
{
- this.hasIndexedLeaves = hasIndexedLeaves;
+ this.m_hasIndexedLeaves = hasIndexedLeaves;
}
public virtual DocIdSet GetDocIdSet()
{
Debug.Assert(curVNode == null, "Called more than once?");
- if (termsEnum == null)
+ if (m_termsEnum == null)
{
return null;
}
//advance
- if ((thisTerm = termsEnum.Next()) == null)
+ if ((thisTerm = m_termsEnum.Next()) == null)
{
return null;// all done
}
curVNode = new VNode(null);
- curVNode.Reset(outerInstance.grid.WorldCell);
+ curVNode.Reset(m_outerInstance.m_grid.WorldCell);
Start();
@@ -200,23 +200,23 @@ namespace Lucene.Net.Spatial.Prefix
//Seek to curVNode's cell (or skip if termsEnum has moved beyond)
curVNodeTerm.Bytes = curVNode.cell.GetTokenBytes();
curVNodeTerm.Length = curVNodeTerm.Bytes.Length;
- int compare = termsEnum.Comparer.Compare(thisTerm, curVNodeTerm);
+ int compare = m_termsEnum.Comparer.Compare(thisTerm, curVNodeTerm);
if (compare > 0)
{
// leap frog (termsEnum is beyond where we would otherwise seek)
- Debug.Assert(!context.AtomicReader.Terms(outerInstance.fieldName).GetIterator(null).SeekExact(curVNodeTerm), "should be absent");
+ Debug.Assert(!m_context.AtomicReader.Terms(m_outerInstance.m_fieldName).GetIterator(null).SeekExact(curVNodeTerm), "should be absent");
}
else
{
if (compare < 0)
{
// Seek !
- TermsEnum.SeekStatus seekStatus = termsEnum.SeekCeil(curVNodeTerm);
+ TermsEnum.SeekStatus seekStatus = m_termsEnum.SeekCeil(curVNodeTerm);
if (seekStatus == TermsEnum.SeekStatus.END)
{
break;// all done
}
- thisTerm = termsEnum.Term;
+ thisTerm = m_termsEnum.Term;
if (seekStatus == TermsEnum.SeekStatus.NOT_FOUND)
{
continue; // leap frog
@@ -225,7 +225,7 @@ namespace Lucene.Net.Spatial.Prefix
// Visit!
bool descend = Visit(curVNode.cell);
//advance
- if ((thisTerm = termsEnum.Next()) == null)
+ if ((thisTerm = m_termsEnum.Next()) == null)
{
break;// all done
}
@@ -250,22 +250,22 @@ namespace Lucene.Net.Spatial.Prefix
{
Debug.Assert(thisTerm != null);
Cell cell = curVNode.cell;
- if (cell.Level >= outerInstance.detailLevel)
+ if (cell.Level >= m_outerInstance.m_detailLevel)
{
throw new InvalidOperationException("Spatial logic error");
}
//Check for adjacent leaf (happens for indexed non-point shapes)
- if (hasIndexedLeaves && cell.Level != 0)
+ if (m_hasIndexedLeaves && cell.Level != 0)
{
//If the next indexed term just adds a leaf marker ('+') to cell,
// then add all of those docs
Debug.Assert(StringHelper.StartsWith(thisTerm, curVNodeTerm));//TODO refactor to use method on curVNode.cell
- scanCell = outerInstance.grid.GetCell(thisTerm.Bytes, thisTerm.Offset, thisTerm.Length, scanCell);
+ scanCell = m_outerInstance.m_grid.GetCell(thisTerm.Bytes, thisTerm.Offset, thisTerm.Length, scanCell);
if (scanCell.Level == cell.Level && scanCell.IsLeaf)
{
VisitLeaf(scanCell);
//advance
- if ((thisTerm = termsEnum.Next()) == null)
+ if ((thisTerm = m_termsEnum.Next()) == null)
{
return;// all done
}
@@ -277,7 +277,7 @@ namespace Lucene.Net.Spatial.Prefix
// Scanning is a performance optimization trade-off.
//TODO use termsEnum.docFreq() as heuristic
- bool scan = cell.Level >= ((AbstractVisitingPrefixTreeFilter)outerInstance).prefixGridScanLevel;//simple heuristic
+ bool scan = cell.Level >= ((AbstractVisitingPrefixTreeFilter)m_outerInstance).m_prefixGridScanLevel;//simple heuristic
if (!scan)
{
@@ -294,7 +294,7 @@ namespace Lucene.Net.Spatial.Prefix
{
//Scan (loop of termsEnum.next())
- Scan(outerInstance.detailLevel);
+ Scan(m_outerInstance.m_detailLevel);
}
}
@@ -306,7 +306,7 @@ namespace Lucene.Net.Spatial.Prefix
/// </summary>
protected internal virtual IEnumerator<Cell> FindSubCellsToVisit(Cell cell)
{
- return cell.GetSubCells(outerInstance.queryShape).GetEnumerator();
+ return cell.GetSubCells(m_outerInstance.m_queryShape).GetEnumerator();
}
/// <summary>
@@ -320,9 +320,9 @@ namespace Lucene.Net.Spatial.Prefix
{
for (;
thisTerm != null && StringHelper.StartsWith(thisTerm, curVNodeTerm);//TODO refactor to use method on curVNode.cell
- thisTerm = termsEnum.Next())
+ thisTerm = m_termsEnum.Next())
{
- scanCell = outerInstance.grid.GetCell(thisTerm.Bytes, thisTerm.Offset, thisTerm.Length, scanCell);
+ scanCell = m_outerInstance.m_grid.GetCell(thisTerm.Bytes, thisTerm.Offset, thisTerm.Length, scanCell);
int termLevel = scanCell.Level;
if (termLevel < scanDetailLevel)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/src/Lucene.Net.Spatial/Prefix/ContainsPrefixTreeFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/ContainsPrefixTreeFilter.cs b/src/Lucene.Net.Spatial/Prefix/ContainsPrefixTreeFilter.cs
index d7a7542..2a42f28 100644
--- a/src/Lucene.Net.Spatial/Prefix/ContainsPrefixTreeFilter.cs
+++ b/src/Lucene.Net.Spatial/Prefix/ContainsPrefixTreeFilter.cs
@@ -44,29 +44,29 @@ namespace Lucene.Net.Spatial.Prefix
/// increase performance if you don't care about that circumstance (such as if your indexed
/// data doesn't even have such conditions). See LUCENE-5062.
/// </summary>
- protected readonly bool multiOverlappingIndexedShapes;
+ protected readonly bool m_multiOverlappingIndexedShapes;
public ContainsPrefixTreeFilter(IShape queryShape, string fieldName, SpatialPrefixTree grid, int detailLevel, bool multiOverlappingIndexedShapes)
: base(queryShape, fieldName, grid, detailLevel)
{
- this.multiOverlappingIndexedShapes = multiOverlappingIndexedShapes;
+ this.m_multiOverlappingIndexedShapes = multiOverlappingIndexedShapes;
}
public override bool Equals(object o)
{
if (!base.Equals(o))
return false;
- return multiOverlappingIndexedShapes == ((ContainsPrefixTreeFilter)o).multiOverlappingIndexedShapes;
+ return m_multiOverlappingIndexedShapes == ((ContainsPrefixTreeFilter)o).m_multiOverlappingIndexedShapes;
}
public override int GetHashCode()
{
- return base.GetHashCode() + (multiOverlappingIndexedShapes ? 1 : 0);
+ return base.GetHashCode() + (m_multiOverlappingIndexedShapes ? 1 : 0);
}
public override DocIdSet GetDocIdSet(AtomicReaderContext context, IBits acceptDocs)
{
- return new ContainsVisitor(this, context, acceptDocs).Visit(grid.WorldCell, acceptDocs);
+ return new ContainsVisitor(this, context, acceptDocs).Visit(m_grid.WorldCell, acceptDocs);
}
private class ContainsVisitor : BaseTermsEnumTraverser
@@ -83,24 +83,24 @@ namespace Lucene.Net.Spatial.Prefix
/// <exception cref="System.IO.IOException"></exception>
internal SmallDocSet Visit(Cell cell, IBits acceptContains)
{
- if (termsEnum == null)
+ if (m_termsEnum == null)
{
//signals all done
return null;
}
- ContainsPrefixTreeFilter outerInstance = (ContainsPrefixTreeFilter)base.outerInstance;
+ ContainsPrefixTreeFilter outerInstance = (ContainsPrefixTreeFilter)base.m_outerInstance;
//Leaf docs match all query shape
SmallDocSet leafDocs = GetLeafDocs(cell, acceptContains);
// Get the AND of all child results (into combinedSubResults)
SmallDocSet combinedSubResults = null;
// Optimization: use null subCellsFilter when we know cell is within the query shape.
- IShape subCellsFilter = outerInstance.queryShape;
+ IShape subCellsFilter = outerInstance.m_queryShape;
if (cell.Level != 0 && ((cell.ShapeRel == SpatialRelation.NOT_SET || cell.ShapeRel == SpatialRelation.WITHIN)))
{
subCellsFilter = null;
- Debug.Assert(cell.Shape.Relate(outerInstance.queryShape) == SpatialRelation.WITHIN);
+ Debug.Assert(cell.Shape.Relate(outerInstance.m_queryShape) == SpatialRelation.WITHIN);
}
ICollection<Cell> subCells = cell.GetSubCells(subCellsFilter);
foreach (Cell subCell in subCells)
@@ -109,11 +109,11 @@ namespace Lucene.Net.Spatial.Prefix
{
combinedSubResults = null;
}
- else if (subCell.Level == outerInstance.detailLevel)
+ else if (subCell.Level == outerInstance.m_detailLevel)
{
combinedSubResults = GetDocs(subCell, acceptContains);
}
- else if (!outerInstance.multiOverlappingIndexedShapes &&
+ else if (!outerInstance.m_multiOverlappingIndexedShapes &&
subCell.ShapeRel == SpatialRelation.WITHIN)
{
combinedSubResults = GetLeafDocs(subCell, acceptContains); //recursion
@@ -148,9 +148,9 @@ namespace Lucene.Net.Spatial.Prefix
Debug.Assert(new BytesRef(cell.GetTokenBytes()).CompareTo(termBytes) > 0);
this.termBytes.Bytes = cell.GetTokenBytes();
this.termBytes.Length = this.termBytes.Bytes.Length;
- if (termsEnum == null)
+ if (m_termsEnum == null)
return false;
- return this.termsEnum.SeekExact(termBytes);
+ return this.m_termsEnum.SeekExact(termBytes);
}
private SmallDocSet GetDocs(Cell cell, IBits acceptContains)
@@ -167,15 +167,15 @@ namespace Lucene.Net.Spatial.Prefix
Debug.Assert(!leafCell.Equals(lastLeaf));//don't call for same leaf again
lastLeaf = leafCell;
- if (termsEnum == null)
+ if (m_termsEnum == null)
return null;
- BytesRef nextTerm = this.termsEnum.Next();
+ BytesRef nextTerm = this.m_termsEnum.Next();
if (nextTerm == null)
{
- termsEnum = null;//signals all done
+ m_termsEnum = null;//signals all done
return null;
}
- nextCell = outerInstance.grid.GetCell(nextTerm.Bytes, nextTerm.Offset, nextTerm.Length, this.nextCell);
+ nextCell = m_outerInstance.m_grid.GetCell(nextTerm.Bytes, nextTerm.Offset, nextTerm.Length, this.nextCell);
if (nextCell.Level == leafCell.Level && nextCell.IsLeaf)
{
return CollectDocs(acceptContains);
@@ -190,13 +190,13 @@ namespace Lucene.Net.Spatial.Prefix
{
SmallDocSet set = null;
- docsEnum = termsEnum.Docs(acceptContains, docsEnum, DocsEnum.FLAG_NONE);
+ m_docsEnum = m_termsEnum.Docs(acceptContains, m_docsEnum, DocsEnum.FLAG_NONE);
int docid;
- while ((docid = docsEnum.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
+ while ((docid = m_docsEnum.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
{
if (set == null)
{
- int size = this.termsEnum.DocFreq;
+ int size = this.m_termsEnum.DocFreq;
if (size <= 0)
{
size = 16;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/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 388b3f4..a32e3ef 100644
--- a/src/Lucene.Net.Spatial/Prefix/IntersectsPrefixTreeFilter.cs
+++ b/src/Lucene.Net.Spatial/Prefix/IntersectsPrefixTreeFilter.cs
@@ -76,7 +76,7 @@ namespace Lucene.Net.Spatial.Prefix
protected internal override void Start()
{
- results = new FixedBitSet(maxDoc);
+ results = new FixedBitSet(m_maxDoc);
}
protected internal override DocIdSet Finish()
@@ -86,7 +86,7 @@ namespace Lucene.Net.Spatial.Prefix
protected internal override bool Visit(Cell cell)
{
- if (cell.ShapeRel == SpatialRelation.WITHIN || cell.Level == outerInstance.detailLevel)
+ if (cell.ShapeRel == SpatialRelation.WITHIN || cell.Level == m_outerInstance.m_detailLevel)
{
CollectDocs(results);
return false;
@@ -101,7 +101,7 @@ namespace Lucene.Net.Spatial.Prefix
protected internal override void VisitScanned(Cell cell)
{
- if (outerInstance.queryShape.Relate(cell.Shape).Intersects())
+ if (m_outerInstance.m_queryShape.Relate(cell.Shape).Intersects())
{
CollectDocs(results);
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/src/Lucene.Net.Spatial/Prefix/PrefixTreeStrategy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/PrefixTreeStrategy.cs b/src/Lucene.Net.Spatial/Prefix/PrefixTreeStrategy.cs
index 9cacb85..c010a3d 100644
--- a/src/Lucene.Net.Spatial/Prefix/PrefixTreeStrategy.cs
+++ b/src/Lucene.Net.Spatial/Prefix/PrefixTreeStrategy.cs
@@ -76,20 +76,20 @@ namespace Lucene.Net.Spatial.Prefix
/// </summary>
public abstract class PrefixTreeStrategy : SpatialStrategy
{
- protected internal readonly SpatialPrefixTree grid;
+ protected readonly SpatialPrefixTree m_grid;
private readonly ConcurrentDictionary<string, PointPrefixTreeFieldCacheProvider> provider =
new ConcurrentDictionary<string, PointPrefixTreeFieldCacheProvider>();
- protected internal readonly bool simplifyIndexedCells;
- protected internal int defaultFieldValuesArrayLen = 2;
- protected internal double distErrPct = SpatialArgs.DEFAULT_DISTERRPCT;// [ 0 TO 0.5 ]
+ protected readonly bool m_simplifyIndexedCells;
+ protected int m_defaultFieldValuesArrayLen = 2;
+ protected double m_distErrPct = SpatialArgs.DEFAULT_DISTERRPCT;// [ 0 TO 0.5 ]
public PrefixTreeStrategy(SpatialPrefixTree grid, string fieldName, bool simplifyIndexedCells)
: base(grid.SpatialContext, fieldName)
{
- this.grid = grid;
- this.simplifyIndexedCells = simplifyIndexedCells;
+ this.m_grid = grid;
+ this.m_simplifyIndexedCells = simplifyIndexedCells;
}
/// <summary>
@@ -100,7 +100,7 @@ namespace Lucene.Net.Spatial.Prefix
/// </summary>
public virtual int DefaultFieldValuesArrayLen
{
- set { defaultFieldValuesArrayLen = value; }
+ set { m_defaultFieldValuesArrayLen = value; }
}
/// <summary>
@@ -119,20 +119,20 @@ namespace Lucene.Net.Spatial.Prefix
/// <seealso cref="Lucene.Net.Spatial.Queries.SpatialArgs.DistErrPct"/>
public virtual double DistErrPct
{
- get { return distErrPct; }
- set { distErrPct = value; }
+ get { return m_distErrPct; }
+ set { m_distErrPct = value; }
}
public override Field[] CreateIndexableFields(IShape shape)
{
- double distErr = SpatialArgs.CalcDistanceFromErrPct(shape, distErrPct, ctx);
+ double distErr = SpatialArgs.CalcDistanceFromErrPct(shape, m_distErrPct, m_ctx);
return CreateIndexableFields(shape, distErr);
}
public virtual Field[] CreateIndexableFields(IShape shape, double distErr)
{
- int detailLevel = grid.GetLevelForDistance(distErr);
- IList<Cell> cells = grid.GetCells(shape, detailLevel, true, simplifyIndexedCells);//intermediates cells
+ int detailLevel = m_grid.GetLevelForDistance(distErr);
+ IList<Cell> cells = m_grid.GetCells(shape, detailLevel, true, m_simplifyIndexedCells);//intermediates cells
//TODO is CellTokenStream supposed to be re-used somehow? see Uwe's comments:
// http://code.google.com/p/lucene-spatial-playground/issues/detail?id=4
@@ -197,13 +197,13 @@ namespace Lucene.Net.Spatial.Prefix
public override ValueSource MakeDistanceValueSource(IPoint queryPoint, double multiplier)
{
- var p = provider.GetOrAdd(FieldName, f => new PointPrefixTreeFieldCacheProvider(grid, FieldName, defaultFieldValuesArrayLen));
- return new ShapeFieldCacheDistanceValueSource(ctx, p, queryPoint, multiplier);
+ var p = provider.GetOrAdd(FieldName, f => new PointPrefixTreeFieldCacheProvider(m_grid, FieldName, m_defaultFieldValuesArrayLen));
+ return new ShapeFieldCacheDistanceValueSource(m_ctx, p, queryPoint, multiplier);
}
public virtual SpatialPrefixTree Grid
{
- get { return grid; }
+ get { return m_grid; }
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/src/Lucene.Net.Spatial/Prefix/RecursivePrefixTreeStrategy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/RecursivePrefixTreeStrategy.cs b/src/Lucene.Net.Spatial/Prefix/RecursivePrefixTreeStrategy.cs
index dc41b48..21217f9 100644
--- a/src/Lucene.Net.Spatial/Prefix/RecursivePrefixTreeStrategy.cs
+++ b/src/Lucene.Net.Spatial/Prefix/RecursivePrefixTreeStrategy.cs
@@ -38,12 +38,12 @@ namespace Lucene.Net.Spatial.Prefix
/// <summary>
/// True if only indexed points shall be supported. See <see cref="IntersectsPrefixTreeFilter.hasIndexedLeaves"/>.
/// </summary>
- protected bool pointsOnly = false;
+ protected bool m_pointsOnly = false;
/// <summary>
- /// See <see cref="ContainsPrefixTreeFilter.multiOverlappingIndexedShapes"/>.
+ /// See <see cref="ContainsPrefixTreeFilter.m_multiOverlappingIndexedShapes"/>.
/// </summary>
- protected bool multiOverlappingIndexedShapes = true;
+ protected bool m_multiOverlappingIndexedShapes = true;
public RecursivePrefixTreeStrategy(SpatialPrefixTree grid, string fieldName)
: base(grid, fieldName, true) //simplify indexed cells
@@ -67,7 +67,7 @@ namespace Lucene.Net.Spatial.Prefix
public override string ToString()
{
- return GetType().Name + "(prefixGridScanLevel:" + prefixGridScanLevel + ",SPG:(" + grid + "))";
+ return GetType().Name + "(prefixGridScanLevel:" + prefixGridScanLevel + ",SPG:(" + m_grid + "))";
}
public override Filter MakeFilter(SpatialArgs args)
@@ -78,24 +78,24 @@ namespace Lucene.Net.Spatial.Prefix
return new DisjointSpatialFilter(this, args, FieldName);
}
IShape shape = args.Shape;
- int detailLevel = grid.GetLevelForDistance(args.ResolveDistErr(ctx, distErrPct));
+ int detailLevel = m_grid.GetLevelForDistance(args.ResolveDistErr(m_ctx, m_distErrPct));
- if (pointsOnly || op == SpatialOperation.Intersects)
+ if (m_pointsOnly || op == SpatialOperation.Intersects)
{
return new IntersectsPrefixTreeFilter(
- shape, FieldName, grid, detailLevel, prefixGridScanLevel, !pointsOnly);
+ shape, FieldName, m_grid, detailLevel, prefixGridScanLevel, !m_pointsOnly);
}
else if (op == SpatialOperation.IsWithin)
{
return new WithinPrefixTreeFilter(
- shape, FieldName, grid, detailLevel, prefixGridScanLevel,
+ shape, FieldName, m_grid, detailLevel, prefixGridScanLevel,
-1); //-1 flag is slower but ensures correct results
}
else if (op == SpatialOperation.Contains)
{
- return new ContainsPrefixTreeFilter(shape, FieldName, grid, detailLevel,
- multiOverlappingIndexedShapes);
+ return new ContainsPrefixTreeFilter(shape, FieldName, m_grid, detailLevel,
+ m_multiOverlappingIndexedShapes);
}
throw new UnsupportedSpatialOperation(op);
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/src/Lucene.Net.Spatial/Prefix/TermQueryPrefixTreeStrategy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/TermQueryPrefixTreeStrategy.cs b/src/Lucene.Net.Spatial/Prefix/TermQueryPrefixTreeStrategy.cs
index 70ef71a..b2ca3d5 100644
--- a/src/Lucene.Net.Spatial/Prefix/TermQueryPrefixTreeStrategy.cs
+++ b/src/Lucene.Net.Spatial/Prefix/TermQueryPrefixTreeStrategy.cs
@@ -52,8 +52,8 @@ namespace Lucene.Net.Spatial.Prefix
throw new UnsupportedSpatialOperation(op);
}
IShape shape = args.Shape;
- int detailLevel = grid.GetLevelForDistance(args.ResolveDistErr(ctx, distErrPct));
- IList<Cell> cells = grid.GetCells(shape, detailLevel, false /*no parents*/, true /*simplify*/);
+ int detailLevel = m_grid.GetLevelForDistance(args.ResolveDistErr(m_ctx, m_distErrPct));
+ IList<Cell> cells = m_grid.GetCells(shape, detailLevel, false /*no parents*/, true /*simplify*/);
var terms = new BytesRef[cells.Count];
int i = 0;
foreach (Cell cell in cells)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs b/src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs
index 47a0f49..3182a93 100644
--- a/src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs
+++ b/src/Lucene.Net.Spatial/Prefix/Tree/Cell.cs
@@ -39,7 +39,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
/// So we need to move the reference here and also set it before running the normal constructor
/// logic.
/// </summary>
- protected readonly SpatialPrefixTree outerInstance;
+ protected readonly SpatialPrefixTree m_outerInstance;
public const byte LEAF_BYTE = (byte)('+');//NOTE: must sort before letters & numbers
@@ -58,7 +58,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
/// When set via <see cref="GetSubCells(IShape)">GetSubCells(filter)</see>, it is the relationship between this cell
/// and the given shape filter.
/// </summary>
- protected internal SpatialRelation shapeRel;//set in GetSubCells(filter), and via SetLeaf().
+ protected SpatialRelation m_shapeRel;//set in GetSubCells(filter), and via SetLeaf().
/// <summary>Always false for points.</summary>
/// <remarks>
@@ -66,13 +66,13 @@ namespace Lucene.Net.Spatial.Prefix.Tree
/// to be provided because shapeRel is WITHIN or maxLevels or a detailLevel is
/// hit.
/// </remarks>
- protected internal bool leaf;
+ protected bool m_leaf;
- protected internal Cell(SpatialPrefixTree outerInstance, string token)
+ protected Cell(SpatialPrefixTree outerInstance, string token)
{
// LUCENENET specific - set the outer instance here
// because overrides of Shape may require it
- this.outerInstance = outerInstance;
+ this.m_outerInstance = outerInstance;
//NOTE: must sort before letters & numbers
//this is the only part of equality
@@ -92,7 +92,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
{
// LUCENENET specific - set the outer instance here
// because overrides of Shape may require it
- this.outerInstance = outerInstance;
+ this.m_outerInstance = outerInstance;
//ensure any lazy instantiation completes to make this threadsafe
this.bytes = bytes;
@@ -105,7 +105,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
{
Debug.Assert(Level != 0);
token = null;
- shapeRel = SpatialRelation.NOT_SET;
+ m_shapeRel = SpatialRelation.NOT_SET;
this.bytes = bytes;
b_off = off;
b_len = len;
@@ -122,13 +122,13 @@ namespace Lucene.Net.Spatial.Prefix.Tree
}
else
{
- leaf = false;
+ m_leaf = false;
}
}
public virtual SpatialRelation ShapeRel
{
- get { return shapeRel; }
+ get { return m_shapeRel; }
}
/// <summary>For points, this is always false.</summary>
@@ -138,14 +138,14 @@ namespace Lucene.Net.Spatial.Prefix.Tree
/// </remarks>
public virtual bool IsLeaf
{
- get { return leaf; }
+ get { return m_leaf; }
}
/// <summary>Note: not supported at level 0.</summary>
public virtual void SetLeaf()
{
Debug.Assert(Level != 0);
- leaf = true;
+ m_leaf = true;
}
/// <summary>
@@ -208,7 +208,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
if (shapeFilter is IPoint)
{
Cell subCell = GetSubCell((IPoint)shapeFilter);
- subCell.shapeRel = SpatialRelation.CONTAINS;
+ subCell.m_shapeRel = SpatialRelation.CONTAINS;
#if !NET35
return new ReadOnlyCollection<Cell>(new[] { subCell });
#else
@@ -230,7 +230,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
{
continue;
}
- cell.shapeRel = rel;
+ cell.m_shapeRel = rel;
if (rel == SpatialRelation.WITHIN)
{
cell.SetLeaf();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/src/Lucene.Net.Spatial/Prefix/Tree/GeohashPrefixTree.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/Tree/GeohashPrefixTree.cs b/src/Lucene.Net.Spatial/Prefix/Tree/GeohashPrefixTree.cs
index d67a98e..99f2958 100644
--- a/src/Lucene.Net.Spatial/Prefix/Tree/GeohashPrefixTree.cs
+++ b/src/Lucene.Net.Spatial/Prefix/Tree/GeohashPrefixTree.cs
@@ -42,13 +42,13 @@ namespace Lucene.Net.Spatial.Prefix.Tree
{
protected internal override int GetLevelForDistance(double degrees)
{
- var grid = new GeohashPrefixTree(ctx, GeohashPrefixTree.MaxLevelsPossible);
+ var grid = new GeohashPrefixTree(m_ctx, GeohashPrefixTree.MaxLevelsPossible);
return grid.GetLevelForDistance(degrees);
}
protected internal override SpatialPrefixTree NewSPT()
{
- return new GeohashPrefixTree(ctx, maxLevels.HasValue ? maxLevels.Value : GeohashPrefixTree.MaxLevelsPossible);
+ return new GeohashPrefixTree(m_ctx, m_maxLevels.HasValue ? m_maxLevels.Value : GeohashPrefixTree.MaxLevelsPossible);
}
}
@@ -79,11 +79,11 @@ namespace Lucene.Net.Spatial.Prefix.Tree
{
if (dist == 0)
{
- return maxLevels;//short circuit
+ return m_maxLevels;//short circuit
}
int level = GeohashUtils.LookupHashLenForWidthHeight(dist, dist);
- return Math.Max(Math.Min(level, maxLevels), 1);
+ return Math.Max(Math.Min(level, m_maxLevels), 1);
}
protected internal override Cell GetCell(IPoint p, int level)
@@ -128,7 +128,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
IList<Cell> cells = new List<Cell>(hashes.Length);
foreach (string hash in hashes)
{
- cells.Add(new GhCell((GeohashPrefixTree)outerInstance, hash));
+ cells.Add(new GhCell((GeohashPrefixTree)m_outerInstance, hash));
}
return cells;
}
@@ -140,7 +140,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
public override Cell GetSubCell(IPoint p)
{
- return outerInstance.GetCell(p, Level + 1);//not performant!
+ return m_outerInstance.GetCell(p, Level + 1);//not performant!
}
private IShape shape;//cache
@@ -151,7 +151,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
{
if (shape == null)
{
- shape = GeohashUtils.DecodeBoundary(Geohash, outerInstance.ctx);
+ shape = GeohashUtils.DecodeBoundary(Geohash, m_outerInstance.m_ctx);
}
return shape;
}
@@ -159,7 +159,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
public override IPoint Center
{
- get { return GeohashUtils.Decode(Geohash, outerInstance.ctx); }
+ get { return GeohashUtils.Decode(Geohash, m_outerInstance.m_ctx); }
}
private string Geohash
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/src/Lucene.Net.Spatial/Prefix/Tree/QuadPrefixTree.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/Tree/QuadPrefixTree.cs b/src/Lucene.Net.Spatial/Prefix/Tree/QuadPrefixTree.cs
index 61e690a..efa4816 100644
--- a/src/Lucene.Net.Spatial/Prefix/Tree/QuadPrefixTree.cs
+++ b/src/Lucene.Net.Spatial/Prefix/Tree/QuadPrefixTree.cs
@@ -43,13 +43,13 @@ namespace Lucene.Net.Spatial.Prefix.Tree
{
protected internal override int GetLevelForDistance(double degrees)
{
- var grid = new QuadPrefixTree(ctx, MAX_LEVELS_POSSIBLE);
+ var grid = new QuadPrefixTree(m_ctx, MAX_LEVELS_POSSIBLE);
return grid.GetLevelForDistance(degrees);
}
protected internal override SpatialPrefixTree NewSPT()
{
- return new QuadPrefixTree(ctx, maxLevels.HasValue ? maxLevels.Value : MAX_LEVELS_POSSIBLE);
+ return new QuadPrefixTree(m_ctx, m_maxLevels.HasValue ? m_maxLevels.Value : MAX_LEVELS_POSSIBLE);
}
}
@@ -122,7 +122,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
{
// Format the number to min 3 integer digits and exactly 5 fraction digits
const string FORMAT_STR = @"000.00000";
- for (int i = 0; i < maxLevels; i++)
+ for (int i = 0; i < m_maxLevels; i++)
{
@out.WriteLine(i + "]\t" + levelW[i].ToString(FORMAT_STR) + "\t" + levelH[i].ToString(FORMAT_STR) + "\t" +
levelS[i] + "\t" + (levelS[i] * levelS[i]));
@@ -133,9 +133,9 @@ namespace Lucene.Net.Spatial.Prefix.Tree
{
if (dist == 0)//short circuit
{
- return maxLevels;
+ return m_maxLevels;
}
- for (int i = 0; i < maxLevels - 1; i++)
+ for (int i = 0; i < m_maxLevels - 1; i++)
{
//note: level[i] is actually a lookup for level i+1
if (dist > levelW[i] && dist > levelH[i])
@@ -143,13 +143,13 @@ namespace Lucene.Net.Spatial.Prefix.Tree
return i + 1;
}
}
- return maxLevels;
+ return m_maxLevels;
}
protected internal override Cell GetCell(IPoint p, int level)
{
IList<Cell> cells = new List<Cell>(1);
- Build(xmid, ymid, 0, cells, new StringBuilder(), ctx.MakePoint(p.X, p.Y), level);
+ Build(xmid, ymid, 0, cells, new StringBuilder(), m_ctx.MakePoint(p.X, p.Y), level);
return cells[0];
}
@@ -204,7 +204,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
double h = levelH[level] / 2;
int strlen = str.Length;
- IRectangle rectangle = ctx.MakeRectangle(cx - w, cx + w, cy - h, cy + h);
+ IRectangle rectangle = m_ctx.MakeRectangle(cx - w, cx + w, cy - h, cy + h);
SpatialRelation v = shape.Relate(rectangle);
if (SpatialRelation.CONTAINS == v)
{
@@ -246,7 +246,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
public QuadCell(QuadPrefixTree outerInstance, string token, SpatialRelation shapeRel)
: base(outerInstance, token)
{
- this.shapeRel = shapeRel;
+ this.m_shapeRel = shapeRel;
}
internal QuadCell(QuadPrefixTree outerInstance, byte[] bytes, int off, int len)
@@ -262,7 +262,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
protected internal override ICollection<Cell> GetSubCells()
{
- QuadPrefixTree outerInstance = (QuadPrefixTree)this.outerInstance;
+ QuadPrefixTree outerInstance = (QuadPrefixTree)this.m_outerInstance;
IList<Cell> cells = new List<Cell>(4);
cells.Add(new QuadCell(outerInstance, TokenString + "A"));
cells.Add(new QuadCell(outerInstance, TokenString + "B"));
@@ -278,7 +278,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
public override Cell GetSubCell(IPoint p)
{
- return outerInstance.GetCell(p, Level + 1);//not performant!
+ return m_outerInstance.GetCell(p, Level + 1);//not performant!
}
private IShape shape; //cache
@@ -297,7 +297,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
private IRectangle MakeShape()
{
- QuadPrefixTree outerInstance = (QuadPrefixTree)this.outerInstance;
+ QuadPrefixTree outerInstance = (QuadPrefixTree)this.m_outerInstance;
string token = TokenString;
double xmin = outerInstance.xmin;
double ymin = outerInstance.ymin;
@@ -339,7 +339,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
width = outerInstance.gridW;
height = outerInstance.gridH;
}
- return outerInstance.ctx.MakeRectangle(xmin, xmin + width, ymin, ymin + height);
+ return outerInstance.m_ctx.MakeRectangle(xmin, xmin + width, ymin, ymin + height);
}
}//QuadCell
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTree.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTree.cs b/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTree.cs
index 0694704..4922b6e 100644
--- a/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTree.cs
+++ b/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTree.cs
@@ -41,30 +41,30 @@ namespace Lucene.Net.Spatial.Prefix.Tree
/// </remarks>
public abstract class SpatialPrefixTree
{
- protected internal readonly int maxLevels;
+ protected readonly int m_maxLevels;
- protected internal readonly SpatialContext ctx;
+ protected internal readonly SpatialContext m_ctx;
public SpatialPrefixTree(SpatialContext ctx, int maxLevels)
{
Debug.Assert(maxLevels > 0);
- this.ctx = ctx;
- this.maxLevels = maxLevels;
+ this.m_ctx = ctx;
+ this.m_maxLevels = maxLevels;
}
public virtual SpatialContext SpatialContext
{
- get { return ctx; }
+ get { return m_ctx; }
}
public virtual int MaxLevels
{
- get { return maxLevels; }
+ get { return m_maxLevels; }
}
public override string ToString()
{
- return GetType().Name + "(maxLevels:" + maxLevels + ",ctx:" + ctx + ")";
+ return GetType().Name + "(maxLevels:" + m_maxLevels + ",ctx:" + m_ctx + ")";
}
/// <summary>
@@ -100,7 +100,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
throw new ArgumentException("Level must be in 1 to maxLevels range");
}
//TODO cache for each level
- Cell cell = GetCell(ctx.WorldBounds.Center, level);
+ Cell cell = GetCell(m_ctx.WorldBounds.Center, level);
IRectangle bbox = cell.Shape.BoundingBox;
double width = bbox.Width;
double height = bbox.Height;
@@ -190,7 +190,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
bool simplify)
{
//TODO consider an on-demand iterator -- it won't build up all cells in memory.
- if (detailLevel > maxLevels)
+ if (detailLevel > m_maxLevels)
{
throw new ArgumentException("detailLevel > maxLevels");
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs b/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs
index e4ff6f7..f103d3a 100644
--- a/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs
+++ b/src/Lucene.Net.Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs
@@ -36,9 +36,9 @@ namespace Lucene.Net.Spatial.Prefix.Tree
public const string MAX_LEVELS = "maxLevels";
public const string MAX_DIST_ERR = "maxDistErr";
- protected internal IDictionary<string, string> args;
- protected internal SpatialContext ctx;
- protected internal int? maxLevels;
+ protected IDictionary<string, string> m_args;
+ protected SpatialContext m_ctx;
+ protected int? m_maxLevels;
/// <summary>The factory is looked up via "prefixTree" in args, expecting "geohash" or "quad".</summary>
/// <remarks>
@@ -79,24 +79,24 @@ namespace Lucene.Net.Spatial.Prefix.Tree
protected internal virtual void Init(IDictionary<string, string> args, SpatialContext ctx)
{
- this.args = args;
- this.ctx = ctx;
+ this.m_args = args;
+ this.m_ctx = ctx;
InitMaxLevels();
}
protected internal virtual void InitMaxLevels()
{
string mlStr;
- if (args.TryGetValue(MAX_LEVELS, out mlStr))
+ if (m_args.TryGetValue(MAX_LEVELS, out mlStr))
{
- maxLevels = int.Parse(mlStr, CultureInfo.InvariantCulture);
+ m_maxLevels = int.Parse(mlStr, CultureInfo.InvariantCulture);
return;
}
double degrees;
string maxDetailDistStr;
- if (!args.TryGetValue(MAX_DIST_ERR, out maxDetailDistStr))
+ if (!m_args.TryGetValue(MAX_DIST_ERR, out maxDetailDistStr))
{
- if (!ctx.IsGeo)
+ if (!m_ctx.IsGeo)
{
return;
}
@@ -107,7 +107,7 @@ namespace Lucene.Net.Spatial.Prefix.Tree
{
degrees = double.Parse(maxDetailDistStr, CultureInfo.InvariantCulture);
}
- maxLevels = GetLevelForDistance(degrees);
+ m_maxLevels = GetLevelForDistance(degrees);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/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 8e16e40..2c760ed 100644
--- a/src/Lucene.Net.Spatial/Prefix/WithinPrefixTreeFilter.cs
+++ b/src/Lucene.Net.Spatial/Prefix/WithinPrefixTreeFilter.cs
@@ -81,7 +81,7 @@ namespace Lucene.Net.Spatial.Prefix
{
throw new ArgumentException("distErr must be > 0");
}
- SpatialContext ctx = grid.SpatialContext;
+ SpatialContext ctx = m_grid.SpatialContext;
if (shape is IPoint)
{
return ctx.MakeCircle((IPoint)shape, distErr);
@@ -158,8 +158,8 @@ namespace Lucene.Net.Spatial.Prefix
protected internal override void Start()
{
- inside = new FixedBitSet(maxDoc);
- outside = new FixedBitSet(maxDoc);
+ inside = new FixedBitSet(m_maxDoc);
+ outside = new FixedBitSet(m_maxDoc);
}
protected internal override DocIdSet Finish()
@@ -171,14 +171,14 @@ 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(((WithinPrefixTreeFilter)outerInstance).bufferedQueryShape).GetEnumerator();
+ return cell.GetSubCells(((WithinPrefixTreeFilter)m_outerInstance).bufferedQueryShape).GetEnumerator();
}
protected internal override bool Visit(Cell cell)
{
//cell.relate is based on the bufferedQueryShape; we need to examine what
// the relation is against the queryShape
- visitRelation = cell.Shape.Relate(outerInstance.queryShape);
+ visitRelation = cell.Shape.Relate(m_outerInstance.m_queryShape);
if (visitRelation == SpatialRelation.WITHIN)
{
CollectDocs(inside);
@@ -189,7 +189,7 @@ namespace Lucene.Net.Spatial.Prefix
CollectDocs(outside);
return false;
}
- else if (cell.Level == outerInstance.detailLevel)
+ else if (cell.Level == m_outerInstance.m_detailLevel)
{
CollectDocs(inside);
return false;
@@ -201,8 +201,8 @@ namespace Lucene.Net.Spatial.Prefix
protected internal override void VisitLeaf(Cell cell)
{
//visitRelation is declared as a field, populated by visit() so we don't recompute it
- Debug.Assert(outerInstance.detailLevel != cell.Level);
- Debug.Assert(visitRelation == cell.Shape.Relate(outerInstance.queryShape));
+ Debug.Assert(m_outerInstance.m_detailLevel != cell.Level);
+ Debug.Assert(visitRelation == cell.Shape.Relate(m_outerInstance.m_queryShape));
if (AllCellsIntersectQuery(cell, visitRelation))
{
CollectDocs(inside);
@@ -221,9 +221,9 @@ namespace Lucene.Net.Spatial.Prefix
{
if (relate == SpatialRelation.NOT_SET)
{
- relate = cell.Shape.Relate(outerInstance.queryShape);
+ relate = cell.Shape.Relate(m_outerInstance.m_queryShape);
}
- if (cell.Level == outerInstance.detailLevel)
+ if (cell.Level == m_outerInstance.m_detailLevel)
{
return relate.Intersects();
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/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 f80eea6..e67e3a5 100644
--- a/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
+++ b/src/Lucene.Net.Spatial/Serialized/SerializedDVStrategy.cs
@@ -65,7 +65,7 @@ namespace Lucene.Net.Spatial.Serialized
BytesRef bytesRef = new BytesRef();//receiver of byteStream's bytes
try
{
- ctx.BinaryCodec.WriteShape(new BinaryWriter(byteStream), shape);
+ m_ctx.BinaryCodec.WriteShape(new BinaryWriter(byteStream), shape);
//this is a hack to avoid redundant byte array copying by byteStream.toByteArray()
byteStream.WriteTo(new OutputStreamAnonymousHelper(bytesRef));
@@ -98,7 +98,7 @@ namespace Lucene.Net.Spatial.Serialized
public override ValueSource MakeDistanceValueSource(IPoint queryPoint, double multiplier)
{
//TODO if makeShapeValueSource gets lifted to the top; this could become a generic impl.
- return new DistanceToShapeValueSource(MakeShapeValueSource(), queryPoint, multiplier, ctx);
+ return new DistanceToShapeValueSource(MakeShapeValueSource(), queryPoint, multiplier, m_ctx);
}
public override ConstantScoreQuery MakeQuery(SpatialArgs args)
@@ -127,7 +127,7 @@ namespace Lucene.Net.Spatial.Serialized
//TODO raise to SpatialStrategy
public virtual ValueSource MakeShapeValueSource()
{
- return new ShapeDocValueSource(this, FieldName, ctx.BinaryCodec);
+ return new ShapeDocValueSource(this, FieldName, m_ctx.BinaryCodec);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/src/Lucene.Net.Spatial/SpatialStrategy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/SpatialStrategy.cs b/src/Lucene.Net.Spatial/SpatialStrategy.cs
index 14b67e2..3bfc929 100644
--- a/src/Lucene.Net.Spatial/SpatialStrategy.cs
+++ b/src/Lucene.Net.Spatial/SpatialStrategy.cs
@@ -51,7 +51,7 @@ namespace Lucene.Net.Spatial
/// </summary>
public abstract class SpatialStrategy
{
- protected readonly SpatialContext ctx;
+ protected readonly SpatialContext m_ctx;
private readonly string fieldName;
/// <summary>
@@ -61,7 +61,7 @@ namespace Lucene.Net.Spatial
{
if (ctx == null)
throw new ArgumentException("ctx is required", "ctx");
- this.ctx = ctx;
+ this.m_ctx = ctx;
if (string.IsNullOrEmpty(fieldName))
throw new ArgumentException("fieldName is required", "fieldName");
this.fieldName = fieldName;
@@ -69,7 +69,7 @@ namespace Lucene.Net.Spatial
public virtual SpatialContext SpatialContext
{
- get { return ctx; }
+ get { return m_ctx; }
}
/// <summary>
@@ -154,8 +154,8 @@ namespace Lucene.Net.Spatial
public ValueSource MakeRecipDistanceValueSource(IShape queryShape)
{
IRectangle bbox = queryShape.BoundingBox;
- double diagonalDist = ctx.DistCalc.Distance(
- ctx.MakePoint(bbox.MinX, bbox.MinY), bbox.MaxX, bbox.MaxY);
+ double diagonalDist = m_ctx.DistCalc.Distance(
+ m_ctx.MakePoint(bbox.MinX, bbox.MinY), bbox.MaxX, bbox.MaxY);
double distToEdge = diagonalDist * 0.5;
float c = (float)distToEdge * 0.1f; //one tenth
return new ReciprocalFloatFunction(MakeDistanceValueSource(queryShape.Center, 1.0), 1f, c, c);
@@ -163,7 +163,7 @@ namespace Lucene.Net.Spatial
public override string ToString()
{
- return GetType().Name + " field:" + fieldName + " ctx=" + ctx;
+ return GetType().Name + " field:" + fieldName + " ctx=" + m_ctx;
}
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/src/Lucene.Net.Spatial/Util/CachingDoubleValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Util/CachingDoubleValueSource.cs b/src/Lucene.Net.Spatial/Util/CachingDoubleValueSource.cs
index 8d3f0f8..7d9522c 100644
--- a/src/Lucene.Net.Spatial/Util/CachingDoubleValueSource.cs
+++ b/src/Lucene.Net.Spatial/Util/CachingDoubleValueSource.cs
@@ -30,25 +30,25 @@ namespace Lucene.Net.Spatial.Util
/// </summary>
public class CachingDoubleValueSource : ValueSource
{
- protected readonly ValueSource source;
- protected readonly IDictionary<int, double> cache;
+ protected readonly ValueSource m_source;
+ protected readonly IDictionary<int, double> m_cache;
public CachingDoubleValueSource(ValueSource source)
{
- this.source = source;
- cache = new HashMap<int, double>();
+ this.m_source = source;
+ m_cache = new HashMap<int, double>();
}
public override string GetDescription()
{
- return "Cached[" + source.GetDescription() + "]";
+ return "Cached[" + m_source.GetDescription() + "]";
}
public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
{
int @base = readerContext.DocBase;
- FunctionValues vals = source.GetValues(context, readerContext);
- return new CachingDoubleFunctionValue(@base, vals, cache);
+ FunctionValues vals = m_source.GetValues(context, readerContext);
+ return new CachingDoubleFunctionValue(@base, vals, m_cache);
}
#region Nested type: CachingDoubleFunctionValue
@@ -98,14 +98,14 @@ namespace Lucene.Net.Spatial.Util
var that = o as CachingDoubleValueSource;
if (that == null) return false;
- if (source != null ? !source.Equals(that.source) : that.source != null) return false;
+ if (m_source != null ? !m_source.Equals(that.m_source) : that.m_source != null) return false;
return true;
}
public override int GetHashCode()
{
- return source != null ? source.GetHashCode() : 0;
+ return m_source != null ? m_source.GetHashCode() : 0;
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/22daadab/src/Lucene.Net.Spatial/Util/ShapeFieldCacheProvider.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Spatial/Util/ShapeFieldCacheProvider.cs b/src/Lucene.Net.Spatial/Util/ShapeFieldCacheProvider.cs
index b6a7eb4..d86ed3a 100644
--- a/src/Lucene.Net.Spatial/Util/ShapeFieldCacheProvider.cs
+++ b/src/Lucene.Net.Spatial/Util/ShapeFieldCacheProvider.cs
@@ -42,14 +42,14 @@ namespace Lucene.Net.Spatial.Util
private readonly WeakDictionary<IndexReader, ShapeFieldCache<T>> sidx =
new WeakDictionary<IndexReader, ShapeFieldCache<T>>();
- protected internal readonly int defaultSize;
- protected internal readonly string shapeField;
+ protected internal readonly int m_defaultSize;
+ protected internal readonly string m_shapeField;
public ShapeFieldCacheProvider(string shapeField, int defaultSize)
{
// it may be a List<T> or T
- this.shapeField = shapeField;
- this.defaultSize = defaultSize;
+ this.m_shapeField = shapeField;
+ this.m_defaultSize = defaultSize;
}
protected internal abstract T ReadShape(BytesRef term);
@@ -67,10 +67,10 @@ namespace Lucene.Net.Spatial.Util
}
/*long startTime = Runtime.CurrentTimeMillis();
log.Fine("Building Cache [" + reader.MaxDoc() + "]");*/
- idx = new ShapeFieldCache<T>(reader.MaxDoc, defaultSize);
+ idx = new ShapeFieldCache<T>(reader.MaxDoc, m_defaultSize);
int count = 0;
DocsEnum docs = null;
- Terms terms = reader.Terms(shapeField);
+ Terms terms = reader.Terms(m_shapeField);
TermsEnum te = null;
if (terms != null)
{