本文整理了Java中de.lmu.ifi.dbs.elki.database.relation.Relation.getHierarchy
方法的一些代码示例,展示了Relation.getHierarchy
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Relation.getHierarchy
方法的具体详情如下:
包路径:de.lmu.ifi.dbs.elki.database.relation.Relation
类名称:Relation
方法名:getHierarchy
暂无
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
/**
* Do some (limited) type checking, then cast the database into a spatial
* database.
*
* @param relation Database
* @return Metrical index
* @throws IllegalStateException when the cast fails.
*/
private MetricalIndexTree<O, N, E> getMetricalIndex(Relation<O> relation) throws IllegalStateException {
Class<MetricalIndexTree<O, N, E>> mcls = ClassGenericsUtil.uglyCastIntoSubclass(MetricalIndexTree.class);
ArrayList<MetricalIndexTree<O, N, E>> indexes = ResultUtil.filterResults(relation.getHierarchy(), relation, mcls);
// FIXME: check we got the right the representation
if(indexes.size() == 1) {
return indexes.get(0);
}
if(indexes.size() > 1) {
throw new IllegalStateException("More than one metrical index found - this is not supported!");
}
throw new IllegalStateException("No metrical index found!");
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
/**
* Get (or create) a scales result for a relation.
*
* @param rel Relation
* @return associated scales result
*/
public static ScalesResult getScalesResult(final Relation<? extends SpatialComparable> rel) {
Collection<ScalesResult> scas = ResultUtil.filterResults(rel.getHierarchy(), rel, ScalesResult.class);
if(scas.size() == 0) {
final ScalesResult newsca = new ScalesResult(rel);
addChildResult(rel, newsca);
return newsca;
}
return scas.iterator().next();
}
代码示例来源:origin: elki-project/elki
/**
* Get (or create) a scales result for a relation.
*
* @param rel Relation
* @return associated scales result
*/
public static ScalesResult getScalesResult(final Relation<? extends SpatialComparable> rel) {
Collection<ScalesResult> scas = ResultUtil.filterResults(rel.getHierarchy(), rel, ScalesResult.class);
if(scas.isEmpty()) {
final ScalesResult newsca = new ScalesResult(rel);
ResultUtil.addChildResult(rel, newsca);
return newsca;
}
return scas.iterator().next();
}
}
代码示例来源:origin: elki-project/elki
/**
* Get the sampling result attached to a relation
*
* @param rel Relation
* @return Sampling result.
*/
public static SamplingResult getSamplingResult(final Relation<?> rel) {
Collection<SamplingResult> selections = ResultUtil.filterResults(rel.getHierarchy(), rel, SamplingResult.class);
if(selections.isEmpty()) {
final SamplingResult newsam = new SamplingResult(rel);
ResultUtil.addChildResult(rel, newsam);
return newsam;
}
return selections.iterator().next();
}
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
/**
* Get the sampling result attached to a relation
*
* @param rel Relation
* @return Sampling result.
*/
public static SamplingResult getSamplingResult(final Relation<?> rel) {
Collection<SamplingResult> selections = ResultUtil.filterResults(rel.getHierarchy(), rel, SamplingResult.class);
if(selections.size() == 0) {
final SamplingResult newsam = new SamplingResult(rel);
addChildResult(rel, newsam);
return newsam;
}
return selections.iterator().next();
}
代码示例来源:origin: elki-project/elki
/**
* Inner run method. This returns a double store, and is used by
* {@link de.lmu.ifi.dbs.elki.index.preprocessed.knn.KNNJoinMaterializeKNNPreprocessor}
*
* @param relation Data relation
* @param ids Object IDs
* @return Data store
*/
public WritableDataStore<KNNList> run(Relation<V> relation, DBIDs ids) {
if(!(getDistanceFunction() instanceof SpatialPrimitiveDistanceFunction)) {
throw new IllegalStateException("Distance Function must be an instance of " + SpatialPrimitiveDistanceFunction.class.getName());
}
Collection<SpatialIndexTree<N, E>> indexes = ResultUtil.filterResults(relation.getHierarchy(), relation, SpatialIndexTree.class);
if(indexes.size() != 1) {
throw new MissingPrerequisitesException("KNNJoin found " + indexes.size() + " spatial indexes, expected exactly one.");
}
SpatialIndexTree<N, E> index = indexes.iterator().next();
return run(index, ids);
}
代码示例来源:origin: elki-project/elki
protected SpatialIndexTree<N, E> getSpatialIndex(Relation<O> relation) {
SpatialIndexTree<N, E> ret = null;
for(It<SpatialIndexTree<N, E>> iter = relation.getHierarchy().iterDescendants(relation).filter(SpatialIndexTree.class); iter.valid(); iter.advance()) {
if(ret != null) {
throw new IllegalStateException("More than one spatial index found - this is not supported!");
}
// FIXME: check we got the right the representation
ret = (SpatialIndexTree<N, E>) iter.get();
}
if(ret == null) {
throw new IllegalStateException("No spatial index found!");
}
return ret;
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-index-rtree
protected SpatialIndexTree<N, E> getSpatialIndex(Relation<O> relation) {
SpatialIndexTree<N, E> ret = null;
for(It<SpatialIndexTree<N, E>> iter = relation.getHierarchy().iterDescendants(relation).filter(SpatialIndexTree.class); iter.valid(); iter.advance()) {
if(ret != null) {
throw new IllegalStateException("More than one spatial index found - this is not supported!");
}
// FIXME: check we got the right the representation
ret = (SpatialIndexTree<N, E>) iter.get();
}
if(ret == null) {
throw new IllegalStateException("No spatial index found!");
}
return ret;
}
代码示例来源:origin: elki-project/elki
/**
* Do some (limited) type checking, then cast the database into a spatial
* database.
*
* @param relation Database
* @return Metrical index
* @throws IllegalStateException when the cast fails.
*/
private MetricalIndexTree<O, N, E> getMetricalIndex(Relation<? extends O> relation) throws IllegalStateException {
MetricalIndexTree<O, N, E> ret = null;
for(It<MetricalIndexTree<O, N, E>> iter = relation.getHierarchy().iterDescendants(relation).filter(MetricalIndexTree.class); iter.valid(); iter.advance()) {
if(ret != null) {
throw new IllegalStateException("More than one metrical index found - this is not supported!");
}
// FIXME: check we got the right the representation
ret = iter.get();
}
if(ret == null) {
throw new IllegalStateException("No metrical index found!");
}
return ret;
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-index-mtree
/**
* Do some (limited) type checking, then cast the database into a spatial
* database.
*
* @param relation Database
* @return Metrical index
* @throws IllegalStateException when the cast fails.
*/
private MetricalIndexTree<O, N, E> getMetricalIndex(Relation<? extends O> relation) throws IllegalStateException {
MetricalIndexTree<O, N, E> ret = null;
for(It<MetricalIndexTree<O, N, E>> iter = relation.getHierarchy().iterDescendants(relation).filter(MetricalIndexTree.class); iter.valid(); iter.advance()) {
if(ret != null) {
throw new IllegalStateException("More than one metrical index found - this is not supported!");
}
// FIXME: check we got the right the representation
ret = iter.get();
}
if(ret == null) {
throw new IllegalStateException("No metrical index found!");
}
return ret;
}
代码示例来源:origin: elki-project/elki
/**
* Remove the previous relation.
*
* Manually also log index statistics, as we may be removing indexes.
*
* @param relation Relation to remove
*/
protected void removePreviousRelation(Relation<?> relation) {
if(keep) {
return;
}
boolean first = true;
for(It<Index> it = relation.getHierarchy().iterDescendants(relation).filter(Index.class); it.valid(); it.advance()) {
if(first) {
Logging.getLogger(getClass()).statistics("Index statistics when removing initial data relation.");
first = false;
}
it.get().logStatistics();
}
ResultUtil.removeRecursive(relation.getHierarchy(), relation);
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
throw new IllegalStateException("Distance Function must be an instance of " + SpatialPrimitiveDistanceFunction.class.getName());
Collection<SpatialIndexTree<N, E>> indexes = ResultUtil.filterResults(relation.getHierarchy(), relation, SpatialIndexTree.class);
if(indexes.size() != 1) {
throw new AbortException("KNNJoin found " + indexes.size() + " spatial indexes, expected exactly one.");
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
MaterializeKNNPreprocessor<O> preproc = new MaterializeKNNPreprocessor<>(relation, distf, lim);
preproc.initialize();
relation.getHierarchy().add(relation, preproc);
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
DistanceQuery<O> distanceQuery = relation.getDistanceQuery(distanceFunction);
Collection<SpatialIndexTree<N, E>> indexes = ResultUtil.filterResults(relation.getHierarchy(), relation, SpatialIndexTree.class);
if(indexes.size() != 1) {
throw new AbortException(SpatialApproximationMaterializeKNNPreprocessor.class.getSimpleName() + " found " + indexes.size() + " spatial indexes, expected exactly one.");
代码示例来源:origin: elki-project/elki
MaterializeKNNPreprocessor<O> preproc = new MaterializeKNNPreprocessor<>(relation, distf, lim);
preproc.initialize();
relation.getHierarchy().add(relation, preproc);
内容来源于网络,如有侵权,请联系作者删除!