use of de.lmu.ifi.dbs.elki.logging.progress.StepProgress in project elki by elki-project.
the class MaterializeKNNPreprocessor method objectsInserted.
/**
* Called after new objects have been inserted, updates the materialized
* neighborhood.
*
* @param ids the ids of the newly inserted objects
*/
protected void objectsInserted(DBIDs ids) {
// Could be subclass
final Logging log = getLogger();
StepProgress stepprog = log.isVerbose() ? new StepProgress(3) : null;
ArrayDBIDs aids = DBIDUtil.ensureArray(ids);
// materialize the new kNNs
log.beginStep(stepprog, 1, "New insertions ocurred, materialize their new kNNs.");
// Bulk-query kNNs
List<? extends KNNList> kNNList = knnQuery.getKNNForBulkDBIDs(aids, k);
// Store in storage
DBIDIter iter = aids.iter();
for (int i = 0; i < aids.size(); i++, iter.advance()) {
storage.put(iter, kNNList.get(i));
}
// update the affected kNNs
log.beginStep(stepprog, 2, "New insertions ocurred, update the affected kNNs.");
ArrayDBIDs rkNN_ids = updateKNNsAfterInsertion(ids);
// inform listener
log.beginStep(stepprog, 3, "New insertions ocurred, inform listeners.");
fireKNNsInserted(ids, rkNN_ids);
log.setCompleted(stepprog);
}
Aggregations