public interface Matrix
This interface is intended to provide methods for initialising and accessing the values of the matrix regardless of the storage method used.
Implementations could use binary matrices, I/O objects, etc...
| Modifier and Type | Method and Description |
|---|---|
int |
get(int i,
int j)
Returns the value at the given position.
|
void |
incrementByMaxPath(int i,
int j)
Increment by the maximum path.
|
void |
incrementPathBy(int i,
int j,
int n)
Increment the path.
|
boolean |
isGreaterX(int i,
int j)
Returns
true we should move on the X direction. |
boolean |
isGreaterY(int i,
int j)
Returns
true we should move on the X direction. |
boolean |
isSameXY(int i,
int j)
Returns
true we moving on the X direction is
equivalent to moving on the Y direction. |
void |
release()
Releases all the resources used only by this matrix object.
|
void |
set(int i,
int j,
int x)
Sets the value of the matrix at the given position.
|
void |
setup(int width,
int height)
Create a matrix of the given width and height.
|
void setup(int width,
int height)
width - The number of columns.height - The number of rows.void set(int i,
int j,
int x)
i - The column index.j - The row index.x - The value to set.int get(int i,
int j)
i - The column index.j - The row index.void incrementPathBy(int i,
int j,
int n)
value(i, j) := value(i+1, j+1) + n
i - The column index.j - The row index.n - The increment number.void incrementByMaxPath(int i,
int j)
value(i, j) := max( value(i+1, j) , value(i, j+1) )
i - The column index.j - The row index.boolean isGreaterX(int i,
int j)
true we should move on the X direction.
if value(i+1, j) > value(i, j+1)
i - The column index.j - The row index.true to move to i+1;
false otherwise.boolean isGreaterY(int i,
int j)
true we should move on the X direction.
if value(i+1, j) < value(i, j+1)
i - The column index.j - The row index.true to move to j+1;
false otherwise.boolean isSameXY(int i,
int j)
true we moving on the X direction is
equivalent to moving on the Y direction.
if value(i+1, j) == value(i, j+1)
i - The column index.j - The row index.true if it is the same;
false otherwise.void release()
This class is not usable, until after invoking this method, unless it is setup again.
Copyright © 2007-2022. All Rights Reserved.