it.unibz.algorithms.types
Class Instance

java.lang.Object
  extended by it.unibz.algorithms.types.Instance

public class Instance
extends java.lang.Object

This class is a representation of a clustering point. It contains also the method that calculates the eclaudean distance and a second method that tests it.


Field Summary
private  Cluster cluster
           
private  double euclideanDistance
           
private  boolean isClassed
           
private  boolean isKey
           
private  double x
           
private  double y
           
 
Constructor Summary
Instance(java.lang.String value, java.lang.String value2)
          This constructor sets the the coordinates of a Instance
 
Method Summary
 void calcEuclideanDistance()
          This method calculates the euclidean distance
 double getCurrentEuDt()
          Returns the current euclidean distance
 double getX()
          This method return the x coordinate
 double getY()
          This method return the y coordinate
 boolean isClassed()
          This method tells whether the Instance is classed or not
 boolean isKey()
          Returns true whether if it is the key or false otherwise
 java.lang.String print()
          This method generates a string with the coordinates
 void setCluster(Cluster cluster)
          This method sets a new value to the cluster variable and calls the method that calculates the eucludean distance
 void setKey(boolean isKey)
          This method sets a new value to the instance variable isKey
 double testEuclideanDistance(Centroid c)
          This method is in charge of cheching the validity of the euclidean distance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

private double x

y

private double y

cluster

private Cluster cluster

euclideanDistance

private double euclideanDistance

isKey

private boolean isKey

isClassed

private boolean isClassed
Constructor Detail

Instance

public Instance(java.lang.String value,
                java.lang.String value2)
This constructor sets the the coordinates of a Instance

Parameters:
value - coordinate x
value2 - coordinate y
Method Detail

isKey

public boolean isKey()
Returns true whether if it is the key or false otherwise

Returns:
True if it is the key

setKey

public void setKey(boolean isKey)
This method sets a new value to the instance variable isKey

Parameters:
isKey - Boolean

isClassed

public boolean isClassed()
This method tells whether the Instance is classed or not

Returns:
True if the Instance is classed.

setCluster

public void setCluster(Cluster cluster)
This method sets a new value to the cluster variable and calls the method that calculates the eucludean distance

Parameters:
cluster - cluster object

calcEuclideanDistance

public void calcEuclideanDistance()
This method calculates the euclidean distance


testEuclideanDistance

public double testEuclideanDistance(Centroid c)
This method is in charge of cheching the validity of the euclidean distance

Parameters:
c - Centroid object
Returns:
double value

getX

public double getX()
This method return the x coordinate

Returns:
double x coordinate

getY

public double getY()
This method return the y coordinate

Returns:
double y coordinate

getCurrentEuDt

public double getCurrentEuDt()
Returns the current euclidean distance

Returns:
double the euclidean distance

print

public java.lang.String print()
This method generates a string with the coordinates

Returns:
String with the coordinates