|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.topologi.diffx.algorithm.MatrixShort
public final class MatrixShort
A matrix implementation which backbone is a matrix of short numbers.
Constructor Summary | |
---|---|
MatrixShort()
|
Method Summary | |
---|---|
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()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MatrixShort()
Method Detail |
---|
public void setup(int width, int height)
Matrix
setup
in interface Matrix
width
- The number of columns.height
- The number of rows.Matrix.setup(int, int)
public void set(int i, int j, int x)
Matrix
set
in interface Matrix
i
- The column index.j
- The row index.x
- The value to set.Matrix.set(int, int, int)
public int get(int i, int j)
Matrix
get
in interface Matrix
i
- The column index.j
- The row index.
Matrix.get(int, int)
public void incrementPathBy(int i, int j, int n)
Matrix
value(i, j) := value(i+1, j+1) + n
incrementPathBy
in interface Matrix
i
- The column index.j
- The row index.n
- The increment number.Matrix.incrementPathBy(int, int, int)
public void incrementByMaxPath(int i, int j)
Matrix
value(i, j) := max( value(i+1, j) , value(i, j+1) )
incrementByMaxPath
in interface Matrix
i
- The column index.j
- The row index.Matrix.incrementByMaxPath(int, int)
public boolean isGreaterX(int i, int j)
Matrix
true
we should move on the X direction.
if value(i+1, j) > value(i, j+1)
isGreaterX
in interface Matrix
i
- 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)
Matrix
true
we should move on the X direction.
if value(i+1, j) < value(i, j+1)
isGreaterY
in interface Matrix
i
- 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)
Matrix
true
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 Matrix
i
- 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 Object
Object.toString()
public void release()
release
in interface Matrix
Matrix.release()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |