private int emitNodeArcs ( FSA fsa , OutputStream os , final int state , final int nextState ) throws IOException { int offset = 0 ; for ( int arc = fsa . getFirstArc ( state ) ; arc != 0 ; arc = fsa . getNextArc ( arc ) ) { int targetOffset ; final int target ; if ( fsa . isArcTerminal ( arc ) ) { target = 0 ; targetOffset = 0 ; } else { target = fsa . getEndNode ( arc ) ; targetOffset = offsets . get ( target ) ; } int flags = 0 ; if ( fsa . isArcFinal ( arc ) ) { flags |= BIT_FINAL_ARC ; } if ( fsa . getNextArc ( arc ) == 0 ) { flags |= BIT_LAST_ARC ; } if ( targetOffset != 0 && target == nextState ) { flags |= BIT_TARGET_NEXT ; targetOffset = 0 ; } offset += emitArc ( os , flags , fsa . getArcLabel ( arc ) , targetOffset ) ; } return offset ; }
Emit all arcs of a single node .