just a square matrix of arbitrary stuff; the stuff must be full fledged Java type, however, not a primitive type. Hooray Java!
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@70 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
c68e0cc1fe
commit
6d481c64e7
|
|
@ -0,0 +1,22 @@
|
|||
package org.broadinstitute.sting.indels;
|
||||
|
||||
public class Matrix<T> {
|
||||
private int size;
|
||||
private Object [][] data;
|
||||
|
||||
public Matrix(int n) {
|
||||
size = n;
|
||||
data = new Object[n][n];
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public T get(int i, int j) {
|
||||
assert (i<size) && (j < size) : "Matrix index is out of bounds";
|
||||
return (T) data[i][j];
|
||||
}
|
||||
|
||||
public void set(int i, int j, T value) {
|
||||
assert (i<size) && (j < size) : "Matrix index is out of bounds";
|
||||
data[i][j] = value;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue