| Constructor and Description |
|---|
MatrixShort() |
| 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()
Gets rid of the underlying matrix so that garbage collector can do its work.
|
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.
|
String |
toString() |
public void setup(int width,
int height)
Matrixsetup in interface Matrixwidth - The number of columns.height - The number of rows.Matrix.setup(int, int)public void set(int i,
int j,
int x)
Matrixset in interface Matrixi - The column index.j - The row index.x - The value to set.Matrix.set(int, int, int)public int get(int i,
int j)
Matrixget in interface Matrixi - The column index.j - The row index.Matrix.get(int, int)public void incrementPathBy(int i,
int j,
int n)
Matrixvalue(i, j) := value(i+1, j+1) + n
incrementPathBy in interface Matrixi - The column index.j - The row index.n - The increment number.Matrix.incrementPathBy(int, int, int)public void incrementByMaxPath(int i,
int j)
Matrixvalue(i, j) := max( value(i+1, j) , value(i, j+1) )
incrementByMaxPath in interface Matrixi - The column index.j - The row index.Matrix.incrementByMaxPath(int, int)public boolean isGreaterX(int i,
int j)
Matrixtrue we should move on the X direction.
if value(i+1, j) > value(i, j+1)
isGreaterX in interface Matrixi - The column index.j - The row index.true to move to i+1;
false otherwise.Matrix.isGreaterX(int, int)public boolean isGreaterY(int i,
int j)
Matrixtrue we should move on the X direction.
if value(i+1, j) < value(i, j+1)
isGreaterY in interface Matrixi - The column index.j - The row index.true to move to j+1;
false otherwise.Matrix.isGreaterY(int, int)public boolean isSameXY(int i,
int j)
Matrixtrue we moving on the X direction is
equivalent to moving on the Y direction.
if value(i+1, j) == value(i, j+1)
isSameXY in interface Matrixi - The column index.j - The row index.true if it is the same;
false otherwise.Matrix.isSameXY(int, int)public String toString()
toString in class ObjectObject.toString()public void release()
release in interface MatrixMatrix.release()Copyright © 2007-2022. All Rights Reserved.