$darkmode
DENOPTIM
denoptim.fragmenter.DynamicCentroidCluster Class Reference

A cluster with a centroid that can be updated after definition of the cluster. More...

Collaboration diagram for denoptim.fragmenter.DynamicCentroidCluster:
[legend]

Public Member Functions

 DynamicCentroidCluster ()
 Constructor that defines an empty cluster. More...
 
 DynamicCentroidCluster (ClusterableFragment centroid)
 Constructor that defines the current centroid to be a clone of the given fragment and adds the given fragment as a member of the cluster. More...
 
ClusterableFragment getCentroid ()
 Get the point chosen to be the centroid of this cluster. More...
 
ClusterableFragment getNearestToCentroid (DistanceMeasure measure)
 Gets the original data that upon clustering is closest to the cluster centroid according to the given distance metrics. More...
 
void addPoint (ClusterableFragment point)
 Add a new member of this cluster. More...
 
void removeAll (Collection< ClusterableFragment > points)
 Remove the given cluster member, if it is a member of this cluster. More...
 
List< ClusterableFragmentgetPoints ()
 Get the points contained in the cluster. More...
 

Private Attributes

List< ClusterableFragmentpoints
 The points contained in this cluster. More...
 
ClusterableFragment centroid
 Current centroid. More...
 
boolean updateCentroid = false
 Flag requesting the update of the centroid. More...
 

Detailed Description

A cluster with a centroid that can be updated after definition of the cluster.

The centroid is updated every time we request to get the centroid and there has been an operation that changed the members (i.e., a points in the cluster) of this cluster (i.e., addition or removal of members).

Author
Marco Foscato

Definition at line 19 of file DynamicCentroidCluster.java.

Constructor & Destructor Documentation

◆ DynamicCentroidCluster() [1/2]

denoptim.fragmenter.DynamicCentroidCluster.DynamicCentroidCluster ( )

Constructor that defines an empty cluster.

Centroid will be defined in the first call of addPoint(ClusterableFragment) as a clone of the added fragment.

Definition at line 44 of file DynamicCentroidCluster.java.

◆ DynamicCentroidCluster() [2/2]

denoptim.fragmenter.DynamicCentroidCluster.DynamicCentroidCluster ( ClusterableFragment  centroid)

Constructor that defines the current centroid to be a clone of the given fragment and adds the given fragment as a member of the cluster.

Parameters
centroidthe current centroid.

Definition at line 56 of file DynamicCentroidCluster.java.

References denoptim.fragmenter.DynamicCentroidCluster.centroid, and denoptim.fragmenter.ClusterableFragment.clone().

Here is the call graph for this function:

Member Function Documentation

◆ addPoint()

void denoptim.fragmenter.DynamicCentroidCluster.addPoint ( ClusterableFragment  point)

Add a new member of this cluster.

Parameters
pointthe member to add.

Definition at line 123 of file DynamicCentroidCluster.java.

References denoptim.fragmenter.DynamicCentroidCluster.centroid, denoptim.fragmenter.ClusterableFragment.clone(), denoptim.fragmenter.DynamicCentroidCluster.points, and denoptim.fragmenter.DynamicCentroidCluster.updateCentroid.

Referenced by denoptim.fragmenter.FragmentClusterer.mergeClusters(), denoptim.fragmenter.DynamicCentroidClusterTest.testGetCentroid(), and denoptim.fragmenter.DynamicCentroidClusterTest.testGetNearestToCentroid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCentroid()

ClusterableFragment denoptim.fragmenter.DynamicCentroidCluster.getCentroid ( )

Get the point chosen to be the centroid of this cluster.

Returns
chosen cluster centroid

Definition at line 69 of file DynamicCentroidCluster.java.

References denoptim.fragmenter.DynamicCentroidCluster.centroid, denoptim.utils.MathUtils.centroidOf(), denoptim.fragmenter.ClusterableFragment.getPoint(), denoptim.fragmenter.DynamicCentroidCluster.getPoints(), denoptim.fragmenter.ClusterableFragment.setCoordsVector(), and denoptim.fragmenter.DynamicCentroidCluster.updateCentroid.

Referenced by denoptim.fragmenter.DynamicCentroidCluster.getNearestToCentroid(), denoptim.fragmenter.FragmentClusterer.mergeClusters(), and denoptim.fragmenter.DynamicCentroidClusterTest.testGetCentroid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNearestToCentroid()

ClusterableFragment denoptim.fragmenter.DynamicCentroidCluster.getNearestToCentroid ( DistanceMeasure  measure)

Gets the original data that upon clustering is closest to the cluster centroid according to the given distance metrics.

Parameters
measurethe distance metrics to use to determine which data is closest to the centroid.
Returns
the cluster member that is closest to the cluster centroid.

Definition at line 96 of file DynamicCentroidCluster.java.

References denoptim.fragmenter.DynamicCentroidCluster.centroid, denoptim.fragmenter.DynamicCentroidCluster.getCentroid(), denoptim.fragmenter.ClusterableFragment.getPoint(), and denoptim.fragmenter.DynamicCentroidCluster.points.

Referenced by denoptim.fragmenter.DynamicCentroidClusterTest.testGetNearestToCentroid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPoints()

List< ClusterableFragment > denoptim.fragmenter.DynamicCentroidCluster.getPoints ( )

Get the points contained in the cluster.

Returns
points contained in the cluster

Definition at line 153 of file DynamicCentroidCluster.java.

References denoptim.fragmenter.DynamicCentroidCluster.points.

Referenced by denoptim.fragmenter.DynamicCentroidCluster.getCentroid(), and denoptim.fragmenter.FragmentClusterer.mergeClusters().

Here is the caller graph for this function:

◆ removeAll()

void denoptim.fragmenter.DynamicCentroidCluster.removeAll ( Collection< ClusterableFragment points)

Remove the given cluster member, if it is a member of this cluster.

Parameters
pointsthe member to remove.

Definition at line 141 of file DynamicCentroidCluster.java.

References denoptim.fragmenter.DynamicCentroidCluster.points, and denoptim.fragmenter.DynamicCentroidCluster.updateCentroid.

Referenced by denoptim.fragmenter.FragmentClusterer.mergeClusters().

Here is the caller graph for this function:

Member Data Documentation

◆ centroid

◆ points

◆ updateCentroid

boolean denoptim.fragmenter.DynamicCentroidCluster.updateCentroid = false
private

Flag requesting the update of the centroid.

Turns true when we modify the list of members of this cluster.

Definition at line 35 of file DynamicCentroidCluster.java.

Referenced by denoptim.fragmenter.DynamicCentroidCluster.addPoint(), denoptim.fragmenter.DynamicCentroidCluster.getCentroid(), and denoptim.fragmenter.DynamicCentroidCluster.removeAll().


The documentation for this class was generated from the following file: