private void solveConflict(int parent, int newChild)
    {
        // 找出parent的所有子节点
        TreeSet<Integer> children = new TreeSet<Integer>();
        children.add(newChild);
        final int charsetSize = this.charMap.getCharsetSize();
        for (int c = 0; c < charsetSize; ++c)
        {
            int next = getBase(parent) + c;
            if (next >= getBaseArraySize())
            {
                break;
            }
            if (getCheck(next) == parent)
            {
                children.add(c);
            }
        }
        // 移动旧子节点到新的位置
        int newBase = searchFreeBase(children);
        children.remove(newChild);
        for (Integer c : children)
        {
            int child = newBase + c;
            deleteFreeLink(child);

            setCheck(child, parent);
            int childBase = getBase(getBase(parent) + c);
            setBase(child, childBase);

            if (!isLeafValue(childBase))
            {
                for (int d = 0; d < charsetSize; ++d)
                {
                    int to = childBase + d;
                    if (to >= getBaseArraySize())
                    {
                        break;
                    }
                    if (getCheck(to) == getBase(parent) + c)
                    {
                        setCheck(to, child);
                    }
                }
            }
            addFreeLink(getBase(parent) + c);
        }
        // 更新新base值
        setBase(parent, newBase);
    }
private void solveConflict ( int parent , int newChild ) { TreeSet < Integer > children = new TreeSet < Integer > ( ) ; children . add ( newChild ) ; final int charsetSize = this . charMap . getCharsetSize ( ) ; for ( int c = 0 ; c < charsetSize ; ++ c ) { int next = getBase ( parent ) + c ; if ( next >= getBaseArraySize ( ) ) { break ; } if ( getCheck ( next ) == parent ) { children . add ( c ) ; } } int newBase = searchFreeBase ( children ) ; children . remove ( newChild ) ; for ( Integer c : children ) { int child = newBase + c ; deleteFreeLink ( child ) ; setCheck ( child , parent ) ; int childBase = getBase ( getBase ( parent ) + c ) ; setBase ( child , childBase ) ; if ( ! isLeafValue ( childBase ) ) { for ( int d = 0 ; d < charsetSize ; ++ d ) { int to = childBase + d ; if ( to >= getBaseArraySize ( ) ) { break ; } if ( getCheck ( to ) == getBase ( parent ) + c ) { setCheck ( to , child ) ; } } } addFreeLink ( getBase ( parent ) + c ) ; } setBase ( parent , newBase ) ; }
解决冲突

@param parent   父节点
@param newChild 子节点的char值