@Override
    public String toString()
    {
        boolean set = false;
        StringBuilder sb = new StringBuilder();
        int baseRow = -1;
        sb.append("<table");
        if ( this.depth > 0 )
        {
            String localId = RandomId.getId( 32 );
            sb.append(" id=\"");
            sb.append( localId );
            sb.append( "\" class=\"inline\"");
        }
        else if ( tableId != null && tableId.length()>0 )
            sb.append( " id=\""+tableId+"\"");
        sb.append(">");
        // print out the rows
        // ensure base version is at bottom
        for ( int i=0;i<rows.size();i++ )
        {
            Row r = rows.get(i);
            if ( r.versions.nextSetBit(base)!=base )
                sb.append( r.toString() );
            else if ( !set )
            {
                baseRow = i;
                set = true;
            }
            else
                System.out.println("base already set!");
        }
        if ( baseRow == -1 )
            System.out.println("base row not found!");
        else
        {
            Row br = rows.get(baseRow);
            br.setID( id );
            sb.append( br.toString() );
        }
        sb.append("</table>");
        return sb.toString();
    }