Updates the kNNs and RkNNs after insertion of the specified ids.

@param ids the ids of newly inserted objects causing a change of
materialized kNNs and RkNNs
@return the RkNNs of the specified ids, i.e. the kNNs which have been
updated
192642
private ArrayDBIDs updateKNNsAndRkNNs(DBIDs ids) {
    ArrayModifiableDBIDs rkNN_ids = DBIDUtil.newArray();
    DBIDs oldids = DBIDUtil.difference(relation.getDBIDs(), ids);
    for(DBIDIter id = oldids.iter(); id.valid(); id.advance()) {
      KNNList oldkNNs = storage.get(id);
      double knnDist = oldkNNs.getKNNDistance();
      // look for new kNNs
      KNNHeap heap = null;
      for(DBIDIter newid = ids.iter(); newid.valid(); newid.advance()) {
        double dist = distanceQuery.distance(id, newid);
        if(dist <= knnDist) {
          // New id changes the kNNs of oldid.
          heap = heap != null ? heap : DBIDUtil.newHeap(oldkNNs);
          heap.insert(dist, newid);
        }
      }
      // kNNs for oldid have changed:
      if(heap != null) {
        KNNList newkNNs = heap.toKNNList();
        storage.put(id, newkNNs);

        // get the difference
        ModifiableDoubleDBIDList added = DBIDUtil.newDistanceDBIDList(),
            removed = DBIDUtil.newDistanceDBIDList();
        DoubleDBIDListIter olditer = oldkNNs.iter(), newiter = newkNNs.iter();
        while(olditer.valid() && newiter.valid()) {
          if(DBIDUtil.equal(olditer, newiter)) {
            olditer.advance();
            newiter.advance();
            continue;
          }
          double newd = newiter.doubleValue(), oldd = olditer.doubleValue();
          if(newd < oldd || (newd == oldd && !oldkNNs.contains(newiter))) {
            added.add(newiter.doubleValue(), newiter);
            newiter.advance();
          }
          else if(oldd < newd || (oldd == newd && !newkNNs.contains(olditer))) {
            removed.add(olditer.doubleValue(), olditer);
            olditer.advance();
          }
          else {
            throw new IllegalStateException("Unexpected third case, needs debug!");
          }
        }
        for(; olditer.valid(); olditer.advance()) {
          removed.add(olditer.doubleValue(), olditer);
        }
        for(; newiter.valid(); newiter.advance()) {
          added.add(newiter.doubleValue(), newiter);
        }
        // add new RkNN
        for(DoubleDBIDListIter newnn = added.iter(); newnn.valid(); newnn.advance()) {
          materialized_RkNN.get(newnn).add(DBIDUtil.newPair(newnn.doubleValue(), id));
        }
        // remove old RkNN
        for(DoubleDBIDListIter oldnn = removed.iter(); oldnn.valid(); oldnn.advance()) {
          materialized_RkNN.get(oldnn).remove(DBIDUtil.newPair(oldnn.doubleValue(), id));
        }

        rkNN_ids.add(id);
      }
    }
    return rkNN_ids;
  }
398105
public Future<Map<Integer, Set<RunePage>>> getRunePagesMultipleUsers(int... ids) {
        return new ApiFuture<>(() -> handler.getRunePagesMultipleUsers(ids));
    }
1184256
public void setInternetGatewayIds(java.util.Collection<String> internetGatewayIds) {
        if (internetGatewayIds == null) {
            this.internetGatewayIds = null;
            return;
        }

        this.internetGatewayIds = new com.amazonaws.internal.SdkInternalList<String>(internetGatewayIds);
    }
1191067
public void setInstanceIds(java.util.Collection<String> instanceIds) {
        if (instanceIds == null) {
            this.instanceIds = null;
            return;
        }

        this.instanceIds = new com.amazonaws.internal.SdkInternalList<String>(instanceIds);
    }
899131
public UpdateRouteResponseResult withResponseModels(java.util.Map<String, String> responseModels) {
        setResponseModels(responseModels);
        return this;
    }
1268330
def _rebuild_key_ids(self):
        """"""
        self._key_ids = collections.defaultdict(list)
        for i, x in enumerate(self._pairs):
            self._key_ids[x[0]].append(i)
325629
private int updateSizes(DBIDs ids, WritableDataStore<ModifiableDBIDs> labels, WritableIntegerDataStore newSizes) {
    // to count the unclustered all over
    int countUnmerged = 0;
    for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
      // checking the point's new cluster size after the clustering step
      int newClusterSize = labels.get(iter).size();
      newSizes.putInt(iter, newClusterSize);
      // the point is alone in the cluster --> not merged with other points
      if(newClusterSize == 1) {
        countUnmerged++;
      }
    }
    return countUnmerged;
  }
529680
public List<String> listInstanceIDs(final Set<String> instanceIDs) {
        Set<String> allInstanceIDs = allMockEc2Instances.keySet();
        if (null == instanceIDs || instanceIDs.size() == 0) {
            return new ArrayList<String>(allInstanceIDs);
        } else {
            List<String> filteredInstanceIDs = new ArrayList<String>();
            for (String id : allInstanceIDs) {
                if (null != id && instanceIDs.contains(id)) {
                    filteredInstanceIDs.add(id);
                }
            }
            return filteredInstanceIDs;
        }
    }
288724
public synchronized Object[] getIds() {
        String[] keys = getAllKeys();
        int size = keys.length + indexedProps.size();
        Object[] res = new Object[size];
        System.arraycopy(keys, 0, res, 0, keys.length);
        int i = keys.length;
        // now add all indexed properties
        for (Object index : indexedProps.keySet()) {
            res[i++] = index;
        }
        return res;
    }
1186495
public void setUnprocessedNamedQueryIds(java.util.Collection<UnprocessedNamedQueryId> unprocessedNamedQueryIds) {
        if (unprocessedNamedQueryIds == null) {
            this.unprocessedNamedQueryIds = null;
            return;
        }

        this.unprocessedNamedQueryIds = new java.util.ArrayList<UnprocessedNamedQueryId>(unprocessedNamedQueryIds);
    }
66358
public Future<Map<Integer, String>> getSummonerNames(Integer... ids) {
        return new ApiFuture<>(() -> handler.getSummonerNames(ids));
    }
1188655
public void update(Collection<CmsUUID> ids, boolean remove) {

        for (CmsUUID id : ids) {
            updateItem(id, remove);
        }
        rebuildMenu();
    }
241747
public void setCollectionIds(java.util.Collection<String> collectionIds) {
        if (collectionIds == null) {
            this.collectionIds = null;
            return;
        }

        this.collectionIds = new java.util.ArrayList<String>(collectionIds);
    }
785974
public static ModifiableDBIDs difference(DBIDs ids1, DBIDs ids2) {
    ModifiableDBIDs result = DBIDUtil.newHashSet(ids1);
    result.removeDBIDs(ids2);
    return result;
  }
653059
public void setIdpIdentifiers(java.util.Collection<String> idpIdentifiers) {
        if (idpIdentifiers == null) {
            this.idpIdentifiers = null;
            return;
        }

        this.idpIdentifiers = new java.util.ArrayList<String>(idpIdentifiers);
    }
905962
public QueryBuilder addParentIds(final Collection<Integer> ids) {
        if (ids != null) {
            parentIds.addAll(ids);
        }
        return this;
    }
878966
public void setFaceIds(java.util.Collection<String> faceIds) {
        if (faceIds == null) {
            this.faceIds = null;
            return;
        }

        this.faceIds = new java.util.ArrayList<String>(faceIds);
    }