Class SparseMatrix
- java.lang.Object
-
- org.openprovenance.prov.validation.matrix.SparseMatrix
-
public final class SparseMatrix extends Object
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 intotraverse(Traverser)and is given the opportunity to work with each element of the matrix.
-
-
Constructor Summary
Constructors Constructor Description SparseMatrix(int size1, int size2)
-
Method Summary
Modifier and Type Method Description intaddAndPreserveStrictOrdering(int n1, int n2)voidclear()Set<Integer>colSet()Returns a Set of all used "columns" in the matrix.booleanequals(Object obj)voidfloydWarshall(SparseMatrix next)voidfloydWarshallWithIterator(SparseMatrix next)Pairg(int row, int col)Returns the value found at the specified row and column of the matrix.List<Pair>getCol(int col)intgetMaximum()List<Pair>getRow(int row)inthashCode()static booleanisNonStrictOrdering(int n)voidremove(int row, int col)introundedOrder(int n)Set<Integer>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)StringtoString()
-
-
-
Method Detail
-
g
public Pair g(int row, int col)
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)
-
clear
public void clear()
-
floydWarshall
public void floydWarshall(SparseMatrix next)
-
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
public final void floydWarshallWithIterator(SparseMatrix next)
-
-