Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MH-Tree
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
disa
public
Hulls
MH-Tree
Commits
64dadd3f
There was an error fetching the commit references. Please try again later.
Verified
Commit
64dadd3f
authored
3 years ago
by
David Procházka
Browse files
Options
Downloads
Patches
Plain Diff
ADD: MH-Tree javadocs
parent
1dc06d06
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mhtree/MHTree.java
+51
-17
51 additions, 17 deletions
src/mhtree/MHTree.java
with
51 additions
and
17 deletions
src/mhtree/MHTree.java
+
51
−
17
View file @
64dadd3f
...
@@ -25,6 +25,9 @@ import static mhtree.InsertType.GREEDY;
...
@@ -25,6 +25,9 @@ import static mhtree.InsertType.GREEDY;
import
static
mhtree
.
MergingMethod
.
HULL_BASED_MERGE
;
import
static
mhtree
.
MergingMethod
.
HULL_BASED_MERGE
;
import
static
mhtree
.
ObjectToNodeDistance
.
NEAREST
;
import
static
mhtree
.
ObjectToNodeDistance
.
NEAREST
;
/**
* MH-Tree is a metric index utilizing metric hulls.
*/
public
class
MHTree
extends
Algorithm
implements
Serializable
{
public
class
MHTree
extends
Algorithm
implements
Serializable
{
/**
/**
...
@@ -33,19 +36,40 @@ public class MHTree extends Algorithm implements Serializable {
...
@@ -33,19 +36,40 @@ public class MHTree extends Algorithm implements Serializable {
private
static
final
long
serialVersionUID
=
42L
;
private
static
final
long
serialVersionUID
=
42L
;
/**
/**
*
M
inimal number of objects in leaf node
's bucket
.
*
The m
inimal number of objects in
a bucket of a
leaf node.
*/
*/
private
final
int
bucketCapacity
;
private
final
int
bucketCapacity
;
/**
/**
*
Arity
*
The maximal degree of an internal node.
*/
*/
private
final
int
arity
;
private
final
int
arity
;
/**
* The root node of MH-Tree.
*/
private
final
Node
root
;
private
final
Node
root
;
/**
* Specifies which method to use when adding a new object.
*/
private
final
InsertType
insertType
;
private
final
InsertType
insertType
;
/**
* Specifies how to measure distance between an object and a node.
*/
private
final
ObjectToNodeDistance
objectToNodeDistance
;
private
final
ObjectToNodeDistance
objectToNodeDistance
;
/**
* A dispatcher for maintaining a set of local buckets.
*/
private
final
BucketDispatcher
bucketDispatcher
;
private
final
BucketDispatcher
bucketDispatcher
;
/**
* Create a new MH-Tree.
*
* @param builder the result of MH-Tree bulk-loading algorithm
*/
@AlgorithmConstructor
(
description
=
"MH-Tree"
,
arguments
=
{
@AlgorithmConstructor
(
description
=
"MH-Tree"
,
arguments
=
{
"MH-Tree builder object"
,
"MH-Tree builder object"
,
})
})
...
@@ -129,18 +153,21 @@ public class MHTree extends Algorithm implements Serializable {
...
@@ -129,18 +153,21 @@ public class MHTree extends Algorithm implements Serializable {
operation
.
endOperation
();
operation
.
endOperation
();
}
}
public
Node
getRoot
()
{
/**
return
root
;
* Returns the number of objects in the tree.
}
*
* @return the number of objects in the tree
*/
public
int
getObjectCount
()
{
public
int
getObjectCount
()
{
return
bucketDispatcher
.
getObjectCount
();
return
bucketDispatcher
.
getObjectCount
();
}
}
public
List
<
LocalAbstractObject
>
getObjects
()
{
/**
return
root
.
getObjects
();
* Inserts a new object into the tree.
}
*
* @param operation contains the inserted object
* @throws BucketStorageException when adding the object into a node
*/
public
void
insert
(
InsertOperation
operation
)
throws
BucketStorageException
{
public
void
insert
(
InsertOperation
operation
)
throws
BucketStorageException
{
LocalAbstractObject
object
=
operation
.
getInsertedObject
();
LocalAbstractObject
object
=
operation
.
getInsertedObject
();
...
@@ -179,6 +206,9 @@ public class MHTree extends Algorithm implements Serializable {
...
@@ -179,6 +206,9 @@ public class MHTree extends Algorithm implements Serializable {
return
leafNodes
;
return
leafNodes
;
}
}
/**
* Prints statistics about the tree.
*/
public
void
printStatistics
()
{
public
void
printStatistics
()
{
List
<
Node
>
nodes
=
getNodes
();
List
<
Node
>
nodes
=
getNodes
();
...
@@ -215,6 +245,10 @@ public class MHTree extends Algorithm implements Serializable {
...
@@ -215,6 +245,10 @@ public class MHTree extends Algorithm implements Serializable {
leafNodeObjects
.
getMax
());
leafNodeObjects
.
getMax
());
}
}
public
Node
getRoot
()
{
return
root
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"MHTree{"
+
return
"MHTree{"
+
...
@@ -236,12 +270,12 @@ public class MHTree extends Algorithm implements Serializable {
...
@@ -236,12 +270,12 @@ public class MHTree extends Algorithm implements Serializable {
private
final
List
<
LocalAbstractObject
>
objects
;
private
final
List
<
LocalAbstractObject
>
objects
;
/**
/**
*
M
inimal number of objects in bucket of a leaf node.
*
The m
inimal number of objects in
a
bucket of a leaf node.
*/
*/
private
final
int
bucketCapacity
;
private
final
int
bucketCapacity
;
/**
/**
*
M
aximal degree of an internal node.
*
The m
aximal degree of an internal node.
*/
*/
private
final
int
arity
;
private
final
int
arity
;
...
@@ -261,17 +295,17 @@ public class MHTree extends Algorithm implements Serializable {
...
@@ -261,17 +295,17 @@ public class MHTree extends Algorithm implements Serializable {
private
BucketDispatcher
bucketDispatcher
;
private
BucketDispatcher
bucketDispatcher
;
/**
/**
* Specifies the merging
strategy
.
* Specifies the merging
method
.
*/
*/
private
MergingMethod
mergingMethod
;
private
MergingMethod
mergingMethod
;
/**
/**
*
Precomputed
object distance
s
.
*
Contains the
object distance
matrix
.
*/
*/
private
AbstractRepresentation
.
PrecomputedDistances
objectDistances
;
private
AbstractRepresentation
.
PrecomputedDistances
objectDistances
;
/**
/**
* Stores intermediate nodes.
* Stores intermediate nodes
needed during the algorithm
.
*/
*/
private
Node
[]
nodes
;
private
Node
[]
nodes
;
...
@@ -281,12 +315,12 @@ public class MHTree extends Algorithm implements Serializable {
...
@@ -281,12 +315,12 @@ public class MHTree extends Algorithm implements Serializable {
private
BitSet
validNodeIndices
;
private
BitSet
validNodeIndices
;
/**
/**
*
Precomputed
node distance
s
.
*
Contains the
node distance
matrix
.
*/
*/
private
PrecomputedNodeDistances
nodeDistances
;
private
PrecomputedNodeDistances
nodeDistances
;
/**
/**
*
Root
of MH-Tree.
*
The root node
of MH-Tree.
*/
*/
private
Node
root
;
private
Node
root
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment