This module can be used to work with matrices and provides several methods for manipulating a matrix represented by a two-dimensional array of integers.
-
binaryReverse(int x, int y):- This method takes a coordinates (
xandy) of an element. - If the element at the specified coordinates is 0, it changes to 1, and vice versa.
- The method modifies the matrix and returns it.
- This method takes a coordinates (
-
binaryTurnOn(int x, int y):- This method takes a coordinates (
xandy) of an element. - If the element at the specified coordinates is 0, it is set to 1.
- The method modifies the matrix and returns it.
- This method takes a coordinates (
-
binaryTurnOff(int x, int y):- This method is similar to
binaryTurnOn, but if the element at the specified coordinates is 1, it is set to 0.
- This method is similar to
-
rectangle(int x0, int x1, int y0, int y1):- This method takes a coordinates (
x0,x1,y0, andy1) defining a region. - It draws a filled rectangle within the specified area.
- The method modifies the matrix and returns it.
- This method takes a coordinates (
-
consoleDraw(SimpleMatrix matrix, String pixel):- This method takes a matrix and a string
pixelto use for displaying non-zero elements of the matrix. - It creates a string representation of the matrix where
pixelis used for non-zero elements and spaces for zero elements. - The result is returned as a string.
- This method takes a matrix and a string
-
guiDraw(SimpleMatrix matrix, String name, int height, int width):- This method takes a matrix, window name, as well as height and width to use for displaying matrix elements.
- It creates a graphical representation of the matrix.
- Method result: Creating a graphical representation of the matrix.