public class Species { public String name; public int[][] geneMap = {}; private int clusterTotal = 0; public Species() { /** ArrayList tmp = new ArrayList(); tmp.add(-1); System.out.println(tmp.get(0)); geneMap.add(tmp); * */ } public void setName(String newName) { name = newName; } // adds a cluster, if the cluster already exists in this species' gene map, then it adds a hit to the count public void addCluster(int clusterID, int hits) { int[][] tmpMap = new int[geneMap.length + 1][2]; for(int i = 0; i < geneMap.length; i ++) { tmpMap[i] = geneMap[i]; } tmpMap[clusterTotal][0] = clusterID; tmpMap[clusterTotal][1] = hits; clusterTotal ++; geneMap = tmpMap; } public int findClusterFrequency(int clusterID) { int index = findClusterIndex(clusterID); if (index == -1) { return 0; } return geneMap[index][1]; } private int findClusterIndex(int clusterID) { int index = -1; for (int i = 0; i < geneMap.length; i ++) { if (geneMap[i][0] == clusterID) { index = i; } } return index; } }