public void writeDict ( PrintWriter fout ) throws IOException { Iterator it = null ; int count = 0 ; for ( it = dict . keySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Integer cpInt = ( Integer ) it . next ( ) ; Element elem = ( Element ) dict . get ( cpInt ) ; if ( elem . chosen == 1 ) { count ++ ; } } // write the dictionary size fout . println ( Integer . toString ( count ) ) ; for ( it = dict . keySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Integer cpInt = ( Integer ) it . next ( ) ; Element elem = ( Element ) dict . get ( cpInt ) ; if ( elem . chosen == 0 ) { continue ; } // write the context predicate and its count fout . print ( cpInt . toString ( ) + ":" + Integer . toString ( elem . count ) ) ; for ( Iterator lbIt = elem . lbCntFidxes . keySet ( ) . iterator ( ) ; lbIt . hasNext ( ) ; ) { Integer labelInt = ( Integer ) lbIt . next ( ) ; CountFIdx cntFIdx = ( CountFIdx ) elem . lbCntFidxes . get ( labelInt ) ; if ( cntFIdx . fidx < 0 ) { continue ; } fout . print ( " " + labelInt . toString ( ) + ":" + Integer . toString ( cntFIdx . count ) + ":" + Integer . toString ( cntFIdx . fidx ) ) ; } fout . println ( ) ; } // write the line ###... fout . println ( Option . modelSeparator ) ; }
Write dict .