private static ArrayList<String> printData(HashBasedTable<String, String, Double> tbl1) { // lstOut = output data // sbl1 = current line // rgs1 = list of row ids // rgs2 = list of headers ArrayList<String> lstOut; StringBuilder sbl1; String rgs1[]; String rgs2[]; lstOut = new ArrayList<String>(); rgs1 = tbl1.rowKeySet().toArray(new String[tbl1.rowKeySet().size()]); rgs2 = new String[rgs1.length]; for (int i = 0; i < rgs1.length; i++) { rgs2[i] = (new File(rgs1[i])).getName(); } lstOut.add("SampleID" + "," + Joiner.on(",").join(rgs2)); for (String s : tbl1.columnKeySet()) { sbl1 = new StringBuilder(); sbl1.append(s); for (int i = 0; i < rgs1.length; i++) { sbl1.append("," + tbl1.get(rgs1[i], s)); } lstOut.add(sbl1.toString()); } return lstOut; }
@Test public void calculateWeight_WeightsCalculated_WeightsCorrect() { for (Integer i : tblWeight.rowKeySet()) { for (Integer j : tblWeight.columnKeySet()) { assertEquals(tblWeight.get(i, j), spw1.getWeight(spw1.getEdge(i, j)), 0.0000001); } } }