dbStat
Class Cluster

java.lang.Object
  extended bydbStat.Cluster

public class Cluster
extends java.lang.Object

Cluster class that clusters all proximal vectors.

The collection of vectors is a unique set of attribute vectors that have been associated with the centroid vector of this cluster.


Field Summary
private  AttributeVector centroid
          an AttributeVector that represents the center of the cluster
private  int identity
          an integer to track and identify this unique cluster
private  java.util.ArrayList vectorList
          the list of AttributeVectors in the cluster
 
Constructor Summary
Cluster(AttributeVector firstVector)
          Constructor for the class creates a cluster with its first vector and sets this first vector as its centroid
 
Method Summary
 void addAttributeVector(AttributeVector attVector)
          Add a new vector to the cluster if it doesn't already exist in the cluster
 void calculateCentroid()
          Method to calculate the centroid for the cluster
 AttributeVector getCentroid()
          Gets the centroid vector for this cluster
 int getClusterSize()
          Gets the number of vectors this cluster contains
 AttributeVector getVectorByIndex(int index)
          Gets the attribute vector located at the specified index
 void removeAttributeVector(java.lang.String vectorID)
          Removes a given AttributeVector from the cluster
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

identity

private int identity
an integer to track and identify this unique cluster


vectorList

private java.util.ArrayList vectorList
the list of AttributeVectors in the cluster


centroid

private AttributeVector centroid
an AttributeVector that represents the center of the cluster

Constructor Detail

Cluster

public Cluster(AttributeVector firstVector)
Constructor for the class creates a cluster with its first vector and sets this first vector as its centroid

Method Detail

addAttributeVector

public void addAttributeVector(AttributeVector attVector)
Add a new vector to the cluster if it doesn't already exist in the cluster

Parameters:
attVector - New AttributeVector to be added

removeAttributeVector

public void removeAttributeVector(java.lang.String vectorID)
Removes a given AttributeVector from the cluster

Parameters:
vectorID - Identity of the vector to be removed

calculateCentroid

public void calculateCentroid()
Method to calculate the centroid for the cluster


getCentroid

public AttributeVector getCentroid()
Gets the centroid vector for this cluster

Returns:
the centroid vector

getClusterSize

public int getClusterSize()
Gets the number of vectors this cluster contains

Returns:
the number of vectors in this cluster

getVectorByIndex

public AttributeVector getVectorByIndex(int index)
Gets the attribute vector located at the specified index

Parameters:
index - the index to retrieve
Returns:
the attributes vector located at the specified index

toString

public java.lang.String toString()