Skip to content
Snippets Groups Projects
Commit 062c5dcd authored by Vlastislav Dohnal's avatar Vlastislav Dohnal
Browse files

Updates of comments and correcting bugs in hull update procedure (INCREMENTAL...

Updates of comments and correcting bugs in hull update procedure (INCREMENTAL one, which simply added a new non-cover object as an additional hull object). Now it does the optimization, i.e., replacing a existing hull object before adding the new object as a new hull object.
parent 1e0617f8
No related branches found
No related tags found
No related merge requests found
......@@ -6,11 +6,15 @@ package mhtree;
public enum InsertType {
/**
* When the inserted object is not covered by a node, all objects under such node are retrieved (recursively down to the buckets),
* and a new hull is built, replacing the current one.
* and a new hull is built from scratch, replacing the current one.
* This strategy should create hulls that cover all data under it, and it forms a "baseline" solution.
*/
GREEDY,
/**
* Take current hull objects and the newly inserted object together and compute a new hull out of them.
* This should do the "optimization" of an existing hull by replacing an existing hull object by the new object before enlarging the hull, as summarized below.
*
* When the inserted object is not covered by node, we iterate over hull objects beginning with the nearest one.
* We try to replace an existing hull object by replacing it with the inserted object.
* If the removed hull object is covered by the new hull, we are done.
......@@ -18,8 +22,8 @@ public enum InsertType {
*/
INCREMENTAL,
/** Take current hull objects and the newly inserted object and compute hull out of them.
* Vlasta: Is this identical to INCREMENTAL?
/**
* Add the non-covered object as a new hull object, so the hull is enlarged by one object.
*/
ADD_HULL_OBJECT,
}
......@@ -109,17 +109,18 @@ public abstract class Node implements Serializable {
}
protected void addObjectIntoHull(LocalAbstractObject object) {
if (isCovered(object)) return;
if (isCovered(object))
return;
switch (insertType) {
case GREEDY:
insertGreedy(object);
break;
case INCREMENTAL:
insertIncremental(object);
insertHullRebuild(object);
break;
case ADD_HULL_OBJECT:
insertHullRebuild(object);
insertAddNewHullObject(object);
break;
default:
throw new IllegalStateException("Unexpected value: " + insertType);
......@@ -170,9 +171,8 @@ public abstract class Node implements Serializable {
hull.build();
}
private void insertIncremental(LocalAbstractObject object) {
//hull.addHullObject(object);
hull.setHullObjects((List<LocalAbstractObject>) Collections.singleton(object));
private void insertAddNewHullObject(LocalAbstractObject object) {
hull.setHullObjects((List<LocalAbstractObject>) Collections.singleton(object)); // TODO: VLASTA: This does not update the hull by optimizing the hull objects but rather simply adds the new object as next hull object!!!!!
}
private void insertHullRebuild(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