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

ADD: validation checks on MH-Tree params

parent 48c20dbd
No related branches found
No related tags found
No related merge requests found
...@@ -288,6 +288,22 @@ public class MHTree extends Algorithm implements Serializable { ...@@ -288,6 +288,22 @@ public class MHTree extends Algorithm implements Serializable {
private Node root; private Node root;
public Builder(List<LocalAbstractObject> objects, int bucketCapacity, int arity) { public Builder(List<LocalAbstractObject> objects, int bucketCapacity, int arity) {
if (objects == null) {
throw new NullPointerException("List of objects is null");
}
if (objects.size() < 3) {
throw new IllegalArgumentException("Number of objects cannot by smaller than 3");
}
if (bucketCapacity < 3) {
throw new IllegalArgumentException("Bucket capacity cannot be smaller than 3");
}
if (arity < 2) {
throw new IllegalArgumentException("Arity cannot be smaller than 2");
}
this.objects = objects; this.objects = objects;
this.bucketCapacity = bucketCapacity; this.bucketCapacity = bucketCapacity;
this.arity = arity; this.arity = arity;
......
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