Merges all current existed changes into one single {@link ChangesItem} and return them.
Don't care if after merge new entries will come.
347886
public ChangesItem pollAndMergeAll()
   {
      ChangesItem totalChanges = new ChangesItem();

      for (ChangesItem particularChanges = poll(); particularChanges != null; particularChanges = poll())
      {
         totalChanges.merge(particularChanges);
      }

      return totalChanges;
   }
942719
public ChangesHolder getChanges(final Set<String> removedNodes, final Set<String> addedNodes)
   {
      if (handler != null)
      {
         Iterator<NodeData> addedStates = new Iterator<NodeData>()
         {
            private final Iterator<String> iter = addedNodes.iterator();

            public boolean hasNext()
            {
               return iter.hasNext();
            }

            public NodeData next()
            {

               // cycle till find a next or meet the end of set
               do
               {
                  String id = iter.next();
                  try
                  {
                     ItemData item = itemMgr.getItemData(id);
                     if (item != null)
                     {
                        if (item.isNode())
                        {
                           if (!indexingTree.isExcluded(item))
                           {
                              return (NodeData)item;
                           }
                        }
                        else
                        {
                           LOG.warn("Node not found, but property " + id + ", " + item.getQPath().getAsString()
                              + " found. ");
                        }
                     }
                     else
                     {
                        LOG.warn("Unable to index node with id " + id + ", node does not exist.");
                     }

                  }
                  catch (RepositoryException e)
                  {
                     LOG.error("Can't read next node data " + id, e);
                  }
               }
               while (iter.hasNext()); // get next if error or node not found

               return null; // we met the end of iterator set
            }

            public void remove()
            {
               throw new UnsupportedOperationException();
            }
         };

         Iterator<String> removedIds = new Iterator<String>()
         {
            private final Iterator<String> iter = removedNodes.iterator();

            public boolean hasNext()
            {
               return iter.hasNext();
            }

            public String next()
            {
               return nextNodeId();
            }

            public String nextNodeId() throws NoSuchElementException
            {
               return iter.next();
            }

            public void remove()
            {
               throw new UnsupportedOperationException();

            }
         };

         if (removedNodes.size() > 0 || addedNodes.size() > 0)
         {
            return handler.getChanges(removedIds, addedStates);
         }
      }
      return null;
   }
258614
public void mergeProposedItem(final InvoiceItem invoiceItem) {
        Preconditions.checkState(!isBuilt, "Tree already built, unable to add new invoiceItem=%s", invoiceItem);

        // Check if it was an existing item ignored for tree purposes (e.g. FIXED or $0 RECURRING, both of which aren't repaired)
        final InvoiceItem existingItem = Iterables.tryFind(existingIgnoredItems, new Predicate<InvoiceItem>() {
            @Override
            public boolean apply(final InvoiceItem input) {
                return input.matches(invoiceItem);
            }
        }).orNull();
        if (existingItem != null) {
            return;
        }

        switch (invoiceItem.getInvoiceItemType()) {
            case RECURRING:
                // merged means we've either matched the proposed to an existing, or triggered a repair
                final boolean merged = root.addProposedItem(new ItemsNodeInterval(root, new Item(invoiceItem, targetInvoiceId, ItemAction.ADD)));
                if (!merged) {
                    items.add(new Item(invoiceItem, targetInvoiceId, ItemAction.ADD));
                }
                break;

            case FIXED:
                remainingIgnoredItems.add(invoiceItem);
                break;

            default:
                Preconditions.checkState(false, "Unexpected proposed item " + invoiceItem);
        }
    }
363645
function(oldItem, newItem) {
      if(data.operations) {
        for(var i = 0; i < data.operations.length; i++) {
          var operation = data.operations[i];
          if(newItem && newItem[operation.field] !== undefined || oldItem && oldItem[operation.field] !== undefined) {
            opsToolbox[operation.operation].recompute(operations[operation.field], operation, oldItem, newItem);
          }
        }
      }
    }
961411
public List<BuildChangeSet> getChangeSets() {
        List<BuildChangeSet> result;
        if (changeSets != null) {
            result = changeSets;
        } else if (changeSet != null) {
            result = Collections.singletonList(changeSet);
        } else {
            result = null;
	}
        return result;
    }
