The number of rows in the 2-dimensional array
nCols
private int nCols
The number of columns in the 2-dimensional array
matrix
public int matrix[][]
The 2-dimensional integer
array
Allocate space for the 2-dimensional array. Set the size of the array to be nRows by nCols
Matrix
public Matrix(Matrix m)
Copy the contents of Matrix
m
Returns true if Matrix m
has the same elements as the current matrix
else return false
orMatrix
public static Matrix orMatrix(Matrix m1, Matrix
m2)
Performs a boolean OR operation
on Matrix m1 and Matrix m2 and returns the result of the OR operation
This operation assumes that
all the contents in both matrices are either 1 or 0
or
public int or(int v1, int v2)
Performs a boolean OR operation on the two integers. This operation assumes that both integer values are either 1 or 0.
shiftLeft
public Matrix shiftLeft(int x)
Returns a copy of the current
Matrix with its contents shifted left by 'x' amount. During each shift
a column of 0s is added
to the right end of the
Matrix.
print
public void print()
Prints the contents of the current Matrix onto the Java Console.
print
public void print(TextPanel panel)
Prints the contents of the Matrix onto a TextPanel object.
getRows
public int getRows()
Returns the value of nRows
getCols
public int getCols()
Returns the value of nCols