|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.umd.cfar.lamp.viper.util.SparseMatrix
This class implements a simple 2-dimensional sparse matrix.
MatrixIndexOutOfBoundsException
Constructor Summary | |
SparseMatrix()
Creates an empty matrix. |
|
SparseMatrix(DataMatrix2d old,
java.util.BitSet cols,
java.util.BitSet rows)
Creates a new SparseMatrix , carving out from
an old one. |
|
SparseMatrix(int maxWidth,
int maxHeight)
Creates a new SparseMatrix that cannot
have data beyond the specified dimensions. |
Method Summary | |
boolean |
equals(java.lang.Object other)
Determines if this is the same as another DataMatrix2d .
|
java.lang.Object |
get(int column,
int row)
Returns the object at the given location. |
MatrixIterator |
getMatrixIterator()
Returns a MatrixIterator for this matrix. |
int |
getUsedNodeCount()
Gets the current count of occupied cells. |
int |
height()
Returns the current real height, that is, the largest row number (+1) that contains data. |
java.lang.Object |
remove(int column,
int row)
Sets the object at the specified location to null. |
void |
set(int column,
int row,
java.lang.Object data)
Sets the data at the specific location to the given value. |
int |
sizeHigh()
Get the logical height of the matrix. |
int |
sizeWide()
Get the logical width of the matrix. |
int |
width()
Returns the current real height, that is, the index of the rightmost column that contains data +1. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SparseMatrix()
Integer.MAX_VALUE
.
public SparseMatrix(int maxWidth, int maxHeight)
SparseMatrix
that cannot
have data beyond the specified dimensions.
maxWidth
- The greatest column offset.maxHeight
- The greatest row offset.public SparseMatrix(DataMatrix2d old, java.util.BitSet cols, java.util.BitSet rows)
SparseMatrix
, carving out from
an old one. Logically, it creates a matrix of the count
of all set bits in cols
wide and the count
of all set bits in rows
high, and fills it
with the data from those rows and columns in the old matrix.
old
- The matrix to canabalize.cols
- The columns to copy.rows
- The rows to copy.Method Detail |
public boolean equals(java.lang.Object other)
DataMatrix2d
.
Requires that all of the data implement equals() as well.
other
- Another DataMatrix2d
.
true
if the other has all the same data as this.public int width()
width
in interface DataMatrix2d
public int height()
height
in interface DataMatrix2d
public int sizeWide()
sizeWide
in interface DataMatrix2d
public int sizeHigh()
sizeHigh
in interface DataMatrix2d
public void set(int column, int row, java.lang.Object data)
set
in interface DataMatrix2d
column
- The column (x position) of the cell to set.row
- The row (y position) of the cell to set.data
- The object to put into the specified cell.public java.lang.Object get(int column, int row)
get
in interface DataMatrix2d
column
- The column (x position) of the cell to get.row
- The row (y position) of the cell to get.
public java.lang.Object remove(int column, int row)
remove
in interface DataMatrix2d
column
- The column (x position) of the cell to remove.row
- The row (y position) of the cell to remove.
public int getUsedNodeCount()
public MatrixIterator getMatrixIterator()
getMatrixIterator
in interface DataMatrix2d
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |