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:
asivache 2009-03-16 21:56:45 +00:00
parent c68e0cc1fe
commit 6d481c64e7
1 changed files with 22 additions and 0 deletions

View File

@ -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;
}
}