messif.pivotselection
Class ClusterPivotChooser.Cluster

java.lang.Object
  extended by messif.pivotselection.ClusterPivotChooser.Cluster
Enclosing class:
ClusterPivotChooser

protected class ClusterPivotChooser.Cluster
extends java.lang.Object

Class encapsulating objects of one cluster and storing the cluster's radius.


Field Summary
protected  int id
          Id of the cluster
protected  AbstractObjectList<LocalAbstractObject> objects
          List of objects of this cluster
protected  float radius
          Diameter of a cluster if cluster1 and cluster2 were merged.
 
Constructor Summary
ClusterPivotChooser.Cluster(ClusterPivotChooser.Cluster model)
          Copy constructor
ClusterPivotChooser.Cluster(int id, LocalAbstractObject object, ClusterPivotChooser.PrecomputedDistances pd)
          Create a new Cluster containing just the passed object.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 AbstractObjectIterator<LocalAbstractObject> getAllObjects()
          Returns all objects of this cluster as an iterator.
 LocalAbstractObject getClusteroid()
          Returns an object (clusteriod) that is in the center of this cluster.
 int getId()
          Returns identification of this cluster
 LocalAbstractObject getObject(int index)
          Retrieves an object at the passed index.
 float getRadius()
          Covering radius of this cluster (maximum distance between a pair of objects of this cluster).
 int hashCode()
           
 void mergeWithCluster(ClusterPivotChooser.Cluster cluster, ClusterPivotChooser.PrecomputedDistances pd)
          Merge this cluster with the passed cluster and set the new cluster's radius.
 int size()
          Size of the cluster
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

radius

protected float radius
Diameter of a cluster if cluster1 and cluster2 were merged.


id

protected int id
Id of the cluster


objects

protected AbstractObjectList<LocalAbstractObject> objects
List of objects of this cluster

Constructor Detail

ClusterPivotChooser.Cluster

public ClusterPivotChooser.Cluster(int id,
                                   LocalAbstractObject object,
                                   ClusterPivotChooser.PrecomputedDistances pd)
Create a new Cluster containing just the passed object.

Parameters:
id - identification of the cluster
object - single object that forms the cluster
pd - cache of precomputed distances between all pairs of objects

ClusterPivotChooser.Cluster

public ClusterPivotChooser.Cluster(ClusterPivotChooser.Cluster model)
Copy constructor

Parameters:
model - a cluster to create a copy of
Method Detail

getClusteroid

public LocalAbstractObject getClusteroid()
Returns an object (clusteriod) that is in the center of this cluster. This object has the minimum sum of distance to the other objects of this cluster than the others.

Returns:
clusteroid of this cluster

getRadius

public float getRadius()
Covering radius of this cluster (maximum distance between a pair of objects of this cluster).

Returns:
radius of this cluster

size

public int size()
Size of the cluster

Returns:
nubmer of objects of this cluster

getId

public int getId()
Returns identification of this cluster

Returns:
cluster's id

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getObject

public LocalAbstractObject getObject(int index)
Retrieves an object at the passed index.

Parameters:
index - index of objects to retrive
Returns:
object that is at the passed index in the list of objects forming this cluster

getAllObjects

public AbstractObjectIterator<LocalAbstractObject> getAllObjects()
Returns all objects of this cluster as an iterator.

Returns:
iterator over all objects in this cluster

mergeWithCluster

public void mergeWithCluster(ClusterPivotChooser.Cluster cluster,
                             ClusterPivotChooser.PrecomputedDistances pd)
Merge this cluster with the passed cluster and set the new cluster's radius.

Parameters:
cluster - a cluster to add to this
pd - cache of precomputed distances between all pairs of objects