|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.zaval.data.Matrix
This class is implementation of MatrixModel
interface and it used to organize
matrix-like structures.
Constructor Summary | |
Matrix(int rows,
int cols)
Constructs the matrix component with the specified number of rows an columns. |
Method Summary | |
void |
addMatrixListener(MatrixListener m)
Adds the matrix listener to be notified whenever the matrix cell has been updated or the matrix dimension has been changed. |
java.lang.Object |
get(int index)
Gets the value at the specified cell index. |
java.lang.Object |
get(int row,
int col)
Gets the value of the specified cell. |
int |
getCols()
Gets the number of columns. |
int |
getRows()
Gets the number of rows. |
java.awt.Dimension |
getSize()
Gets the matrix dimension. |
protected void |
perform(MatrixEvent e)
Fires the specified event to registered matrix listeners. |
void |
put(int row,
int col,
java.lang.Object obj)
Updates the specified cell with the specified value. |
java.awt.Point |
put(int index,
java.lang.Object obj)
Updates a cell with the specified value at the specified index. |
void |
removeCols(int begcol,
int count)
Removes the specified number of columns starting from the given column. |
void |
removeMatrixListener(MatrixListener m)
Removes the matrix listener. |
void |
removeRows(int begrow,
int count)
Removes the specified number of rows starting from the given row. |
void |
setCols(int cols)
Sets the number of columns. |
void |
setRows(int rows)
Sets the number of rows. |
void |
setSize(int rows,
int cols)
Sets the specified matrix dimension. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Matrix(int rows, int cols)
rows
- the specified number of rows.cols
- the specified number of columns.Method Detail |
public int getRows()
getRows
in interface MatrixModel
public int getCols()
getCols
in interface MatrixModel
public void setRows(int rows)
rows
- the specified number of rows.public void setCols(int cols)
cols
- the specified number of columns.public void setSize(int rows, int cols)
rows
- the specified number of rows.cols
- the specified number of columns.public java.awt.Dimension getSize()
width
field correspond to number of rows and height
field correspond to number of columns.public void put(int row, int col, java.lang.Object obj)
put
in interface MatrixModel
row
- the specified row.col
- the specified column.obj
- the specified value to update the cell value.public java.awt.Point put(int index, java.lang.Object obj)
((row*columns) + col)
. If the index is out of bounds the matrix dimension
than the matrix size will be extended automatically.index
- the specified index.obj
- the specified value to update the cell value.public java.lang.Object get(int row, int col)
get
in interface MatrixModel
row
- the specified row.col
- the specified column.public java.lang.Object get(int index)
index
- the specified cell index.public void removeRows(int begrow, int count)
begrow
- the first removed row.count
- the number of rows to be removed starting from the first row.public void removeCols(int begcol, int count)
begcol
- the first removed column.count
- the number of columns to be removed starting from the first column.public void addMatrixListener(MatrixListener m)
addMatrixListener
in interface MatrixModel
m
- the matrix listener.public void removeMatrixListener(MatrixListener m)
removeMatrixListener
in interface MatrixModel
m
- the matrix listener.protected void perform(MatrixEvent e)
e
- the specified event.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |