public boolean add(Msg msg, int start, int size)
    {
        //  We are at the node corresponding to the prefix. We are done.
        if (size == 0) {
            ++refcnt;
            return refcnt == 1;
        }

        assert (msg != null);
        byte c = msg.get(start);
        if (c < min || c >= min + count) {
            //  The character is out of range of currently handled
            //  characters. We have to extend the table.
            if (count == 0) {
                min = c;
                count = 1;
                next = null;
            }
            else if (count == 1) {
                byte oldc = min;
                Trie oldp = next[0];
                count = (min < c ? c - min : min - c) + 1;
                next = new Trie[count];
                min = (byte) Math.min(min, c);
                next[oldc - min] = oldp;
            }
            else if (min < c) {
                //  The new character is above the current character range.
                count = c - min + 1;
                next = realloc(next, count, true);
            }
            else {
                //  The new character is below the current character range.
                count = (min + count) - c;
                next = realloc(next, count, false);
                min = c;
            }
        }

        //  If next node does not exist, create one.
        if (count == 1) {
            if (next == null) {
                next = new Trie[1];
                next[0] = new Trie();

                ++liveNodes;
                assert (liveNodes == 1);
            }
            return next[0].add(msg, start + 1, size - 1);
        }
        else {
            if (next[c - min] == null) {
                next[c - min] = new Trie();

                ++liveNodes;
                assert (liveNodes > 1);
            }
            return next[c - min].add(msg, start + 1, size - 1);
        }
    }
public boolean add ( Msg msg , int start , int size ) { if ( size == 0 ) { ++ refcnt ; return refcnt == 1 ; } assert ( msg != null ) ; byte c = msg . get ( start ) ; if ( c < min || c >= min + count ) { if ( count == 0 ) { min = c ; count = 1 ; next = null ; } else if ( count == 1 ) { byte oldc = min ; Trie oldp = next [ 0 ] ; count = ( min < c ? c - min : min - c ) + 1 ; next = new Trie [ count ] ; min = ( byte ) Math . min ( min , c ) ; next [ oldc - min ] = oldp ; } else if ( min < c ) { count = c - min + 1 ; next = realloc ( next , count , true ) ; } else { count = ( min + count ) - c ; next = realloc ( next , count , false ) ; min = c ; } } if ( count == 1 ) { if ( next == null ) { next = new Trie [ 1 ] ; next [ 0 ] = new Trie ( ) ; ++ liveNodes ; assert ( liveNodes == 1 ) ; } return next [ 0 ] . add ( msg , start + 1 , size - 1 ) ; } else { if ( next [ c - min ] == null ) { next [ c - min ] = new Trie ( ) ; ++ liveNodes ; assert ( liveNodes > 1 ) ; } return next [ c - min ] . add ( msg , start + 1 , size - 1 ) ; } }
rather than a duplicate.