Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
synhershko committed May 3, 2012
1 parent 5232355 commit e53ff69
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions src/contrib/Spatial/Prefix/Tree/SpatialPrefixTreeFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ public abstract class SpatialPrefixTreeFactory
protected SpatialContext ctx;
protected int? maxLevels;

/**
* The factory is looked up via "prefixTree" in args, expecting "geohash" or "quad".
* If its neither of these, then "geohash" is chosen for a geo context, otherwise "quad" is chosen.
*/
public static SpatialPrefixTree MakeSPT(Dictionary<String, String> args, ClassLoader classLoader, SpatialContext ctx)
/// <summary>
/// The factory is looked up via "prefixTree" in args, expecting "geohash" or "quad".
/// If its neither of these, then "geohash" is chosen for a geo context, otherwise "quad" is chosen.
/// </summary>
/// <param name="args"></param>
/// <param name="ctx"></param>
/// <returns></returns>
public static SpatialPrefixTree MakeSPT(Dictionary<String, String> args, SpatialContext ctx)
{
SpatialPrefixTreeFactory instance;
String cname;
Expand All @@ -46,18 +49,11 @@ public static SpatialPrefixTree MakeSPT(Dictionary<String, String> args, ClassLo
instance = new QuadPrefixTree.Factory();
else
{
try
{
Class c = classLoader.loadClass(cname);
instance = (SpatialPrefixTreeFactory)c.newInstance();
}
catch (Exception e)
{
throw new RuntimeException(e);
}
Type t = Type.GetType(cname);
instance = (SpatialPrefixTreeFactory)Activator.CreateInstance(t);
}
instance.Init(args, ctx);
return instance.newSPT();
return instance.NewSPT();
}

protected void Init(Dictionary<String, String> args, SpatialContext ctx)
Expand Down

0 comments on commit e53ff69

Please sign in to comment.