20492
public UpdateDescription merge(@Nullable final UpdateDescription otherDescription) {
    if (otherDescription != null) {
      for (final Map.Entry<String, BsonValue> entry : this.updatedFields.entrySet()) {
        if (otherDescription.removedFields.contains(entry.getKey())) {
          this.updatedFields.remove(entry.getKey());
        }
      }
      for (final String removedField : this.removedFields) {
        if (otherDescription.updatedFields.containsKey(removedField)) {
          this.removedFields.remove(removedField);
        }
      }

      this.removedFields.addAll(otherDescription.removedFields);
      this.updatedFields.putAll(otherDescription.updatedFields);
    }

    return this;
  }
1280547
def get_changes(self, remove=True, only_current=False, resources=None,
                    task_handle=taskhandle.NullTaskHandle()):
        
        changes = ChangeSet('Inline method <%s>' % self.name)
        if resources is None:
            resources = self.project.get_python_files()
        if only_current:
            resources = [self.original]
            if remove:
                resources.append(self.resource)
        job_set = task_handle.create_jobset('Collecting Changes',
                                            len(resources))
        for file in resources:
            job_set.started_job(file.path)
            if file == self.resource:
                changes.add_change(self._defining_file_changes(
                    changes, remove=remove, only_current=only_current))
            else:
                aim = None
                if only_current and self.original == file:
                    aim = self.offset
                handle = _InlineFunctionCallsForModuleHandle(
                    self.project, file, self.others_generator, aim)
                result = move.ModuleSkipRenamer(
                    self.occurrence_finder, file, handle).get_changed_module()
                if result is not None:
                    result = _add_imports(self.project, result,
                                          file, self.imports)
                    if remove:
                        result = _remove_from(self.project, self.pyname,
                                              result, file)
                    changes.add_change(ChangeContents(file, result))
            job_set.finished_job()
        return changes
1105448
public void merge(ConfigurationMetadata metadata) {
		for (ItemMetadata additionalItem : metadata.getItems()) {
			mergeItemMetadata(additionalItem);
		}
		for (ItemHint itemHint : metadata.getHints()) {
			add(itemHint);
		}
	}
678217
public DrawerView addItems(List<DrawerItem> items) {
        mAdapter.setNotifyOnChange(false);
        for (DrawerItem item : items) {
            if (item.getId() <= 0) {
                item.setId(System.nanoTime() * 100 + Math.round(Math.random() * 100));
            }
            for (DrawerItem oldItem : mAdapter.getItems()) {
                if (oldItem.getId() == item.getId()) {
                    mAdapter.remove(oldItem);
                    break;
                }
            }

            item.attachTo(mAdapter);
            mAdapter.add(item);
        }
        mAdapter.setNotifyOnChange(true);
        mAdapter.notifyDataSetChanged();
        updateList();
        return this;
    }
1295099
protected void renameItem(final ItemState state, final ItemState lastDelete)
   {
      ItemData data = state.getData();
      ItemData prevData = getFromBufferedCacheById.run(data.getIdentifier());

      if (data.isNode())
      {
         if (state.isPersisted())
         {
            // it is state where name can be changed by rename operation, so re-add node
            removeItem(lastDelete.getData());
            putItem(state.getData());
         }
         else
         {
            // update item data with new name only
            cache.put(new CacheId(getOwnerId(), data.getIdentifier()), data, false);
         }
      }
      else
      {
         PropertyData prop = (PropertyData)data;

         if (prevData != null && !(prevData instanceof NullItemData))
         {
            PropertyData newProp =
               new PersistedPropertyData(prop.getIdentifier(), prop.getQPath(), prop.getParentIdentifier(),
                  prop.getPersistedVersion(), prop.getType(), prop.isMultiValued(),
                  ((PropertyData)prevData).getValues(), new SimplePersistedSize(
                     ((PersistedPropertyData)prevData).getPersistedSize()));
            
            // update item data with new name and old values only
            cache.put(new CacheId(getOwnerId(), newProp.getIdentifier()), newProp, false);
         }
         else
         {
            // remove item to avoid inconsistency in cluster mode since we have not old values
            cache.remove(new CacheId(getOwnerId(), data.getIdentifier()));
         }
      }
   }
