public void prepare ( Reader reader , long numberOfLines ) throws IOException { this . expected = new ArrayList < double [ ] > ( ) ; BufferedReader bufferedReader = new BufferedReader ( reader ) ; try { String line ; int lineNumber = 0 ; while ( lineNumber != numberOfLines && ( line = bufferedReader . readLine ( ) ) != null ) { ++ lineNumber ; line = line . trim ( ) ; if ( line . isEmpty ( ) || line . charAt ( 0 ) == ' ' ) { continue ; } double [ ] expectedValues ; if ( lineNumber == 1 ) { //automatic detection of header. try { expectedValues = Op . toDoubles ( line ) ; } catch ( Exception ex ) { continue ; } } else { expectedValues = Op . toDoubles ( line ) ; } this . expected . add ( expectedValues ) ; } } catch ( IOException ex ) { throw ex ; } finally { bufferedReader . close ( ) ; } }
Reads and loads into memory the set of expected values from the engine