// ---------------------------------------------------------------------------------------- public void createAndBroadcastMatrix( String[] rowNames, String[] columnNames, double[] data, String matrixName) { // System.out.println (" ------- RShellGoose.cabm"); // System.out.println (" row name count: " + rowNames.length); // System.out.println (" col name count: " + columnNames.length); // System.out.println (" data length: " + data.length); // System.out.println (" name: " + matrixName); DataMatrix matrix = new DataMatrix(); int rowCount = rowNames.length; int columnCount = columnNames.length; matrix.setSize(rowCount, columnCount); if (matrixName != null) { matrix.setShortName(matrixName); // matrix.setName(matrixName); } matrix.setRowTitles(rowNames); matrix.setColumnTitles(columnNames); for (int r = 0; r < rowCount; r++) { double[] rowValues = new double[columnCount]; int fromPosition = r * columnCount; System.arraycopy(data, fromPosition, rowValues, 0, columnCount); matrix.set(r, rowValues); } // for r broadcastMatrix(matrix); } // createAndBroadcastMatrix
public void mouseClicked(MouseEvent e) { int x = e.getX(); int y = e.getY(); int currentTabIndex = -1; int tabCount = tabPane.getTabCount(); for (int i = 0; i < tabCount; i++) { if (rects[i].contains(x, y)) { currentTabIndex = i; break; } // if contains } // for i if (currentTabIndex >= 0) { Rectangle tabRect = rects[currentTabIndex]; x = x - tabRect.x; y = y - tabRect.y; if ((x >= 5) && (x <= 15) && (y >= 5) && (y <= 15)) { try { tabbedPane.remove(currentTabIndex); } catch (Exception ex) { ex.printStackTrace(); } } // if } // if currentTabIndex >= 0 System.gc(); } // mouseClicked
// ------------------------------------------------------------------------------------- public static void main(String[] args) { ClusterViewer view; if (args.length != 1) { System.err.println("usage: clusterViewer <baseUrl>"); System.exit(1); } view = new ClusterViewer(args[0].trim()); } // main
// ---------------------------------------------------------------------------------------- public double[] getAllMatrixData() { if (matrix == null) { System.out.println("The R goose has not received a matrix broadcast."); return new double[0]; } int rowCount = matrix.getRowCount(); int columnCount = matrix.getColumnCount(); int total = rowCount * columnCount; double result[] = new double[total]; for (int r = 0; r < rowCount; r++) { double[] rowValues = matrix.get(r); int toPosition = r * columnCount; System.arraycopy(rowValues, 0, result, toPosition, columnCount); } // for r return result; } // getAllMatrixData
// ------------------------------------------------------------------------------------- public void doExit() { connector.disconnectFromGaggle(true); System.exit(0); }