Merge with another table
 @param tab [Table]
763975
def merge(tab)
      raise ArgumentError, 'Only tables could be merged' unless tab.is_a?(self.class)
      raise ArgumentError, 'Primary keys not the same' unless tab.primary_key == primary_key

      # Empty content
      content = []
      row_keys = (@row_keys.keys | tab.row_keys).map.with_index { |row, i| [row, i] }.to_h
      col_keys = (@col_keys.keys | tab.col_keys).map.with_index { |col, i| [col, i] }.to_h
      row_keys.size.times { content << Array.new(col_keys.size, '') }

      # rubocop:disable Lint/Eval, Style/SpaceInsideStringInterpolation

      # Fill content with self
      eval <<-END_OF_DOC
        @row_keys.each do |row, old_ri|
          new_ri = row_keys[row]
          #{
            str = []
            @col_keys.map do |col, old_ci|
              new_ci = col_keys[col]
              str << "content[new_ri][#{new_ci}] = @content[old_ri][#{old_ci}]"
            end
            str.join("\n" + ' ' * 8)
          }
        end
      END_OF_DOC

      # Fill content with tab
      @content_merged_with = tab.instance_variable_get(:@content)
      eval <<-END_OF_DOC
        tab.row_keys.each_with_index do |row, old_ri|
          new_ri = row_keys[row]
          #{
            str = []
            tab.col_keys.each_with_index do |col, old_ci|
              new_ci = col_keys[col]
              str << "content[new_ri][#{new_ci}] = @content_merged_with[old_ri][#{old_ci}]"
            end
            str.join("\n" + ' ' * 8)
          }
        end
      END_OF_DOC

      # rubocop:enable Lint/Eval, Style/SpaceInsideStringInterpolation, Lint/UselessAssignment

      # Create a new table
      self.class.build(
        primary_key: primary_key,
        row_keys: row_keys,
        col_keys: col_keys,
        content: content,
        comments: comments + tab.comments
      )
    end
597232
def merge!(schema)
      if schema.is_a?(Schema)
        @data.merge!(schema.data)
      else
        @data.merge!(schema)
      end
    end
1101692
def addTab(self, elem, icon, name):
        
        self._widgets.append(elem)
        return super(TabWidget, self).addTab(elem, icon, name)
871504
def merge(self, rhs, lhs_filter=None, rhs_filter=None):
        
        if lhs_filter or rhs_filter:
            get_ = self.get___method
            set_ = self.set___method
            max_value = _madoka.Sketch_max_value(self)
            for table_id in range(self.depth):
                for cell_id in range(self.width):
                    lhs_val = get_(self, table_id, cell_id)
                    rhs_val = get_(rhs, table_id, cell_id)
                    if lhs_filter:
                        lhs_val = lhs_filter(lhs_val)
                    if rhs_filter:
                        rhs_val = rhs_filter(rhs_val)
                    if (lhs_val >= max_value) or (rhs_val >= (max_value - lhs_val)):
                        lhs_val = self.max_value
                    else:
                        lhs_val += rhs_val
                    set_(self, table_id, cell_id, lhs_val)
        else:
            self.merge_method(self, rhs)
            if rhs.k:
                for (key, val) in rhs.most_common(rhs.k):
                    self._update(key, val)
415104
def filter_and_copy_table(tab, to_remove):
    
    nsrcs = len(tab)
    mask = np.zeros((nsrcs), '?')
    mask[to_remove] = True
    inv_mask = np.invert(mask)
    out_tab = tab[inv_mask]
    return out_tab
1338517
function (other) {
        assertNotNull(other);

        var table = this.table;

        forOf(other, function (element) {
            table.add(element);
        });
    }
208573
def insert_tabs(self, tab, no_tabs=1):
        

        # Mark content as changed
        post_command_event(self.main_window, self.ContentChangedMsg)

        self.code_array.insert(tab, no_tabs, axis=2)

        # Update TableChoiceIntCtrl
        shape = self.grid.code_array.shape
        post_command_event(self.main_window, self.ResizeGridMsg, shape=shape)
469498
def insert_tab index, title, config={}, &block
      @tabs.insert(index, Tab.new(title, self, config, &block) )
    end
