edu.umd.cfar.lamp.viper.util
Interface DataMatrix2d

All Known Implementing Classes:
PackedMatrix, SparseMatrix

public interface DataMatrix2d

A generalized interface for a 2 dimensional matrix of Objects.

Author:
David Mihalcik
See Also:
MatrixIndexOutOfBoundsException

Method Summary
 java.lang.Object get(int column, int row)
          Returns the object at the given location.
 MatrixIterator getMatrixIterator()
          Returns a MatrixIterator for this matrix.
 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.
 

Method Detail

width

public int width()
Returns the current real height, that is, the index of the rightmost column that contains data +1.

Returns:
An integer set to the index eastmost column containing data +1.

height

public int height()
Returns the current real height, that is, the largest row number (+1) that contains data.

Returns:
An integer set to the index northmost column containing data +1.

sizeWide

public int sizeWide()
Get the logical width of the matrix. This is equivalent to the number of possible columns, x-length, or .length.

Returns:
The maximum possible column index + 1.

sizeHigh

public int sizeHigh()
Get the logical height of the matrix. This is equivalent to the number of rows, y-length, or [0].length.

Returns:
The maximum possible row index + 1.

set

public void set(int column,
                int row,
                java.lang.Object data)
         throws MatrixIndexOutOfBoundsException
Sets the data at the specific location to the given value.

Parameters:
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.
Throws:
MatrixIndexOutOfBoundsException - if the index is not within the boundaries of this matrix.

get

public java.lang.Object get(int column,
                            int row)
                     throws MatrixIndexOutOfBoundsException
Returns the object at the given location.

Parameters:
column - The column (x position) of the cell to get.
row - The row (y position) of the cell to get.
Returns:
A reference to the object in the specified cell, or null if none is found.
Throws:
MatrixIndexOutOfBoundsException - if the index is not within the boundaries of this matrix.

remove

public java.lang.Object remove(int column,
                               int row)
                        throws MatrixIndexOutOfBoundsException
Sets the object at the specified location to null. It will no longer be found by a MatrixIterator or an unordered Iterator.

Parameters:
column - The column (x position) of the cell to remove.
row - The row (y position) of the cell to remove.
Returns:
A reference to the object that was in the specified cell, or null if none is found.
Throws:
MatrixIndexOutOfBoundsException - if the index is not within the boundaries of this matrix.

getMatrixIterator

public MatrixIterator getMatrixIterator()
Returns a MatrixIterator for this matrix.

Returns:
A MatrixIterator that can find all set cells.