1063143
function merge(acc, item) {
  if (!item) {
    return acc;
  }

  return deepmerge(acc, item, {
    clone: false, // No need to clone deep, it's way faster.
  });
}
1235407
def _merge_patches(self):
        """"""
        for patched_item, patched_namespace in self._patch_data_by_canonical_name.values():
            patched_item_base_name = self._get_base_name(patched_item.name, patched_namespace.name)
            if patched_item_base_name not in self._item_by_canonical_name:
                raise InvalidSpec('Patch {} must correspond to a pre-existing data_type.'.format(
                    quote(patched_item.name)), patched_item.lineno, patched_item.path)

            existing_item = self._item_by_canonical_name[patched_item_base_name]

            self._check_patch_type_mismatch(patched_item, existing_item)

            if isinstance(patched_item, (AstStructPatch, AstUnionPatch)):
                self._check_field_names_unique(existing_item, patched_item)
                existing_item.fields += patched_item.fields
                self._inject_patched_examples(existing_item, patched_item)
            else:
                raise AssertionError('Unknown Patch Object Type {}'.format(
                    patched_item.__class__.__name__))
864012
public DrawerView addFixedItems(List<DrawerItem> items) {
        mAdapterFixed.setNotifyOnChange(false);
        for (DrawerItem item : items) {
            if (item.getId() <= 0) {
                item.setId(System.nanoTime() * 100 + Math.round(Math.random() * 100));
            }
            for (DrawerItem oldItem : mAdapterFixed.getItems()) {
                if (oldItem.getId() == item.getId()) {
                    mAdapterFixed.remove(oldItem);
                    break;
                }
            }

            item.attachTo(mAdapterFixed);
            mAdapterFixed.add(item);
        }
        mAdapterFixed.setNotifyOnChange(true);
        mAdapterFixed.notifyDataSetChanged();
        updateFixedList();
        return this;
    }
881947
@Override
    protected ChangeSet getFilteredChangeSet(ChangeSet changeSet) {
        changeSet = super.getFilteredChangeSet(changeSet);
        if (changeSet != null && !changeSet.isEmpty() && xmlFlatteningEnabled && reindexItemsOnComponentUpdates) {
            List<String> createdFiles = changeSet.getCreatedFiles();
            List<String> updatedFiles = changeSet.getUpdatedFiles();
            List<String> deletedFiles = changeSet.getDeletedFiles();
            List<String> newUpdatedFiles = new ArrayList<>(updatedFiles);

            if (CollectionUtils.isNotEmpty(createdFiles)) {
                for (String path : createdFiles) {
                    if (isComponent(path)) {
                        addItemsThatIncludeComponentToUpdatedFiles(path, createdFiles, newUpdatedFiles, deletedFiles);
                    }
                }
            }

            if (CollectionUtils.isNotEmpty(updatedFiles)) {
                for (String path : updatedFiles) {
                    if (isComponent(path)) {
                        addItemsThatIncludeComponentToUpdatedFiles(path, createdFiles, newUpdatedFiles, deletedFiles);
                    }
                }
            }


            if (CollectionUtils.isNotEmpty(deletedFiles)) {
                for (String path : deletedFiles) {
                    if (isComponent(path)) {
                        addItemsThatIncludeComponentToUpdatedFiles(path, createdFiles, newUpdatedFiles, deletedFiles);
                    }
                }
            }

            return new ChangeSet(createdFiles, newUpdatedFiles, deletedFiles);
        } else {
            return changeSet;
        }
    }
263977
def itemChange( self, change, value ):
        
        # only operate when it is a visible, geometric change
        if not (self.isVisible() and change == self.ItemPositionChange):
            return super(XGanttViewItem, self).itemChange( change, value )
        
        if self.isSyncing():
            return super(XGanttViewItem, self).itemChange(change, value)
        
        scene = self.scene()
        # only operate when we have a scene
        if not scene:
            return super(XNode, self).itemChange( change, value )
        
        point = value.toPointF()
        point.setY(self.pos().y())
        
        # create the return value
        new_value = wrapVariant(point)
        
        # call the base method to operate on the new point
        return super(XGanttViewItem, self).itemChange(change, new_value)
171680
public synchronized List<V> getCheckedItems() {
        List<V> result = new ArrayList<V>();
        for(int i = 0; i < itemStatus.size(); i++) {
            if(itemStatus.get(i)) {
                result.add(getItemAt(i));
            }
        }
        return result;
    }
665487
def changed(self, item):
        
        if self._rejectChanges:
            raise errors.ChangeRejected()
        if self.transaction is not None:
            self.transaction.add(item)
            self.touched.add(item)