Changeset 2639


Ignore:
Timestamp:
02/12/10 20:45:15 (2 years ago)
Author:
jvelde
Message:

CsvWriter? matrix addition for generic xgap matrices.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molgenis/3.3/src/org/molgenis/util/CsvWriter.java

    r2393 r2639  
    4949                this.writer = writer; 
    5050        } 
     51         
     52        /** 
     53         * Write out an XGAP matrix. The inputs can be retrieved from any implementation of the XGAP matrix interface class. 
     54         * @param rowNames 
     55         * @param colNames 
     56         * @param elements 
     57         */ 
     58        public void writeMatrix(List<String> rowNames, List<String> colNames, Object[][] elements){ 
     59                logger.info("writeMatrix called"); 
     60                String cols = ""; 
     61                for(String col : colNames){ 
     62                        cols += "\t" + col; 
     63                } 
     64                writer.println(cols); 
     65                logger.info("printing: "+ cols); 
     66                for(int rowIndex = 0; rowIndex < rowNames.size(); rowIndex++){ 
     67                        String row = rowNames.get(rowIndex); 
     68                        for(int colIndex = 0; colIndex < colNames.size(); colIndex++){ 
     69                                if(elements[rowIndex][colIndex] == null){ 
     70                                        row += "\t"; 
     71                                }else{ 
     72                                        row += "\t" + elements[rowIndex][colIndex]; 
     73                                } 
     74                        } 
     75                        writer.println(row); 
     76                        logger.info("printing: "+ row); 
     77                } 
     78        } 
    5179 
    5280        /** 
Note: See TracChangeset for help on using the changeset viewer.