be.ac.ulg.montefiore.run.totem.chart.model
Class ChartData

java.lang.Object
  extended by be.ac.ulg.montefiore.run.totem.chart.model.ChartData

public class ChartData
extends java.lang.Object

Class to maintain the collected data to use in charts. It represent a 2-dimensional array of double. Each row and column has an unique string identifier (because it may serve as a key in the JFreeChart dataset).

Author:
Ga�l Monfort (monfort@run.montefiore.ulg.ac.be)
See Also:

Creation date: 16 d�c. 2005


Constructor Summary
ChartData()
           
 
Method Summary
 void addRow(java.lang.String name, double[] row)
          Add a row to the data.
 void addRow(java.lang.String name, float[] row)
          Add a row to the data.
 void dump()
          for debug purposes
 int getColumnCount()
           
 java.lang.String[] getColumnTitles()
          get the names of the columns
 double[] getMaximum()
           
 double[] getMean()
           
 double[] getMinimum()
           
 double[] getPercentile(int percentile)
           
 double[] getPercentile10()
           
 double[] getRow(int index)
          Return a specific row given its index
 double[] getRow(java.lang.String name)
          Return a specific row given its name
 int getRowCount()
           
 int getRowIndex(java.lang.String name)
          get the index of a specific row given its name
 java.lang.String getRowTitle(int index)
          get the unique name of a row given its position (index)
 double[] getStandardDeviation()
           
 void removeRow(int index)
          remove a row from the data given its index
 void removeRow(java.lang.String name)
          remove a row from the data given its name
 void setColumnTitles(java.lang.String[] columnTitles)
          Set the name of the columns.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChartData

public ChartData()
Method Detail

addRow

public void addRow(java.lang.String name,
                   float[] row)
            throws InvalidChartDataException
Add a row to the data.

Parameters:
name - Unique name of the new row
row - array containing the data
Throws:
InvalidChartDataException - if a row with the same name already exists.

addRow

public void addRow(java.lang.String name,
                   double[] row)
            throws InvalidChartDataException
Add a row to the data.

Parameters:
name - Unique name of the new row
row - array containing the data
Throws:
InvalidChartDataException - if a row with the same name already exists.

getRowCount

public int getRowCount()
Returns:
the number of rows.

getColumnCount

public int getColumnCount()
Returns:
the number of columns or -1 if it is not yet defined. The number of column is not defined if there are no data and no column titles.

getRow

public double[] getRow(java.lang.String name)
Return a specific row given its name

Parameters:
name - name of the row to be returned
Returns:
double array representing the row data

getRow

public double[] getRow(int index)
Return a specific row given its index

Parameters:
index -
Returns:
double array representing the row data

getRowIndex

public int getRowIndex(java.lang.String name)
get the index of a specific row given its name

Parameters:
name -
Returns:

removeRow

public void removeRow(java.lang.String name)
remove a row from the data given its name

Parameters:
name -

removeRow

public void removeRow(int index)
remove a row from the data given its index

Parameters:
index -

getRowTitle

public java.lang.String getRowTitle(int index)
get the unique name of a row given its position (index)

Parameters:
index -
Returns:

getColumnTitles

public java.lang.String[] getColumnTitles()
get the names of the columns

Returns:

setColumnTitles

public void setColumnTitles(java.lang.String[] columnTitles)
                     throws InvalidChartDataException
Set the name of the columns. The column names should be unique (not checked here). Also define the number of elements of each row to be added.

Parameters:
columnTitles -
Throws:
InvalidChartDataException - If there are already some data and the number of columnTitles does not match the number of elements of the already defined rows.

dump

public void dump()
for debug purposes


getMaximum

public double[] getMaximum()
Returns:
an array of size getRowCount() containing the max value of each row

getMinimum

public double[] getMinimum()
Returns:
an array of size getRowCount() containing the min value of each row

getMean

public double[] getMean()
Returns:
an array of size getRowCount() containing the mean value of each row

getStandardDeviation

public double[] getStandardDeviation()
Returns:
an array of size getRowCount() containing the standard deviation value of each row

getPercentile

public double[] getPercentile(int percentile)
Returns:
an array of size getRowCount() containing the specified percentile value of each row

getPercentile10

public double[] getPercentile10()
Returns:
an array of size getRowCount() containing the percentile 10 value of each row


Copyright © 2004-2007 Research Unit in Networking, All Rights Reserved.