public void readLbMaps ( BufferedReader fin ) throws IOException { if ( lbStr2Int != null ) { lbStr2Int . clear ( ) ; } else { lbStr2Int = new HashMap ( ) ; } if ( lbInt2Str != null ) { lbInt2Str . clear ( ) ; } else { lbInt2Str = new HashMap ( ) ; } String line ; // get size of label map if ( ( line = fin . readLine ( ) ) == null ) { System . out . println ( "No label map size information" ) ; return ; } int numLabels = Integer . parseInt ( line ) ; if ( numLabels <= 0 ) { System . out . println ( "Invalid label map size" ) ; return ; } System . out . println ( "Reading label maps ..." ) ; for ( int i = 0 ; i < numLabels ; i ++ ) { line = fin . readLine ( ) ; if ( line == null ) { System . out . println ( "Invalid label map line" ) ; return ; } StringTokenizer strTok = new StringTokenizer ( line , " \t\r\n" ) ; if ( strTok . countTokens ( ) != 2 ) { continue ; } String lbStr = strTok . nextToken ( ) ; String lbInt = strTok . nextToken ( ) ; lbStr2Int . put ( lbStr , new Integer ( lbInt ) ) ; lbInt2Str . put ( new Integer ( lbInt ) , lbStr ) ; } System . out . println ( "Reading label maps (" + Integer . toString ( lbStr2Int . size ( ) ) + " entries) completed!" ) ; // read the line ###... line = fin . readLine ( ) ; }
Read lb maps .