private boolean isFirstLineData ( State state , List < String > headerTokens ) { // Check whether the type of the header match the type of the following data boolean headerCompatible = true ; // Check whether if all types where strings boolean allStrings = true ; for ( int i = 0 ; i < state . nColumns ; i ++ ) { if ( state . columnNumberParsable . get ( i ) ) { allStrings = false ; if ( ! isTokenNumberParsable ( state , headerTokens . get ( i ) ) ) { headerCompatible = false ; } } } // If all columns are strings, it's impossible to tell whether we have // a header or not: assume we have a header. // If the column types matches (e.g. the header for a number column is also // a number) then we'll assume the header is actually data. return ! allStrings && headerCompatible ; }
Checks whether the header can be safely interpreted as data . This is used for the auto header detection .