Remove a reference from the inverted index. (Decrease refCount by one. Remove the entry if refCount reached zero)

@private
@param {Core.Element} refer Referencing element.
@param {Core.Element} refee Referenced element.
428891
function _removeRef(refer, refee) {
        var item = _refMap[refee._id];
        if (item) {
            var count = item[refer._id];
            if (count && (count > 0)) {
                item[refer._id] = count - 1;
            } else {
                item[refer._id] = 0;
            }
            if (item[refer._id] === 0) {
                delete item[refer._id];
            }
        }
    }
291126
protected void clearReference (DObject reffer, String field, int reffedOid)
    {
        // look up the reference vector for the referenced object
        Reference[] refs = _refs.get(reffedOid);
        Reference ref = null;

        if (refs != null) {
            for (int ii = 0; ii < refs.length; ii++) {
                if (refs[ii].equals(reffer.getOid(), field)) {
                    ref = refs[ii];
                    refs[ii] = null;
                    break;
                }
            }
        }

        // if a referred object and referring object are both destroyed without allowing the
        // referred object destruction to process the ObjectRemoved event which is auto-generated,
        // the subsequent destruction of the referring object will attempt to clear the reference
        // to the referred object which no longer exists; so we don't complain about non- existent
        // references if the referree is already destroyed
        if (ref == null && _objects.containsKey(reffedOid)) {
            log.warning("Requested to clear out non-existent reference",
                        "refferOid", reffer.getOid(), "field", field, "reffedOid", reffedOid);

//        } else {
//            log.info("Cleared out reference " + ref + ".");
        }
    }
991391
function checkReference(reference, index, references) {
			var identifier = reference.identifier;

			if (reference.init === false &&
				reference.isWrite() &&
				// Destructuring assignments can have multiple default value,
				// so possibly there are multiple writeable references for the same identifier.
				(index === 0 || references[index - 1].identifier !== identifier)
			) {
				context.report({
					node: identifier,
					message: ProblemMessages.noNativeReassign,
					data: {name: identifier.name}
				});
			}
		}
201641
function removeUnreferencedElements() {

  var referencedIDs = findReferencedElements();

  var alwaysKeepTags = ['font', 'style', 'metadata', 'script', 'title', 'desc'];
  function removeUnreferencedElementsInTag(node) {
    _($(node).children()).each(function(node) {
      
      // scour:
      // > we only remove if it is not one of our tags we always keep (see above)
      if(_(alwaysKeepTags).indexOf(node.name) !== -1) {
        return;
      }
      var $node = $(node);
      var id = $node.attr('id');
      if(!_(referencedIDs).has(id)) {
        if(node.name == 'g') {
          // scour:
          // > we only inspect the children of a group in a defs if the group
          // > is not referenced anywhere else
          removeUnreferencedElementsInTag(node);
        } else {
          $(node).remove();
        }
      }
    });
  }
  // scour:
  // > Remove most unreferenced elements inside defs
  _($('defs')).each(removeUnreferencedElementsInTag);

  // scour:
  // > Remove certain unreferenced elements outside of defs
  var identifiedElements = $('* > linearGradient[id], * > radialGradient[id], * > pattern[id]');
  
  _(identifiedElements).each(function(node) {
    var id = $(node).attr('id');
    if(!_(referencedIDs).has(id)) {
      $(node).remove();
    }
  });

}
276548
def removeReferenceSet(self):
        
        self._openRepo()
        referenceSet = self._repo.getReferenceSetByName(
            self._args.referenceSetName)

        def func():
            self._updateRepo(self._repo.removeReferenceSet, referenceSet)
        self._confirmDelete("ReferenceSet", referenceSet.getLocalId(), func)
1020654
public void setReferences(IReferences references) throws ReferenceException {
		List<Object> counters = references.getOptional(new Descriptor(null, "counters", null, null, null));
		for (Object counter : counters) {
			if (counter instanceof ICounters && counter != this)
				_counters.add((ICounters) counter);
		}
	}
1093451
public void referencedElementUpdated(ModelElementInstance referenceTargetElement, String oldIdentifier, String newIdentifier) {
    for (ModelElementInstance referenceSourceElement : findReferenceSourceElements(referenceTargetElement)) {
      updateReference(referenceSourceElement, oldIdentifier, newIdentifier);
    }
  }
490551
public synchronized void removeDeferredReferenceData(DeferredReferenceData refData) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "removeDeferredReferenceData", "this=" + this, refData);
        }

        if (deferredReferenceDatas != null) {
            deferredReferenceDatas.remove(refData);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "removeDeferredReferenceData");
        }
    }
783758
def removeReference(self, fromnode, tonode):
        
        if fromnode is None:
            fromnode = self
        fromident = self.getIdent(fromnode)
        toident = self.getIdent(tonode)
        if fromident is not None and toident is not None:
            while True:
                edge = self.graph.edge_by_node(fromident, toident)
                if edge is None:
                    break
                self.graph.hide_edge(edge)
1036587
protected void unsetItemInterface(ServiceReference<ItemInterface> ref) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            SibTr.entry(tc, "unsetItemInterface", ref);
        itemInterfaceRef.setReference(ref);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            SibTr.exit(tc, "unsetItemInterface");

    }
535683
private void downHeap(int idx) {
        Reference<E> e = entries.array[idx];

        int iter = idx;
        while (hasChildren(iter)) {
            int cidx = leftChild(iter);
            Reference<E> c = entries.array[cidx];

            if (hasRightChild(iter)) {
                int rcidx = rightChild(iter);
                Reference<E> rc = entries.array[rcidx];
                if (compare(rc, c) < 0) {
                    cidx = rcidx;
                    c = rc;
                }
            }

            if (compare(e, c) <= 0) {
                break;
            }

            entries.array[cidx] = e;
            entries.array[iter] = c;
            c.index = iter;
            iter = cidx;
        }

        e.index = iter;
    }
1106278
public static Object clearRef (Object[] list, Object element)
    {
        return clear(REFERENCE_COMP, list, element);
    }
4234
def remove_external_references(self):
        
        for ex_ref_node in self.node.findall('externalReferences'):
            self.node.remove(ex_ref_node)
815353
private int getSkipCorrectedReference(List<Integer> tokenPositions, int refNumber) {
    int correctedRef = 0;
    int i = 0;
    for (int tokenPosition : tokenPositions) {
      if (i++ >= refNumber) {
        break;
      }
      correctedRef += tokenPosition;
    }
    return correctedRef - 1;
  }
646201
def reverse_reference(self):
        ''''''
        self.ref_start = self.ref_length - self.ref_start - 1
        self.ref_end = self.ref_length - self.ref_end - 1
623015
def reference_index(self, ref_id):
        """"""
        try:
            indexes = range(self.reference_count())
            return next(i for i in indexes if self.reference_id(i) == ref_id)
        except StopIteration as e:
            raise ReferenceNotFoundError("ID: " + ref_id) from e
538785
function fixrefs(scope, i) {
                        // do children first; order shouldn't matter
                        for (i = scope.children.length; --i >= 0;)
                                fixrefs(scope.children[i]);
                        for (i in scope.refs) if (HOP(scope.refs, i)) {
                                // find origin scope and propagate the reference to origin
                                for (var origin = scope.has(i), s = scope; s; s = s.parent) {
                                        s.refs[i] = origin;
                                        if (s === origin) break;
                                }
                        }
                }