726958
def join(self, ToMerge, keycols=None, nullvals=None, 
             renamer=None, returnrenaming=False, selfname=None, Names=None):
        

        if isinstance(ToMerge,np.ndarray):
            ToMerge = [ToMerge]

        if isinstance(ToMerge,dict):
            assert selfname not in ToMerge.keys(), \
             ('Can\'t use "', selfname + '" for name of one of the things to '  
              'merge, since it is the same name as the self object.')
            if selfname == None:
                try:
                    selfname = self.name
                except AttributeError:
                    selfname = 'self'
            ToMerge.update({selfname:self})
        else:
            ToMerge = [self] + ToMerge

        return tab_join(ToMerge, keycols=keycols, nullvals=nullvals, 
                   renamer=renamer, returnrenaming=returnrenaming, Names=Names)
1126875
function insertAndMergeSlot(slot, slotNext, mergeWithPrev, mergeWithNext) {
                    insertSlot(slot, slotNext);

                    var slotPrev = slot.prev;

                    if (slotPrev.lastInSequence) {
                        if (mergeWithPrev) {
                            delete slotPrev.lastInSequence;
                        } else {
                            slot.firstInSequence = true;
                        }

                        if (mergeWithNext) {
                            delete slotNext.firstInSequence;
                        } else {
                            slot.lastInSequence = true;
                        }
                    }
                }
132562
def merge(self, other_rel):
        
        if other_rel.thresholds.size == self.thresholds.size and np.all(other_rel.thresholds == self.thresholds):
            self.frequencies += other_rel.frequencies
        else:
            print("Input table thresholds do not match.")
366987
def OnMerge(self, event):
        """"""

        with undo.group(_("Merge cells")):
            self.grid.actions.merge_selected_cells(self.grid.selection)

        self.grid.ForceRefresh()

        self.grid.update_attribute_toolbar()
638185
def insert(result)
      # puts "insert called with #{result}"
      tabindex = Marshal.dump(@state)
      if @table[tabindex].has_key?(result)
        @table[tabindex][result] += 1
      else
        @table[tabindex][result] = 1
      end
      # puts "table #{@table.inspect}"
      next_state(result)
    end
861593
def move_tab(self, index_from, index_to):
        
        filename = self.filenames.pop(index_from)
        client = self.clients.pop(index_from)
        self.filenames.insert(index_to, filename)
        self.clients.insert(index_to, client)
        self.update_tabs_text()
        self.sig_update_plugin_title.emit()
697607
def move_tab_from_another_tabwidget(self, tabwidget_from,
                                        index_from, index_to):
        """"""
            
        # We pass self object IDs as QString objs, because otherwise it would 
        # depend on the platform: long for 64bit, int for 32bit. Replacing 
        # by long all the time is not working on some 32bit platforms 
        # (see Issue 1094, Issue 1098)
        self.sig_move_tab.emit(tabwidget_from, to_text_string(id(self)),
                               index_from, index_to)
155548
def merge_selected_cells(self, selection):
        

        tab = self.grid.current_table

        # Get the selection bounding box
        bbox = selection.get_bbox()
        if bbox is None:
            row, col, tab = self.grid.actions.cursor
            (bb_top, bb_left), (bb_bottom, bb_right) = (row, col), (row, col)
        else:
            (bb_top, bb_left), (bb_bottom, bb_right) = bbox
        merge_area = bb_top, bb_left, bb_bottom, bb_right

        # Check if top-left cell is already merged
        cell_attributes = self.grid.code_array.cell_attributes
        tl_merge_area = cell_attributes[(bb_top, bb_left, tab)]["merge_area"]

        if tl_merge_area is not None and tl_merge_area[:2] == merge_area[:2]:
            self.unmerge(tl_merge_area, tab)
        else:
            self.merge(merge_area, tab)
940473
private function mergeColumns(): void
  {
    foreach ($this->oldColumns as $table_name => $table)
    {
      foreach ($table as $column_name => $column)
      {
        if (isset($this->columns[$table_name][$column_name]))
        {
          $this->columns[$table_name][$column_name]['constant_name'] = $column['constant_name'];
        }
      }
    }
  }