Class SparseMatrix
java.lang.Object
org.openprovenance.prov.validation.matrix.SparseMatrix
Generic Class for sparsely populated matrices. The size of the matrix is dynamic, i.e.
you can specify arbitrary row and column parameters.
Another way to look at this class is as a "two-dimensional" map. Instead of a single key
it uses a row and a column element to store and retrieve data elements.
The public Interface Traverser allows to traverse the matrix generically. The Traverser object is passed
into
traverse(Traverser) and is given the opportunity to work with each element of the matrix.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal intaddAndPreserveStrictOrdering(int n1, int n2) voidclear()colSet()Returns a Set of all used "columns" in the matrix.booleanvoidfloydWarshall(SparseMatrix next) final voidg(int row, int col) Returns the value found at the specified row and column of the matrix.getCol(int col) intgetRow(int row) inthashCode()static final booleanisNonStrictOrdering(int n) voidremove(int row, int col) final introundedOrder(int n) rowSet()Returns a Set of all used "rows" in the matrix.voidset(int row, int col, int value) Sets the value of the matrix at the specified row and column.voidsetNoUpdate(int row, int col, int value) toString()
-
Constructor Details
-
SparseMatrix
public SparseMatrix(int size1, int size2)
-
-
Method Details
-
getRow
-
getCol
-
g
Returns the value found at the specified row and column of the matrix. Returns null if there's no value for the specified row and column.- Parameters:
row- Objectcol- Object- Returns:
- Object
-
set
public void set(int row, int col, int value) Sets the value of the matrix at the specified row and column.- Parameters:
row- Objectcol- Objectvalue- a value
-
setNoUpdate
public void setNoUpdate(int row, int col, int value) -
remove
public void remove(int row, int col) -
colSet
-
rowSet
-
clear
public void clear() -
equals
-
hashCode
-
toString
-
floydWarshall
-
getMaximum
public int getMaximum() -
isNonStrictOrdering
public static final boolean isNonStrictOrdering(int n) -
addAndPreserveStrictOrdering
public final int addAndPreserveStrictOrdering(int n1, int n2) -
roundedOrder
public final int roundedOrder(int n) -
floydWarshallWithIterator
-