jminhep.cluster
Class DataHolder

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

public class DataHolder
extends Object
implements Serializable

Represents an abstraction for a data holder in many dimensional space. All cluster operations are done using this holder

See Also:
Serialized Form

Constructor Summary
DataHolder()
          Creates a new empty instance of data holder
DataHolder(DataPoint xMin, DataPoint xMax, int Dim, int Size)
          Creates data holder with random number Input:
DataHolder(int dim)
          Creates a new empty instance of data point
DataHolder(String name)
          Creates a new empty instance of data point
 
Method Summary
 void add(DataPoint p)
          Add a data point to the holder
 void add(double[] xx)
          Add a new instance to data holder in form of array
 void analyseSet()
          Analyse the data holder by calculating min and max.
 void clear()
          Clear current data holder
 void fillRandom(DataPoint xMin, DataPoint xMax, int Dim, int Size)
          Fill an existing data holder with random numbers
 DataPoint[] getArray()
          Get the data in form of Array
 ArrayList getArrayList()
          Get all elements of the data holder in form of an ArrayList
 int getDimention()
          Get the dimension of the data
 double[] getElement(int n)
          Get array of elements at position n of the data holder
 DataPoint getMax()
          Get Max values of the data
 DataPoint getMin()
          Get Min values of the data holder
 String getName(int i)
          Get name of the i-th attribute
 String getRelation()
          Get name of the data holder (i.e.
 DataPoint getRow(int n)
          Get DataPoint at the position n
 int getSize()
          Get size of the data holder
static void main(String[] args)
          Main method -- to test the DataPoint class
 void print()
          Print all entries of the data holder
 void read(String file)
          Reads the input data from the ARFF file and stores in the data holder
 void setDimention(int Dim)
          Set the dimension of the data
 void setName(int i, String title)
          Set the title for ith component
 void setRelation(String s)
          Set relation (name) of the data holder
 String toString()
          Convert to string all entries of the data holder
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataHolder

public DataHolder()
Creates a new empty instance of data holder


DataHolder

public DataHolder(int dim)
Creates a new empty instance of data point

Parameters:
dim - dimension

DataHolder

public DataHolder(String name)
Creates a new empty instance of data point

Parameters:
name - Name of this data holder

DataHolder

public DataHolder(DataPoint xMin,
                  DataPoint xMax,
                  int Dim,
                  int Size)
Creates data holder with random number Input:

Parameters:
xMin - min number of DataPoint
xMax - max number of DataPoint
Dim - integer dimension of DataPoint
Size - number of rows
Method Detail

fillRandom

public void fillRandom(DataPoint xMin,
                       DataPoint xMax,
                       int Dim,
                       int Size)
Fill an existing data holder with random numbers

Parameters:
xMin - Min DataPoint
xMax - Max DataPoint
Dim - Dimension of DataPoint
Size - Number of rows

getArrayList

public ArrayList getArrayList()
Get all elements of the data holder in form of an ArrayList

Returns:
ArrayList

getArray

public DataPoint[] getArray()
Get the data in form of Array

Returns:
DataPoint[]

clear

public void clear()
Clear current data holder


add

public void add(DataPoint p)
Add a data point to the holder

Parameters:
p - New point

setRelation

public void setRelation(String s)
Set relation (name) of the data holder

Parameters:
s - name to be set

add

public void add(double[] xx)
Add a new instance to data holder in form of array

Parameters:
xx - array

read

public void read(String file)
Reads the input data from the ARFF file and stores in the data holder


getDimention

public int getDimention()
Get the dimension of the data

Returns:
dimension (int)

setDimention

public void setDimention(int Dim)
Set the dimension of the data

Parameters:
Dim - dimension

analyseSet

public void analyseSet()
Analyse the data holder by calculating min and max. You can access these values by calling GetMin() anf GetMax()


getMin

public DataPoint getMin()
Get Min values of the data holder

Returns:
DataPoint

getMax

public DataPoint getMax()
Get Max values of the data

Returns:
DataPoint

getSize

public int getSize()
Get size of the data holder

Returns:
Size of the data holder (int)

getRelation

public String getRelation()
Get name of the data holder (i.e. relation)

Returns:
name of the data holder

getName

public String getName(int i)
Get name of the i-th attribute

Returns:
Name of the attribute

setName

public void setName(int i,
                    String title)
Set the title for ith component

Parameters:
i - Index of a component
title - New title

getElement

public double[] getElement(int n)
Get array of elements at position n of the data holder

Returns:
array with the data at a position n (double[])

getRow

public DataPoint getRow(int n)
Get DataPoint at the position n

Returns:
DataPoint

print

public void print()
Print all entries of the data holder


toString

public String toString()
Convert to string all entries of the data holder

Overrides:
toString in class Object

main

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

Parameters:
args - command line arguments


jHepWork 3.1 ©