it.unitn.disi.smatch.data.matrices
Class JavaSparseArray

java.lang.Object
  extended by it.unitn.disi.smatch.data.matrices.JavaSparseArray
All Implemented Interfaces:
IMatchMatrix

public class JavaSparseArray
extends java.lang.Object
implements IMatchMatrix

Implements a Java Sparse Array (see 10.1.1.13.7544.pdf). To be used with minimal matchers, because CRS does work for them. MM might walk a tree in "unpredictable" manner and does not signal end of row. Does not have max density limit. No boundary checks.

Author:
Aliaksandr Autayeu avtaev@gmail.com

Constructor Summary
JavaSparseArray()
           
 
Method Summary
 void endOfRow()
          Signals end of row for a CRS scheme.
 char getElement(int x, int y)
          Returns an element.
 int getX()
          Returns row count.
 int getY()
          Returns column count.
 void init(int x, int y)
          Inits a matrix x rows per y columns.
 void init(int x, int y, int num_nz)
          Inits a matrix x rows per y columns with a max of num_nz non-zero elements.
 void setElement(int x, int y, char aValue)
          Sets an element.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaSparseArray

public JavaSparseArray()
Method Detail

init

public void init(int x,
                 int y)
Description copied from interface: IMatchMatrix
Inits a matrix x rows per y columns.

Specified by:
init in interface IMatchMatrix
Parameters:
x - rows count
y - column count

init

public void init(int x,
                 int y,
                 int num_nz)
Description copied from interface: IMatchMatrix
Inits a matrix x rows per y columns with a max of num_nz non-zero elements.

Specified by:
init in interface IMatchMatrix
Parameters:
x - rows count
y - column count
num_nz - amount of non-zero elements

endOfRow

public void endOfRow()
Description copied from interface: IMatchMatrix
Signals end of row for a CRS scheme.

Specified by:
endOfRow in interface IMatchMatrix

getElement

public char getElement(int x,
                       int y)
Description copied from interface: IMatchMatrix
Returns an element.

Specified by:
getElement in interface IMatchMatrix
Parameters:
x - row
y - column
Returns:
an element value

setElement

public void setElement(int x,
                       int y,
                       char aValue)
Description copied from interface: IMatchMatrix
Sets an element.

Specified by:
setElement in interface IMatchMatrix
Parameters:
x - row
y - column
aValue - a new element value

getX

public int getX()
Description copied from interface: IMatchMatrix
Returns row count.

Specified by:
getX in interface IMatchMatrix
Returns:
row count

getY

public int getY()
Description copied from interface: IMatchMatrix
Returns column count.

Specified by:
getY in interface IMatchMatrix
Returns:
column count

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


© 2010 Knowdive @ DISI