public static void apply ( MutableFst fst , ProjectType pType ) { if ( pType == ProjectType . INPUT ) { fst . setOutputSymbolsAsCopyFromThatInput ( fst ) ; } else if ( pType == ProjectType . OUTPUT ) { fst . setInputSymbolsAsCopyFromThatOutput ( fst ) ; } for ( int i = 0 ; i < fst . getStateCount ( ) ; i ++ ) { MutableState state = fst . getState ( i ) ; // Immutable fsts hold an additional (null) arc for ( int j = 0 ; j < state . getArcCount ( ) ; j ++ ) { MutableArc a = state . getArc ( j ) ; if ( pType == ProjectType . INPUT ) { a . setOlabel ( a . getIlabel ( ) ) ; } else if ( pType == ProjectType . OUTPUT ) { a . setIlabel ( a . getOlabel ( ) ) ; } } } }
Projects an fst onto its domain or range by either copying each arc s input label to its output label or vice versa .