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

FIX: moved condition to better place, based on the suggestion of the linter

parent 3fe17d0b
No related branches found
No related tags found
No related merge requests found
...@@ -57,7 +57,7 @@ public class MHTree extends Algorithm implements Serializable { ...@@ -57,7 +57,7 @@ public class MHTree extends Algorithm implements Serializable {
PriorityQueue<ObjectToNodeDistanceRank> queue = new PriorityQueue<>(); PriorityQueue<ObjectToNodeDistanceRank> queue = new PriorityQueue<>();
queue.add(new ObjectToNodeDistanceRank(root, object)); queue.add(new ObjectToNodeDistanceRank(root, object));
while (!queue.isEmpty() && operation.getAnswerCount() < operation.getK()) { while (!queue.isEmpty()) {
Node currentNode = queue.poll().getNode(); Node currentNode = queue.poll().getNode();
if (currentNode.isLeaf()) { if (currentNode.isLeaf()) {
...@@ -67,6 +67,9 @@ public class MHTree extends Algorithm implements Serializable { ...@@ -67,6 +67,9 @@ public class MHTree extends Algorithm implements Serializable {
operation.addToAnswer(obj); operation.addToAnswer(obj);
} }
if (operation.getAnswerCount() >= operation.getK())
break;
} else { } else {
for (Node child : ((InternalNode) currentNode).getChildren()) for (Node child : ((InternalNode) currentNode).getChildren())
queue.add(new ObjectToNodeDistanceRank(child, object)); queue.add(new ObjectToNodeDistanceRank(child, object));
......
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