public class Table2D
extends java.lang.Object
Note that this table converts all keys to lower case to deal with Spice, which converts everything to lower case. User: gainsley Date: Nov 16, 2006
Constructor and Description |
---|
Table2D(double[] rowVals,
java.lang.String rowName,
double[] colVals,
java.lang.String colName)
Create a new Table2D.
|
Modifier and Type | Method and Description |
---|---|
static double |
getAverage(double[] vals)
Get the average (mean) of a set of values
|
static double |
getAverage(double[][] vals)
Get the average (mean) of all values
|
double |
getAvgColumnValue(java.lang.String key,
int colIndex)
Get the average (mean) value for a particular column.
|
double[] |
getAvgColumnValues(java.lang.String key)
Get the average (mean) values for columns.
|
double |
getAvgRowValue(java.lang.String key,
int rowIndex)
Get the average (mean) value for a particular row.
|
double[] |
getAvgRowValues(java.lang.String key)
Get the average (mean) values for rows.
|
double[] |
getColIndexVals()
Get the index values for the columns
|
java.lang.String |
getColName()
Get the name of the column header name
|
double[] |
getColumnValues(java.lang.String key,
int colIndex)
Get the values in a column for a specific set of data.
|
int |
getNumCols()
Get the number of columns in the table
|
int |
getNumRows()
Get the number of rows in the table
|
double[] |
getRowIndexVals()
Get the index values for the rows
|
java.lang.String |
getRowName()
Get the name of the row header name
|
double[] |
getRowValues(java.lang.String key,
int rowIndex)
Get the values in a row for a specific set of data.
|
static double |
getStandardDeviation(double[] vals)
Get the standard deviation of a set of values
|
static double |
getStandardDeviation(double[][] vals)
Get the standard deviation of a set of values
|
double |
getValue(double rowVal,
double colVal,
java.lang.String dataKey)
Get the value for a given row and column value.
|
double[][] |
getValues(java.lang.String key)
Get values[rows][cols] for the specified key
|
void |
print()
Print to System.out a nicely formatted ASCII table
of all data in this Table2D.
|
void |
print(java.lang.String key)
Print a nicely formatted ASCII table of the data
for the given key
|
void |
setData(java.lang.String dataKey,
double[][] data)
Set the data for a given data key.
|
void |
setValue(double rowVal,
double colVal,
java.lang.String dataKey,
double value)
Set the value for a given row and column value.
|
public Table2D(double[] rowVals, java.lang.String rowName, double[] colVals, java.lang.String colName)
rowVals
- row index valuesrowName
- name of the row index paramcolVals
- column index valuescolName
- name of the column index parampublic java.lang.String getRowName()
public java.lang.String getColName()
public int getNumRows()
public int getNumCols()
public double[] getColIndexVals()
public double[] getRowIndexVals()
public void setValue(double rowVal, double colVal, java.lang.String dataKey, double value)
rowVal
- the row index valuecolVal
- the column index valuedataKey
- the key for the data setvalue
- the value at the row and column valuepublic double getValue(double rowVal, double colVal, java.lang.String dataKey)
rowVal
- the row index valuecolVal
- the column index valuedataKey
- the key for the data setpublic void setData(java.lang.String dataKey, double[][] data)
dataKey
- the data keydata
- the datapublic double[] getColumnValues(java.lang.String key, int colIndex)
key
- denotes the set of data to usecolIndex
- which column to get datapublic double[] getRowValues(java.lang.String key, int rowIndex)
key
- denotes the set of data to userowIndex
- which row to getpublic static double getAverage(double[] vals)
vals
- the valuespublic static double getStandardDeviation(double[] vals)
vals
- the valuespublic static double getAverage(double[][] vals)
vals
- the valuespublic static double getStandardDeviation(double[][] vals)
vals
- the valuespublic double getAvgColumnValue(java.lang.String key, int colIndex)
key
- the data keycolIndex
- the column index (not column value)public double[] getAvgColumnValues(java.lang.String key)
key
- the data keypublic double getAvgRowValue(java.lang.String key, int rowIndex)
key
- the data keyrowIndex
- the row index (not row value)public double[] getAvgRowValues(java.lang.String key)
key
- the data keypublic double[][] getValues(java.lang.String key)
key
- which data setpublic void print()
public void print(java.lang.String key)
key
- the key