protected void writeBranchCounts ( final BranchCounts branch , final BitOutputStream out ) throws IOException { final CodeType currentCodeType = this . getType ( branch . path ) ; long maximum = branch . size ; assert maximum >= branch . terminals ; if ( currentCodeType == CodeType . Unknown ) { this . writeTerminalCount ( out , branch . terminals , maximum ) ; } else if ( currentCodeType == CodeType . Terminal ) { assert branch . size == branch . terminals ; assert 0 == branch . zeroCount ; assert 0 == branch . oneCount ; } else assert currentCodeType != CodeType . Prefix || 0 == branch . terminals ; maximum -= branch . terminals ; assert maximum >= branch . zeroCount ; if ( 0 < maximum ) { this . writeZeroBranchSize ( out , branch . zeroCount , maximum , branch . path ) ; maximum -= branch . zeroCount ; } else { assert 0 == branch . zeroCount ; } assert maximum == branch . oneCount ; }
Write branch counts .