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
7848d415
There was an error fetching the commit references. Please try again later.
Verified
Commit
7848d415
authored
3 years ago
by
David Procházka
Browse files
Options
Downloads
Patches
Plain Diff
ADD: optimization when the new node is build on every object, public methods
parent
0812ae51
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/Node.java
+24
-5
24 additions, 5 deletions
src/mhtree/Node.java
with
24 additions
and
5 deletions
src/mhtree/Node.java
+
24
−
5
View file @
7848d415
...
@@ -11,7 +11,7 @@ import java.util.Collection;
...
@@ -11,7 +11,7 @@ import java.util.Collection;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
abstract
class
Node
implements
Serializable
{
public
abstract
class
Node
implements
Serializable
{
/**
/**
* Serialization ID
* Serialization ID
...
@@ -38,9 +38,32 @@ abstract class Node implements Serializable {
...
@@ -38,9 +38,32 @@ abstract class Node implements Serializable {
.
flatMap
(
Collection:
:
stream
)
.
flatMap
(
Collection:
:
stream
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
if
(
nodes
.
size
()
==
distances
.
getObjectCount
())
{
return
new
InternalNode
(
distances
,
insertType
,
objectToNodeDistance
,
nodes
);
}
return
new
InternalNode
(
distances
.
getSubset
(
objects
),
insertType
,
objectToNodeDistance
,
nodes
);
return
new
InternalNode
(
distances
.
getSubset
(
objects
),
insertType
,
objectToNodeDistance
,
nodes
);
}
}
/**
* Returns a list of hull objects.
*
* @return a list of hull objects
*/
public
List
<
LocalAbstractObject
>
getHullObjects
()
{
return
hull
.
getHull
();
}
/**
* Returns true if the {@code object} is covered.
*
* @param object the object to be checked
* @return true if the {@code object} is covered.
*/
public
boolean
isCovered
(
LocalAbstractObject
object
)
{
return
hull
.
isExternalCovered
(
object
);
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"Node{hull="
+
hull
+
'}'
;
return
"Node{hull="
+
hull
+
'}'
;
...
@@ -66,10 +89,6 @@ abstract class Node implements Serializable {
...
@@ -66,10 +89,6 @@ abstract class Node implements Serializable {
return
!
isLeaf
();
return
!
isLeaf
();
}
}
protected
List
<
LocalAbstractObject
>
getHullObjects
()
{
return
hull
.
getHull
();
}
protected
int
getHullObjectCount
()
{
protected
int
getHullObjectCount
()
{
return
hull
.
getRepresentativesCount
();
return
hull
.
getRepresentativesCount
();
}
}
...
...
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