Skip to content
Snippets Groups Projects
Verified Commit 922866b8 authored by David Procházka's avatar David Procházka
Browse files

ADD: custom object to node distance rank

parent fd70ba51
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,8 @@ package mhtree; ...@@ -2,6 +2,8 @@ package mhtree;
import messif.objects.LocalAbstractObject; import messif.objects.LocalAbstractObject;
import static mhtree.ObjectToNodeDistance.NEAREST;
/** /**
* Represents the rank of a node in the priority queue in a query operation. * Represents the rank of a node in the priority queue in a query operation.
*/ */
...@@ -12,7 +14,16 @@ public class ObjectToNodeDistanceRank implements Comparable<ObjectToNodeDistance ...@@ -12,7 +14,16 @@ public class ObjectToNodeDistanceRank implements Comparable<ObjectToNodeDistance
public ObjectToNodeDistanceRank(LocalAbstractObject object, Node node) { public ObjectToNodeDistanceRank(LocalAbstractObject object, Node node) {
this.node = node; this.node = node;
this.distance = node.getDistance(object);
if (node.isLeaf()) {
this.distance = NEAREST.getDistance(object, node);
} else {
if (node.isCovered(object)) {
this.distance = -node.getDistance(object);
} else {
this.distance = node.getDistance(object);
}
}
} }
@Override @Override
......
...@@ -52,7 +52,7 @@ public class RunBenchmark { ...@@ -52,7 +52,7 @@ public class RunBenchmark {
objectToNodeDistance objectToNodeDistance
), ),
objects, objects,
new int[]{1, 10, 25, 50, 100} new int[]{1, 10, 50, 100}
); );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment