public class Matrix<T> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Matrix.IterationMode |
Constructor and Description |
---|
Matrix(Class<T> type,
int rows,
int columns) |
Matrix(T[][] data) |
Modifier and Type | Method and Description |
---|---|
protected T[] |
getArray(int arrayIndex) |
protected T[][] |
getData() |
T |
getElementAt(int rowIndex,
int colIndex) |
Class<T> |
getType() |
Iterable<T> |
iterate() |
Iterable<T> |
iterate(int centerRowIndex,
int centerColumnIndex,
double range) |
Iterable<T> |
iterate(int centerRowIndex,
int centerColumnIndex,
int squareRadius) |
Iterable<T> |
iterate(int firstRow,
int firstColumn,
int lastRow,
int lastColumn) |
protected Iterable<T> |
iterate(int firstRow,
int firstColumn,
int lastRow,
int lastColumn,
Double range) |
T |
setElementAt(int rowIndex,
int colIndex,
T newElement) |
void |
swapElements(int rowIndex1,
int colIndex1,
int rowIndex2,
int colIndex2) |
String |
toString() |
static <T> T[][] |
validateArray(T[][] array)
Validates if
array is a well-formed array in terms of a matrix. |
public Matrix(T[][] data)
public static <T> T[][] validateArray(T[][] array) throws MatrixException, NullPointerException
array
is a well-formed array in terms of a matrix.
Well-formed arrays meet the following criteria:
- Both dimensions have a size greater than 0.
- No nested array may be null.
- All nested arrays have the same size.
T
- array
- MatrixException
NullPointerException
protected T[][] getData()
protected T[] getArray(int arrayIndex)
public String toString()
toString
in class Object
Object.toString()
public T getElementAt(int rowIndex, int colIndex)
rowIndex
- colIndex
- public T setElementAt(int rowIndex, int colIndex, T newElement)
rowIndex
- colIndex
- newElement
- public void swapElements(int rowIndex1, int colIndex1, int rowIndex2, int colIndex2)
rowIndex1
- colIndex1
- rowIndex2
- colIndex2
- protected Iterable<T> iterate(int firstRow, int firstColumn, int lastRow, int lastColumn, Double range) throws IllegalArgumentException
IllegalArgumentException
public Iterable<T> iterate(int firstRow, int firstColumn, int lastRow, int lastColumn) throws IllegalArgumentException
firstRow
- firstColumn
- lastRow
- lastColumn
- IllegalArgumentException
public Iterable<T> iterate(int centerRowIndex, int centerColumnIndex, int squareRadius) throws IllegalArgumentException
IllegalArgumentException
public Iterable<T> iterate(int centerRowIndex, int centerColumnIndex, double range) throws IllegalArgumentException
IllegalArgumentException
Copyright © 2003–2023 XDEV Software. All rights reserved.