在MiniGUi中,我可以看到db.index
。如何通过Java代码将其设置为tree.spatial.rstarvariants.rstar.RStartTreeFactory
?
我已实施:
params.addParameter(AbstractDatabase.Parameterizer.INDEX_ID,tree.spatial.rstarvariants.rstar.RStarTreeFactory);
找不到addParameter()
函数tree.spatial...RStarTreeFactory
类的第二个参数
// Setup parameters:
ListParameterization params = new ListParameterization();
params.addParameter(
FileBasedDatabaseConnection.Parameterizer.INPUT_ID,
fileLocation);
params.addParameter(AbstractDatabase.Parameterizer.INDEX_ID,
RStarTreeFactory.class);
我得到了NullPointerException
。我是否正确使用RStarTreeFactory.class
?
答案 0 :(得分:2)
ELKI命令行(和MiniGui;它是一个命令行构建器)允许指定简写类名,省略已实现接口的包前缀。
完整的命令行文档产生:
-db.index <object_1|class_1,...,object_n|class_n>
Database indexes to add.
Implementing de.lmu.ifi.dbs.elki.index.IndexFactory
Known classes (default package de.lmu.ifi.dbs.elki.index.):
-> tree.spatial.rstarvariants.rstar.RStarTreeFactory
-> ...
即。对于此参数,可以省略类前缀de.lmu.ifi.dbs.elki.index.
。
因此完整的班级名称是:
de.lmu.ifi.dbs.elki.index.tree.spatial.rstarvariants.rstar.RStarTreeFactory
或者您只需输入RStarTreeFactory
,然后让eclipse自动修复导入:
params.addParameter(AbstractDatabase.Parameterizer.INDEX_ID,
RStarTreeFactory.class);
// Bulk loading static data yields much better trees and is much faster, too.
params.addParameter(RStarTreeFactory.Parameterizer.BULK_SPLIT_ID,
SortTileRecursiveBulkSplit.class);
// Page size should fit your dimensionality.
// For 2-dimensional data, use page sizes less than 1000.
// Rule of thumb: 15...20 * (dim * 8 + 4) is usually reasonable
// (for in-memory bulk-loaded trees)
params.addParameter(AbstractPageFileFactory.Parameterizer.PAGE_SIZE_ID, 300);