Package org.apache.lucene.spatial.prefix.tree

# Class SpatialPrefixTreeFactory

java.lang.Object
org.apache.lucene.spatial.prefix.tree.SpatialPrefixTreeFactory

Direct Known Subclasses:
  `GeohashPrefixTree.Factory`, `QuadPrefixTree.Factory`, `S2PrefixTree.Factory`

public abstract class SpatialPrefixTreeFactory extends Object
Abstract Factory for creating `SpatialPrefixTree` instances with useful defaults and passed on configurations defined in a Map.

WARNING: This API is experimental and might change in incompatible ways in the next release.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected Map<String,String>`
`args`
`protected org.locationtech.spatial4j.context.SpatialContext`
`ctx`
`static final String`
`MAX_DIST_ERR`
`static final String`
`MAX_LEVELS`
`protected Integer`
`maxLevels`
`static final String`
`PREFIX_TREE`
`static final String`
`VERSION`

## Constructor Summary

Constructors
Constructor
Description
`SpatialPrefixTreeFactory()`

## Method Summary

Modifier and Type
Method
Description
`protected abstract int`
`getLevelForDistance(double degrees)`
Calls `SpatialPrefixTree.getLevelForDistance(double)`.
`Version`
`getVersion()`
Return the version of Lucene this tree will mimic the behavior of for analysis.
`protected void`
`init(Map<String,String> args, org.locationtech.spatial4j.context.SpatialContext ctx)`
`protected void`
`initMaxLevels()`
`protected void`
`initVersion()`
`static SpatialPrefixTree`
`makeSPT(Map<String,String> args, ClassLoader classLoader, org.locationtech.spatial4j.context.SpatialContext ctx)`
The factory is looked up via "prefixTree" in args, expecting "geohash" or "quad".
`protected abstract SpatialPrefixTree`
`newSPT()`
`void`
`setVersion(Version v)`
Set the version of Lucene this tree should mimic the behavior for for analysis.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### PREFIX_TREE

public static final String PREFIX_TREE

See Also:
  - Constant Field Values

### MAX_LEVELS

public static final String MAX_LEVELS

See Also:
  - Constant Field Values

### MAX_DIST_ERR

public static final String MAX_DIST_ERR

See Also:
  - Constant Field Values

### VERSION

public static final String VERSION

See Also:
  - Constant Field Values

### args

protected Map<String,String> args

### ctx

protected org.locationtech.spatial4j.context.SpatialContext ctx

### maxLevels

protected Integer maxLevels

## Constructor Details

### SpatialPrefixTreeFactory

public SpatialPrefixTreeFactory()

## Method Details

### makeSPT

public static SpatialPrefixTree makeSPT(Map<String,String> args, ClassLoader classLoader, org.locationtech.spatial4j.context.SpatialContext ctx)
The factory is looked up via "prefixTree" in args, expecting "geohash" or "quad". If it's neither of these, then "geohash" is chosen for a geo context, otherwise "quad" is chosen. The "version" arg, if present, is parsed with `Version` and the prefix tree might be sensitive to it.

### init

protected void init(Map<String,String> args, org.locationtech.spatial4j.context.SpatialContext ctx)

### initVersion

protected void initVersion()

### initMaxLevels

protected void initMaxLevels()

### setVersion

public void setVersion(Version v)
Set the version of Lucene this tree should mimic the behavior for for analysis.

### getVersion

public Version getVersion()
Return the version of Lucene this tree will mimic the behavior of for analysis.

### getLevelForDistance

protected abstract int getLevelForDistance(double degrees)
Calls `SpatialPrefixTree.getLevelForDistance(double)`.

### newSPT

protected abstract SpatialPrefixTree newSPT()