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

FIX: moved java docs to abstract methods

parent b5168746
No related branches found
No related tags found
No related merge requests found
......@@ -51,21 +51,11 @@ class InternalNode extends Node implements Serializable {
return nearestChild.orElseThrow(() -> new IllegalStateException("Internal node has no children"));
}
/**
* Adds {@code object} into this node.
*
* @param object object to be added
*/
@Override
protected void addObject(LocalAbstractObject object) {
addObjectIntoHull(object);
}
/**
* Returns the list of objects stored in node's descendants.
*
* @return the list of objects stored in node's descendants
*/
@Override
protected List<LocalAbstractObject> getObjects() {
return children
......@@ -75,11 +65,6 @@ class InternalNode extends Node implements Serializable {
.collect(Collectors.toList());
}
/**
* Returns the height of this node.
*
* @return the height of this node
*/
@Override
protected int getHeight() {
return children
......@@ -89,22 +74,12 @@ class InternalNode extends Node implements Serializable {
.getMax() + 1;
}
/**
* Adds this node and this node's descendants into {@code nodes}.
*
* @param nodes list of nodes
*/
@Override
protected void gatherNodes(List<Node> nodes) {
nodes.add(this);
children.forEach(child -> child.gatherNodes(nodes));
}
/**
* Calls {@code gatherLeafNodes} on every child.
*
* @param leafNodes list of leaf nodes
*/
@Override
protected void gatherLeafNodes(List<LeafNode> leafNodes) {
children.forEach(child -> child.gatherLeafNodes(leafNodes));
......
......@@ -33,22 +33,20 @@ public class LeafNode extends Node implements Serializable {
}
/**
* Adds {@code object} to the node's bucket.
* Returns the number of objects stored in node's bucket.
*
* @param object object to be added
* @throws BucketStorageException addition of object into bucket exception
* @return the number of objects stored in node's bucket
*/
protected int getObjectCount() {
return bucket.getObjectCount();
}
@Override
protected void addObject(LocalAbstractObject object) throws BucketStorageException {
bucket.addObject(object);
addObjectIntoHull(object);
}
/**
* Returns a list of objects in node's bucket.
*
* @return a list of objects in node's bucket
*/
@Override
public List<LocalAbstractObject> getObjects() {
List<LocalAbstractObject> objects = new ArrayList<>(bucket.getObjectCount());
......@@ -60,40 +58,16 @@ public class LeafNode extends Node implements Serializable {
return objects;
}
/**
* Returns the number of objects stored in node's bucket.
*
* @return the number of objects stored in node's bucket
*/
protected int getObjectCount() {
return bucket.getObjectCount();
}
/**
* Returns the height of this node.
*
* @return the height of this node
*/
@Override
protected int getHeight() {
return 0;
}
/**
* Adds this node into {@code nodes}.
*
* @param nodes list of nodes
*/
@Override
protected void gatherNodes(List<Node> nodes) {
nodes.add(this);
}
/**
* Adds this node into {@code leafNodes}.
*
* @param leafNodes list of leaf nodes
*/
@Override
protected void gatherLeafNodes(List<LeafNode> leafNodes) {
leafNodes.add(this);
......
......@@ -99,14 +99,40 @@ public abstract class Node implements Serializable {
}
}
/**
* Adds {@code object} into this node, possibly adding {@code object} to the bucket.
*
* @param object object to be added
* @throws BucketStorageException bucket exception
*/
protected abstract void addObject(LocalAbstractObject object) throws BucketStorageException;
/**
* Returns objects from buckets, such that the leaf node is descendants of the current node.
*
* @return objects from buckets, such that the leaf node is descendants of the current node.
*/
protected abstract List<LocalAbstractObject> getObjects();
/**
* Returns the height of this node.
*
* @return the height of this node
*/
protected abstract int getHeight();
/**
* Adds this node and descendants into {@code nodes}.
*
* @param nodes list of nodes
*/
protected abstract void gatherNodes(List<Node> nodes);
/**
* Adds every descendant leaf node into {@code leafNodes}.
*
* @param leafNodes list of leaf nodes
*/
protected abstract void gatherLeafNodes(List<LeafNode> leafNodes);
private void insertGreedy(LocalAbstractObject 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