public class FlexibleTable extends Object implements MatrixTable
Constructor and Description |
---|
FlexibleTable(FlexibleTable that)
Copy constructor.
|
FlexibleTable(int nRows,
int nCols)
Constructs a table using default labeling.
|
FlexibleTable(Object[] rowLabels,
Object[] colLabels)
Constructs a table by row and column labels, initializing the content to 0.
|
FlexibleTable(Object[] rowLabels,
Object[] colLabels,
double[][] cells)
Constructs a flexible table that can shrink or grow.
|
Modifier and Type | Method and Description |
---|---|
void |
addColAt(int i)
Adds a column at i.
|
void |
addColAt(int i,
Object label)
Adds a column at i.
|
void |
addRowAt(int i)
Adds a row at i.
|
void |
addRowAt(int i,
Object label)
Adds a row at i.
|
void |
deleteCol(int i)
Deletes column i.
|
void |
deleteRow(int i)
Deletes row i.
|
boolean |
equals(Object obj) |
double |
get(int i,
int j)
Get the matrix entry at [i,j].
|
Object |
getColLabel(int i)
Gets the label for column i.
|
Vector |
getColumn(int col) |
int |
getIndexFromColLabel(Object label)
Translates a column label to a column index.
|
int |
getIndexFromRowLabel(Object label)
Translates a row label to a row index.
|
Vector |
getRow(int row) |
Object |
getRowLabel(int i)
Gets the label for row i.
|
int |
hashCode() |
int |
nCols()
Gets the number of columns.
|
int |
nRows()
Gets the number of rows.
|
void |
renameCol(int i,
Object label)
Renames column i.
|
void |
renameRow(int i,
Object label)
Renames row i.
|
void |
set(int i,
int j,
double value)
Set the matrix entry at [i,j] to a value.
|
DenseMatrix |
toMatrix()
Gets a copy of the flexible table in the form of a matrix.
|
String |
toString() |
public FlexibleTable(Object[] rowLabels, Object[] colLabels, double[][] cells)
rowLabels
- the row labelscolLabels
- the column labelscells
- the table contentpublic FlexibleTable(Object[] rowLabels, Object[] colLabels)
rowLabels
- the row labelscolLabels
- the column labelspublic FlexibleTable(int nRows, int nCols)
nRows
- number of rowsnCols
- number of columnspublic FlexibleTable(FlexibleTable that)
that
- another FlexibleTable
public int nRows()
Table
public int nCols()
Table
public void set(int i, int j, double value)
MatrixAccess
set
in interface MatrixAccess
i
- the row indexj
- the column indexvalue
- the value to set A[i,j] topublic double get(int i, int j)
MatrixAccess
get
in interface MatrixAccess
i
- the row indexj
- the column indexpublic Vector getRow(int row) throws MatrixAccessException
MatrixAccessException
public Vector getColumn(int col) throws MatrixAccessException
MatrixAccessException
public int getIndexFromRowLabel(Object label)
label
- a row labelpublic int getIndexFromColLabel(Object label)
label
- a column labelpublic Object getRowLabel(int i)
i
- a row index, counting from 1public Object getColLabel(int i)
i
- a column index, counting from 1public void renameRow(int i, Object label)
i
- a row index, counting from 1label
- the new labelpublic void renameCol(int i, 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 1public void addRowAt(int i, Object label)
i
- the row index, counting from 1label
- the row labelpublic void addRowAt(int i)
i
- the row index, counting from 1public void addColAt(int i, 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()
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.