use of de.lmu.ifi.dbs.elki.result.DBIDSelection in project elki by elki-project.
the class SelectionTableWindow method handleDelete.
/**
* Handle delete. <br>
* Delete the marked objects in the database.
*/
protected void handleDelete() {
ModifiableDBIDs todel = DBIDUtil.newHashSet();
ModifiableDBIDs remain = DBIDUtil.newHashSet(dbids);
DBIDArrayIter it = dbids.iter();
for (int row : table.getSelectedRows()) {
it.seek(row);
todel.add(it);
remain.remove(it);
}
// Unselect first ...
context.setSelection(new DBIDSelection(remain));
// Now delete them.
for (DBIDIter iter = todel.iter(); iter.valid(); iter.advance()) {
database.delete(iter);
}
}
use of de.lmu.ifi.dbs.elki.result.DBIDSelection in project elki by elki-project.
the class SelectionTableWindow method updateFromSelection.
/**
* Update our selection
*/
protected void updateFromSelection() {
DBIDSelection sel = context.getSelection();
if (sel != null) {
this.dbids = DBIDUtil.newArray(sel.getSelectedIds());
this.dbids.sort();
} else {
this.dbids = DBIDUtil.newArray();
}
}
Aggregations