Package com.topologi.diffx.algorithm
Interface Matrix
- All Known Implementing Classes:
MatrixInt,MatrixShort
public interface Matrix
A matrix for the computation of the Diff-X path.
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...
- Version:
- 7 April 2005
-
Method Summary
Modifier and TypeMethodDescriptionintget(int i, int j) Returns the value at the given position.voidincrementByMaxPath(int i, int j) Increment by the maximum path.voidincrementPathBy(int i, int j, int n) Increment the path.booleanisGreaterX(int i, int j) Returnstruewe should move on the X direction.booleanisGreaterY(int i, int j) Returnstruewe should move on the X direction.booleanisSameXY(int i, int j) Returnstruewe moving on the X direction is equivalent to moving on the Y direction.voidrelease()Releases all the resources used only by this matrix object.voidset(int i, int j, int x) Sets the value of the matrix at the given position.voidsetup(int width, int height) Create a matrix of the given width and height.
-
Method Details
-
setup
void setup(int width, int height) Create a matrix of the given width and height.- Parameters:
width- The number of columns.height- The number of rows.
-
set
void set(int i, int j, int x) Sets the value of the matrix at the given position.- Parameters:
i- The column index.j- The row index.x- The value to set.
-
get
int get(int i, int j) Returns the value at the given position.- Parameters:
i- The column index.j- The row index.- Returns:
- The value at the given position.
-
incrementPathBy
void incrementPathBy(int i, int j, int n) Increment the path.value(i, j) := value(i+1, j+1) + n
- Parameters:
i- The column index.j- The row index.n- The increment number.
-
incrementByMaxPath
void incrementByMaxPath(int i, int j) Increment by the maximum path.value(i, j) := max( value(i+1, j) , value(i, j+1) )
- Parameters:
i- The column index.j- The row index.
-
isGreaterX
boolean isGreaterX(int i, int j) Returnstruewe should move on the X direction.if value(i+1, j) > value(i, j+1)
- Parameters:
i- The column index.j- The row index.- Returns:
trueto move to i+1;falseotherwise.
-
isGreaterY
boolean isGreaterY(int i, int j) Returnstruewe should move on the X direction.if value(i+1, j) < value(i, j+1)
- Parameters:
i- The column index.j- The row index.- Returns:
trueto move to j+1;falseotherwise.
-
isSameXY
boolean isSameXY(int i, int j) Returnstruewe moving on the X direction is equivalent to moving on the Y direction.if value(i+1, j) == value(i, j+1)
- Parameters:
i- The column index.j- The row index.- Returns:
trueif it is the same;falseotherwise.
-
release
void release()Releases all the resources used only by this matrix object.This class is not usable, until after invoking this method, unless it is setup again.
-