public void writeCpMaps ( Dictionary dict , PrintWriter fout ) throws IOException { Iterator it = null ; if ( cpStr2Int == null ) { return ; } int count = 0 ; for ( it = cpStr2Int . keySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { String cpStr = ( String ) it . next ( ) ; Integer cpInt = ( Integer ) cpStr2Int . get ( cpStr ) ; Element elem = ( Element ) dict . dict . get ( cpInt ) ; if ( elem != null ) { if ( elem . chosen == 1 ) { count ++ ; } } } // write the map size fout . println ( Integer . toString ( count ) ) ; for ( it = cpStr2Int . keySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { String cpStr = ( String ) it . next ( ) ; Integer cpInt = ( Integer ) cpStr2Int . get ( cpStr ) ; Element elem = ( Element ) dict . dict . get ( cpInt ) ; if ( elem != null ) { if ( elem . chosen == 1 ) { fout . println ( cpStr + " " + cpInt . toString ( ) ) ; } } } // write the line ###... fout . println ( Option . modelSeparator ) ; }
Write cp maps .