jminhep.cluster
Class DataPoint

java.lang.Object
  extended by jminhep.cluster.DataPoint
All Implemented Interfaces:
java.io.Serializable

public class DataPoint
extends java.lang.Object
implements java.io.Serializable

Represents an abstraction for a data point in many-dimensional space

See Also:
Serialized Form

Constructor Summary
DataPoint(double[] xx)
          Creates a new instance of a data point
DataPoint(double[] xx, int dim)
          Creates a new instance of a data point
 
Method Summary
 void assignToCluster(int _clusterNumber)
          Assigns the data point to a cluster
static double distance(DataPoint dp1, DataPoint dp2)
          Returns the distance between two data points
static double distanceSqrt(DataPoint dp1, DataPoint dp2)
          Returns the squared distance between two data points
 double getAttribute(int index)
          Returns the attribute of data point
 int getClusterNumber()
          Returns the cluster to which the data point belongs
 int getDimension()
          Get dimension of the point
static void main(java.lang.String[] args)
          Main method -- to test the DataPoint class
 void showAttributes()
          Print all attributes of a data point
 java.lang.String toString()
          Returns a string representation of this DataPoint
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataPoint

public DataPoint(double[] xx,
                 int dim)
Creates a new instance of a data point

Parameters:
xx - array of dimension dim
dim - dimension

DataPoint

public DataPoint(double[] xx)
Creates a new instance of a data point

Parameters:
xx - array
Method Detail

getDimension

public int getDimension()
Get dimension of the point

Returns:
dimension (int)

assignToCluster

public void assignToCluster(int _clusterNumber)
Assigns the data point to a cluster

Parameters:
_clusterNumber - the cluster to which this data point is to be assigned

getClusterNumber

public int getClusterNumber()
Returns the cluster to which the data point belongs

Returns:
the cluster number to which the data point belongs

getAttribute

public double getAttribute(int index)
Returns the attribute of data point

Parameters:
index - current idex
Returns:
the value in many dimensions

showAttributes

public void showAttributes()
Print all attributes of a data point


distance

public static double distance(DataPoint dp1,
                              DataPoint dp2)
Returns the distance between two data points

Parameters:
dp1 - the first data point
dp2 - the second data point
Returns:
the distance between the two data points (double)

distanceSqrt

public static double distanceSqrt(DataPoint dp1,
                                  DataPoint dp2)
Returns the squared distance between two data points

Parameters:
dp1 - the first data point
dp2 - the second data point
Returns:
the distance between the two data points

toString

public java.lang.String toString()
Returns a string representation of this DataPoint

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this data point

main

public static void main(java.lang.String[] args)
Main method -- to test the DataPoint class

Parameters:
args - command line arguments


jHepWork 2.8 (©) S.Chekanov