public String getStringSerialization ( int [ ] fieldToKeep ) { if ( fieldToKeep == null || fieldToKeep . length == 0 ) return getStringSerialization ( ) ; StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( this . getClass ( ) . getSimpleName ( ) ) . append ( "\t" ) ; buffer . append ( this . label ) ; buffer . append ( "\t" ) . append ( tokensPerField . length ) ; for ( int fieldNum = 0 ; fieldNum < tokensPerField . length ; fieldNum ++ ) { double tokperf = tokensPerField [ fieldNum ] ; if ( java . util . Arrays . binarySearch ( fieldToKeep , fieldNum ) != - 1 ) buffer . append ( "\t" ) . append ( tokperf ) ; else buffer . append ( "\t" ) . append ( "0.0" ) ; } for ( int i = 0 ; i < indices . length ; i ++ ) { int fieldNum = this . indexToField [ i ] ; if ( java . util . Arrays . binarySearch ( fieldToKeep , fieldNum ) != - 1 ) buffer . append ( "\t" ) . append ( indices [ i ] ) . append ( ":" ) . append ( freqs [ i ] ) . append ( ":" ) . append ( this . indexToField [ i ] ) ; } buffer . append ( "\n" ) ; return buffer . toString ( ) ; }
but limiting it to a subset of its fields