コード例 #1
0
  private List<String> getPatientIds(DataMatrix dataMatrix) {
    List<LinkedList<String>> patientIds = dataMatrix.getColumnData(PATIENT_ID);
    if (patientIds.isEmpty()) {
      patientIds = dataMatrix.getColumnData(FOLLOW_UP_PATIENT_ID);
    }

    return (patientIds.isEmpty())
        ? Collections.<String>emptyList()
        : convertFollowupPatientIds(patientIds.get(0));
  }
コード例 #2
0
  // ----------------------------------------------------------------------------------------
  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
コード例 #3
0
 // ----------------------------------------------------------------------------------------
 public void handleMatrix(String source, DataMatrix matrix) {
   this.matrix = matrix;
   System.out.println(
       "matrix ready, dimension "
           + this.matrix.getRowCount()
           + " x "
           + this.matrix.getColumnCount());
   defaultSpecies = matrix.getSpecies();
 }
コード例 #4
0
  private String getValue(int index, String columnName, DataMatrix dataMatrix) {
    List<LinkedList<String>> columnData = dataMatrix.getColumnData(columnName);

    String value = MissingAttributeValues.getNotAvailable();
    if (!columnData.isEmpty()) {
      value = columnData.get(0).get(index);
    }
    return (value.isEmpty()) ? MissingAttributeValues.getNotAvailable() : value;
  }
コード例 #5
0
  // ----------------------------------------------------------------------------------------
  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
コード例 #6
0
 // ----------------------------------------------------------------------------------------
 void broadcastMatrix(DataMatrix matrix) {
   try {
     matrix.setSpecies(defaultSpecies);
     // matrix.setName();
     gaggleBoss.broadcastMatrix(myGaggleName, targetGoose, matrix);
   } catch (RemoteException rex) {
     System.err.println(
         "error rmi selecting at boss, from RShellGoose.broadcastMatrix() " + myGaggleName);
   }
 } // broadcastMatrix
コード例 #7
0
 // ----------------------------------------------------------------------------------------
 public double[] getMatrixRow(int rowNumber) {
   if (matrix == null) return new double[0];
   else return matrix.get(rowNumber);
 }
コード例 #8
0
 // ----------------------------------------------------------------------------------------
 public String[] getMatrixColumnNames() {
   if (matrix == null) return new String[0];
   else return matrix.getColumnTitles();
 }
コード例 #9
0
 // ----------------------------------------------------------------------------------------
 public String[] getMatrixRowNames() {
   if (matrix == null) return new String[0];
   else return matrix.getRowTitles();
 }
コード例 #10
0
 // ----------------------------------------------------------------------------------------
 public int getMatrixColumnCount() {
   if (matrix == null) return 0;
   else return matrix.getColumnCount();
 }
コード例 #11
0
 // ----------------------------------------------------------------------------------------
 public int getMatrixRowCount() {
   if (matrix == null) return 0;
   else return matrix.getRowCount();
 }