collects the changed nodes and calls the observers strategy (doOnChange) for each node found
766791
@Override
    public void onEvent(EventIterator events) {
        try {
            // this resolver should be the only one (for this handling thread)
            ResourceResolver resolver = getResolver();
            if (resolver != null) {
                try {
                    Session session = resolver.adaptTo(Session.class);
                    String serviceUserId = getServiceUserId();
                    // collect changed nodes
                    ChangeCollection changedNodes = new ChangeCollection();
                    while (events.hasNext()) {
                        Event event = events.nextEvent();
                        if (ignoreEvent(event)) continue;
                        try {
                            String path = event.getPath();
                            String user = event.getUserID();
                            // if the service user is the initiator this is a self initiated event - ignore it
                            if (!serviceUserId.equals(user)) {
                                Calendar time = Calendar.getInstance();
                                time.setTime(new Date(event.getDate()));
                                int type = event.getType();
                                if (isPropertyEvent(type)) {
                                    if (getPropertyPathFilter().accept(path)) {
                                        changedNodes.registerChange(session, resolver, path, time, user);
                                    }
                                } else {
                                    if (getNodePathFilter().accept(path)) {
                                        changedNodes.registerChange(session, resolver, path, time, user);
                                    }
                                }
                            }
                        } catch (RepositoryException rex) {
                            LOG.error(rex.getMessage(), rex);
                        }
                    }
                    // handle change actions on the detected nodes
                    if (changedNodes.size() > 0) {
                        for (ChangedResource change : changedNodes.values()) {
                            try {
                                doOnChange(resolver, change);
                            } catch (RepositoryException ex) {
                                LOG.error(ex.getMessage(), ex);
                            }
                        }
                        changedNodes.clear();
                        resolver.commit();
                    }
                } catch (PersistenceException ex) {
                    LOG.error(ex.getMessage(), ex);
                } finally {
                    resolver.close();
                }
            }
        } catch (LoginException ex) {
            LOG.error(ex.getMessage(), ex);
        }
    }
768138
def update_all_nodes(self):
        
        item_model_controller = self.item_model_controller
        if item_model_controller:
            if self.__node_counts_dirty:
                for item in self.__mapping.values():
                    if "tree_node" in item.data:  # don't update the root node
                        tree_node = item.data["tree_node"]
                        item.data["display"] = self.__display_for_tree_node(tree_node)
                        item_model_controller.data_changed(item.row, item.parent.row, item.parent.id)
                self.__node_counts_dirty = False
288384
function collectAndCombineOperation(node) {
  let substeps = [];

  const status = LikeTermCollector.collectLikeTerms(clone(node));
  if (!status.hasChanged()) {
    return status;
  }

  // STEP 1: collect like terms, e.g. 2x + 4x^2 + 5x => 4x^2 + (2x + 5x)
  substeps.push(status);
  let newNode = Node.Status.resetChangeGroups(status.newNode);

  // STEP 2 onwards: combine like terms for each group that can be combined
  // e.g. (x + 3x) + (2 + 2) has two groups
  const combineSteps = combineLikeTerms(newNode);
  if (combineSteps.length > 0) {
    substeps = substeps.concat(combineSteps);
    const lastStep = combineSteps[combineSteps.length - 1];
    newNode = Node.Status.resetChangeGroups(lastStep.newNode);
  }

  return Node.Status.nodeChanged(
    ChangeTypes.COLLECT_AND_COMBINE_LIKE_TERMS,
    node, newNode, true, substeps);
}
486770
function (nodes, done) {
      self.changes = nodes.reduce(maxChange, self.changes)
      done(null, nodes)
    }
1339305
def notifyObservers(self, arg=None):
        ''''''

        self.mutex.acquire()
        try:
            if not self.changed:
                    return
            # Make a local copy in case of synchronous
            # additions of observers:
            localArray = self.obs[:]
            self.clearChanged()
        finally:
            self.mutex.release()
        # Update observers
        for observer in localArray:
            observer.update(self, arg)
606323
public synchronized void notifyObservers(Object arg) {
        for (int i = 0; i < observers.size(); i++) {
            observers.elementAt(i).update(this, arg);
        }
    }
1072251
function(connect) {
		var obs = this._observer;
		if (obs) {
			if (connect) {
				obs.observe(document, {
					childList: true,
					subtree: true
				});
			} else {
				obs.disconnect();
			}
		}
	}
