|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsbrt.kernel.math.algebra.MatrixWrap<R,C,E>
R
- the row type.C
- the column type.E
- the element type.public class MatrixWrap<R,C,E>
This class is used to wrap mutable matrices as an immutable matrix. This type of wrapping eliminates the possibility of casting a mutable matrix back to its mutable type. This ensures that a mutable matrix can be viewed by others in a safe way, without fear of modification.
Instances of this class are immutable.
Constructor Summary | |
---|---|
MatrixWrap(Matrix<R,C,E> m)
Constructs a new wrapper around the provided matrix. |
Method Summary | |
---|---|
int |
columns()
Returns the number of columns in this matrix. |
boolean |
equals(java.lang.Object obj)
Indicates if the provided object is equal to this matrix. |
Matrix<R,C,E> |
getColumn(java.lang.Object columnIndex)
Returns the column corresponding to the provided column index. |
UnmodifiableSet<C> |
getColumnIndices()
Returns the set of column indices contained in this matrix. |
E |
getElement(java.lang.Object rowIndex,
java.lang.Object columnIndex)
Returns the element of this matrix at the provided row and column indices. |
Matrix<R,C,E> |
getRow(java.lang.Object rowIndex)
Returns the row corresponding to the provided row index. |
UnmodifiableSet<R> |
getRowIndices()
Returns the set of row indices contained in this matrix. |
int |
hashCode()
Returns a content-based hash code for this matrix. |
boolean |
isColumnIndex(java.lang.Object obj)
Indicates if the provided object is a column index in this matrix. |
boolean |
isEmpty()
Indicates if this matrix is empty. |
boolean |
isRowIndex(java.lang.Object obj)
Indicates if the provided object is a row index in this matrix. |
int |
rows()
Returns the number of rows in this matrix. |
java.lang.String |
toString()
Returns a string representation of this matrix. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MatrixWrap(Matrix<R,C,E> m)
m
- the matrix to be wrapped by this wrapper object.
java.lang.NullPointerException
- if the provided matrix is
null
.Method Detail |
---|
public E getElement(java.lang.Object rowIndex, java.lang.Object columnIndex)
getElement
in interface Matrix<R,C,E>
rowIndex
- the row index.columnIndex
- the column index.
public UnmodifiableSet<C> getColumnIndices()
getColumnIndices
in interface Matrix<R,C,E>
public UnmodifiableSet<R> getRowIndices()
getRowIndices
in interface Matrix<R,C,E>
public boolean isRowIndex(java.lang.Object obj)
isRowIndex
in interface Matrix<R,C,E>
obj
- the potential row index.
true
if the provided object is a row
index in this matrix; false
otherwise.public boolean isColumnIndex(java.lang.Object obj)
isColumnIndex
in interface Matrix<R,C,E>
obj
- the potential column index.
true
if the provided object is a column
index in this matrix; false
otherwise.public Matrix<R,C,E> getRow(java.lang.Object rowIndex)
getRow
in interface Matrix<R,C,E>
rowIndex
- the index of the row to be returned.
public Matrix<R,C,E> getColumn(java.lang.Object columnIndex)
getColumn
in interface Matrix<R,C,E>
columnIndex
- the index of the column to be returned.
public int rows()
rows
in interface Matrix<R,C,E>
public int columns()
columns
in interface Matrix<R,C,E>
public boolean isEmpty()
isEmpty
in interface Matrix<R,C,E>
true
if at least one row and column exists
in this matrix; false
otherwise.public java.lang.String toString()
toString
in interface Matrix<R,C,E>
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in interface Matrix<R,C,E>
equals
in class java.lang.Object
obj
- the object with which to compare.
true
if this object equals the provided
object; false
otherwise.public int hashCode()
hashCode
in interface Matrix<R,C,E>
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |