public static void run ( final Properties properties ) throws IOException { // read parameters for output (do this at the beginning to avoid unnecessary reading) File outputFile = new File ( properties . getProperty ( OUTPUT_FILE ) ) ; Boolean overwrite = Boolean . parseBoolean ( properties . getProperty ( OUTPUT_OVERWRITE , "false" ) ) ; PrintStream outStatistics = null ; if ( outputFile . exists ( ) && ! overwrite ) { throw new IllegalArgumentException ( "Cannot generate statistics because " + outputFile + " exists and overwrite is " + overwrite ) ; } else { outStatistics = new PrintStream ( outputFile , "UTF-8" ) ; } // read format String format = properties . getProperty ( INPUT_FORMAT ) ; // read users to avoid String [ ] usersToAvoidArray = properties . getProperty ( AVOID_USERS , "" ) . split ( "," ) ; Set < String > usersToAvoid = new HashSet < String > ( ) ; for ( String u : usersToAvoidArray ) { usersToAvoid . add ( u ) ; } try { // read baseline <-- this file is mandatory File baselineFile = new File ( properties . getProperty ( BASELINE_FILE ) ) ; Map < String , Map < String , Double > > baselineMapMetricUserValues = readMetricFile ( baselineFile , format , usersToAvoid ) ; // read methods <-- at least one file should be provided String [ ] methodFiles = properties . getProperty ( TEST_METHODS_FILES ) . split ( "," ) ; if ( methodFiles . length < 1 ) { throw new IllegalArgumentException ( "At least one test file should be provided!" ) ; } Map < String , Map < String , Map < String , Double > > > methodsMapMetricUserValues = new HashMap < String , Map < String , Map < String , Double > > > ( ) ; for ( String m : methodFiles ) { File file = new File ( m ) ; Map < String , Map < String , Double > > mapMetricUserValues = readMetricFile ( file , format , usersToAvoid ) ; methodsMapMetricUserValues . put ( m , mapMetricUserValues ) ; } run ( properties , outStatistics , baselineFile . getName ( ) , baselineMapMetricUserValues , methodsMapMetricUserValues ) ; } finally { // close files outStatistics . close ( ) ; } }
Run all the statistic functions included in the properties mapping .