|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.datastructure.FlexibleTable
public class FlexibleTable
This is a 2D table that can shrink or grow by row or by column. The labels to the rows and columns are for printing and debugging. The access to the table is by indices. All indices count from 1. Translation between labels and indices are provided.
| Constructor Summary | |
|---|---|
FlexibleTable(FlexibleTable that)
Copy constructor. |
|
FlexibleTable(int nRows,
int nCols)
Construct a table using default labeling. |
|
FlexibleTable(java.lang.Object[] rowLabels,
java.lang.Object[] colLabels)
Construct a table by row and column labels, initializing the content to 0. |
|
FlexibleTable(java.lang.Object[] rowLabels,
java.lang.Object[] colLabels,
double[][] cells)
Construct a flexible table that can shrink or grow. |
|
| Method Summary | |
|---|---|
void |
addColAt(int i)
Add a column at i. |
void |
addColAt(int i,
java.lang.Object label)
Add a column at i. |
void |
addRowAt(int i)
Add a row at i. |
void |
addRowAt(int i,
java.lang.Object label)
Add a row at i. |
void |
deleteCol(int i)
Delete column i. |
void |
deleteRow(int i)
Delete row i. |
boolean |
equals(java.lang.Object obj)
|
double |
get(int i,
int j)
Get the matrix entry at [i,j]. |
java.lang.Object |
getColLabel(int i)
Get the label for column i. |
Vector |
getColumn(int col)
|
int |
getIndexFromColLabel(java.lang.Object label)
Translate a column label to a column index. |
int |
getIndexFromRowLabel(java.lang.Object label)
Translate a row label to a row index. |
Vector |
getRow(int row)
|
java.lang.Object |
getRowLabel(int i)
Get the label for row i. |
int |
hashCode()
|
int |
nCols()
Get the number of columns. |
int |
nRows()
Get the number of rows. |
void |
renameCol(int i,
java.lang.Object label)
Rename column i. |
void |
renameRow(int i,
java.lang.Object label)
Rename row i. |
void |
set(int i,
int j,
double value)
Set the matrix entry at [i,j] to a value. |
DenseMatrix |
toMatrix()
Get a copy of the flexible table in the form of a matrix. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FlexibleTable(java.lang.Object[] rowLabels,
java.lang.Object[] colLabels,
double[][] cells)
rowLabels - the row labelscolLabels - the column labelscells - the table content
public FlexibleTable(java.lang.Object[] rowLabels,
java.lang.Object[] colLabels)
rowLabels - the row labelscolLabels - the column labels
public FlexibleTable(int nRows,
int nCols)
nRows - number of rowsnCols - number of columnspublic FlexibleTable(FlexibleTable that)
that - another FlexibleTable| Method Detail |
|---|
public int nRows()
Table
nRows in interface Tablepublic int nCols()
Table
nCols in interface Table
public void set(int i,
int j,
double value)
MatrixAccess
set in interface MatrixAccessi - the row indexj - the column indexvalue - the value to set A[i,j] to
public double get(int i,
int j)
MatrixAccess
get in interface MatrixAccessi - the row indexj - the column index
public Vector getRow(int row)
throws MatrixAccessException
MatrixAccessException
public Vector getColumn(int col)
throws MatrixAccessException
MatrixAccessExceptionpublic int getIndexFromRowLabel(java.lang.Object label)
label - a row label
public int getIndexFromColLabel(java.lang.Object label)
label - a column label
public java.lang.Object getRowLabel(int i)
i - a row index, counting from 1
public java.lang.Object getColLabel(int i)
i - a column index, counting from 1
public void renameRow(int i,
java.lang.Object label)
i - a row index, counting from 1label - the new label
public void renameCol(int i,
java.lang.Object label)
i - a column index, counting from 1label - the new labelpublic void deleteRow(int i)
i - a row index, counting from 1public void deleteCol(int i)
i - a column index, counting from 1
public void addRowAt(int i,
java.lang.Object label)
i - the row index, counting from 1label - the row labelpublic void addRowAt(int i)
i - the row index, counting from 1
public void addColAt(int i,
java.lang.Object label)
i - the column index, counting from 1label - the column labelpublic void addColAt(int i)
i - the column index, counting from 1public DenseMatrix toMatrix()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||