Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * This file is part of the DiffX library.
   *
   * For licensing information please see the file license.txt included in the release.
   * A copy of this licence can also be found at
   *   http://www.opensource.org/licenses/artistic-license-2.0.php
   */
  package com.topologi.diffx.algorithm;

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...

Author(s):
Christophe Lauret (Allette Systems)
Version:
7 April 2005
 
 public interface Matrix {
   //	 TODO: this class should probably not be public
 
  
Create a matrix of the given width and height.

Parameters:
width The number of columns.
height The number of rows.
 
   void setup(int widthint height);
 
   // default access -----------------------------------------------------------------------
 
  
Sets the value of the matrix at the given position.

Parameters:
i The column index.
j The row index.
x The value to set.
 
   void set(int iint jint x);

  
Returns the value at the given position.

Parameters:
i The column index.
j The row index.
Returns:
The value at the given position.
 
   int get(int iint j);
 
   // to fill up the matrix ----------------------------------------------------------------
 
  
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.
 
   void incrementPathBy(int iint jint n);

  
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.
 
   void incrementByMaxPath(int iint j);
 
   // to determine the path ----------------------------------------------------------------
 
  
Returns true we 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:
true to move to i+1; false otherwise.
 
   boolean isGreaterX(int iint j);

  
Returns true we 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:
true to move to j+1; false otherwise.
  boolean isGreaterY(int iint j);

  
Returns true we 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:
true if it is the same; false otherwise.
  boolean isSameXY(int iint j);

  
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.

  void release();
New to GrepCode? Check out our FAQ X