本文整理汇总了Java中ch.ethz.globis.phtree.PhTree.queryExtent方法的典型用法代码示例。如果您正苦于以下问题:Java PhTree.queryExtent方法的具体用法?Java PhTree.queryExtent怎么用?Java PhTree.queryExtent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.ethz.globis.phtree.PhTree
的用法示例。
在下文中一共展示了PhTree.queryExtent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testNullValues
import ch.ethz.globis.phtree.PhTree; //导入方法依赖的package包/类
@Test
public void testNullValues() {
PhTree<long[]> ind = create(2);
ind.put(new long[]{0, 0}, null);
ind.put(new long[]{1, 1}, new long[]{1, 1});
ind.put(new long[]{2, 2}, null);
//check empty result
Iterator<long[]> it;
//check full result
//it = ind.query(0, 50, 0, 50, 0, 50, 0, 50, 0, 50);
it = ind.query(new long[]{0, 0}, new long[]{50, 50});
assertNull(it.next());
assertNotNull(it.next());
assertNull(it.next());
assertFalse(it.hasNext());
//check extent
it = ind.queryExtent();
assertNull(it.next());
assertNotNull(it.next());
assertNull(it.next());
assertFalse(it.hasNext());
}
示例2: export
import ch.ethz.globis.phtree.PhTree; //导入方法依赖的package包/类
@Override
public <T2> void export(PhTree<T2> tree, String filename) throws FileNotFoundException {
try (Output output = createOutput(filename)) {
Kryo kryo = kryos.get();
PhIterator<T2> it = tree.queryExtent();
while (it.hasNext()) {
kryo.writeClassAndObject(output, it.nextEntry());
}
output.flush();
}
}
示例3: sort
import ch.ethz.globis.phtree.PhTree; //导入方法依赖的package包/类
public static <V> IndexEntryList<long[], V> sort(IndexEntryList<long[], V> entries) {
if (entries.size() == 0) {
return new IndexEntryList<>();
}
PhTree<V> tree = createTree(entries);
IndexEntryList<long[], V> output = new IndexEntryList<>();
PhIterator<V> it = tree.queryExtent();
while (it.hasNext()) {
PhEntry<V> entry = it.nextEntry();
output.add(entry.getKey(), entry.getValue());
}
return output;
}
示例4: getAllEntries
import ch.ethz.globis.phtree.PhTree; //导入方法依赖的package包/类
private IndexEntryList<long[], byte[]> getAllEntries() {
PhTree<byte[]> phTree = indexContext.getTree();
IndexEntryList<long[], byte[]> entries = new IndexEntryList<>();
PhIterator<byte[]> it = phTree.queryExtent();
while (it.hasNext()) {
PhEntry<byte[]> e = it.nextEntry();
entries.add(e.getKey(), e.getValue());
}
return entries;
}
示例5: nearestNeighbor1
import ch.ethz.globis.phtree.PhTree; //导入方法依赖的package包/类
private long[] nearestNeighbor1(PhTree<?> tree, long[] q) {
double d = Double.MAX_VALUE;
long[] best = null;
PhIterator<?> i = tree.queryExtent();
while (i.hasNext()) {
long[] cand = i.nextKey();
double dNew = dist(q, cand);
if (dNew < d) {
d = dNew;
best = cand;
}
}
return best;
}
示例6: rangeQuery
import ch.ethz.globis.phtree.PhTree; //导入方法依赖的package包/类
private ArrayList<long[]> rangeQuery(PhTree<?> tree, double range, long[] q) {
ArrayList<long[]> points = new ArrayList<>();
PhIterator<?> i = tree.queryExtent();
while (i.hasNext()) {
long[] cand = i.nextKey();
double dNew = dist(q, cand);
if (dNew < range) {
points.add(cand);
}
}
return points;
}