private String formatNodeLabel ( PatriciaTrie . PatriciaNode < V > node , KeyMapper < String > keyMapper , boolean formatBitString ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( "<<table border=\"0\" cellborder=\"0\">" ) ; // Key builder . append ( "<tr><td>" ) ; builder . append ( "key: <font color=\"#00a000\">" ) ; builder . append ( getNodeLabel ( node ) ) ; builder . append ( "</font> </td></tr>" ) ; // Critical bit builder . append ( "<tr><td>" ) ; builder . append ( "bit: <font color=\"blue\">" ) ; builder . append ( node . getBit ( ) ) ; builder . append ( "</font> </td></tr>" ) ; // Bit string if ( formatBitString ) { builder . append ( "<tr><td>" ) ; builder . append ( "bitString: <font color=\"blue\">" ) ; String bitString = keyMapper . toBitString ( node . getKey ( ) ) ; int c = node . getBit ( ) + node . getBit ( ) / 4 ; builder . append ( bitString . substring ( 0 , c ) ) ; builder . append ( "<font color=\"red\">" ) ; builder . append ( bitString . charAt ( c ) ) ; builder . append ( "</font>" ) ; builder . append ( bitString . substring ( c + 1 ) ) ; builder . append ( "</font> </td></tr>" ) ; } // Value builder . append ( "<tr><td>" ) ; builder . append ( "value: <font color=\"#00a0a0\">" ) ; builder . append ( node . getValue ( ) ) ; builder . append ( "</font> </td></tr>" ) ; builder . append ( "</table>>" ) ; return builder . toString ( ) ; }
Format node label