38605
function onDomMutate(event) {

	var mutation = {
		addedNodes: [],
		removedNodes: [],
	};
	mutation[
		(event.type === 'DOMNodeInserted' ? 'added' : 'removed') + 'Nodes'
	] = [event.target];

	domMutations.push(mutation);

	// Delay the call to checkMutations()
	setTimeout(function() {
		checkMutations(domMutations);
		domMutations = [];
	});

}
802879
function mapNodeAndRefreshWhenChanged(containerNode, mapping, valueToMap, callbackAfterAddingNodes, index) {
        // Map this array value inside a dependentObservable so we re-map when any dependency changes
        var mappedNodes = [];
        var dependentObservable = ko.dependentObservable(function() {
            var newMappedNodes = mapping(valueToMap, index, ko.utils.fixUpContinuousNodeArray(mappedNodes, containerNode)) || [];

            // On subsequent evaluations, just replace the previously-inserted DOM nodes
            if (mappedNodes.length > 0) {
                ko.utils.replaceDomNodes(mappedNodes, newMappedNodes);
                if (callbackAfterAddingNodes)
                    ko.dependencyDetection.ignore(callbackAfterAddingNodes, null, [valueToMap, newMappedNodes, index]);
            }

            // Replace the contents of the mappedNodes array, thereby updating the record
            // of which nodes would be deleted if valueToMap was itself later removed
            mappedNodes.length = 0;
            ko.utils.arrayPushAll(mappedNodes, newMappedNodes);
        }, null, { disposeWhenNodeIsRemoved: containerNode, disposeWhen: function() { return !ko.utils.anyDomNodeIsAttachedToDocument(mappedNodes); } });
        return { mappedNodes : mappedNodes, dependentObservable : (dependentObservable.isActive() ? dependentObservable : undefined) };
    }
23556
def _setup_observers(self):
        
        if self.has_parent():
            self.add_observer(self._parent_, self._parent_._pass_through_notify_observers, -np.inf)
854138
function(tick) {
		var snapshot, handlers, observers = this._observers;
		if (tick.type === edb.TICK_PUBLISH_CHANGES) {
			snapshot = gui.Object.copy(this._changes);
			this._changes = Object.create(null);
			gui.Object.each(snapshot, function(instanceid, changes) {
				if ((handlers = observers[instanceid])) {
					handlers.forEach(function(handler) {
						handler.onchange(changes);
					});
				}
			});
		}
	}
322411
protected void accumulatePersistedNodesChanges(Map<String, Long> calculatedChangedNodesSize)
      throws QuotaManagerException
   {
      for (Entry<String, Long> entry : calculatedChangedNodesSize.entrySet())
      {
         String nodePath = entry.getKey();
         long delta = entry.getValue();

         try
         {
            long dataSize = delta + quotaPersister.getNodeDataSize(rName, wsName, nodePath);
            quotaPersister.setNodeDataSizeIfQuotaExists(rName, wsName, nodePath, dataSize);
         }
         catch (UnknownDataSizeException e)
         {
            calculateNodeDataSizeTool.getAndSetNodeDataSize(nodePath);
         }
      }
   }
172700
protected void reloadNodes() {

        Hello hello = HelloParser.parse(disqueConnection.sync().hello());
        Collections.sort(hello.nodes, new Comparator<PrioritizedDisqueNode>() {
            @Override
            public int compare(PrioritizedDisqueNode o1, PrioritizedDisqueNode o2) {

                if (o1.priority == o2.priority) {
                    return o1.disqueNode.getPort() - o2.disqueNode.getPort();
                }
                return o1.priority - o2.priority;
            }
        });
        this.nodes.clear();

        for (PrioritizedDisqueNode node : hello.nodes) {
            if (isFiltered(node)) {
                continue;
            }

            this.nodes.add(node.disqueNode);
        }
    }
1087951
private function handleNodeStateChanges()
    {
        $input = $this->getEnvironment()->getInputProvider();
        if (($modelId = $input->getParameter('ptg')) && ($providerName = $input->getParameter('provider'))) {
            $states = $this->getTreeNodeStates();
            // Check if the open/close all has been triggered or just a model.
            if ('all' === $modelId) {
                if ($states->isAllOpen()) {
                    $states->resetAll();
                }
                $states->setAllOpen($states->isAllOpen());
            } else {
                $this->toggleModel($providerName, $modelId);
            }

            ViewHelpers::redirectHome($this->environment);
        }
    }
1189611
def update_nodes_published(self):
        
        if self.pk:
            self.node_set.all().update(is_published=self.is_published)
236226
def OnNodeActivated(self, event):
        """"""
        self.activated_node = self.selected_node = event.node
        self.squareMap.SetModel(event.node, self.adapter)
        self.squareMap.SetSelected( event.node )
        if editor:
            if self.SourceShowFile(event.node):
                if hasattr(event.node,'lineno'):
                    self.sourceCodeControl.GotoLine(event.node.lineno)
        self.RecordHistory()
484809
private void fireStateChanged(Object node, State oldState, State newState)
    {
        for (StateListener stateListener : stateListeners)
        {
            stateListener.stateChanged(node, oldState, newState);
        }
    }