Search in sources :

Example 1 with DBIDSelection

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);
    }
}
Also used : ArrayModifiableDBIDs(de.lmu.ifi.dbs.elki.database.ids.ArrayModifiableDBIDs) ModifiableDBIDs(de.lmu.ifi.dbs.elki.database.ids.ModifiableDBIDs) DBIDArrayIter(de.lmu.ifi.dbs.elki.database.ids.DBIDArrayIter) DBIDSelection(de.lmu.ifi.dbs.elki.result.DBIDSelection) DBIDIter(de.lmu.ifi.dbs.elki.database.ids.DBIDIter)

Example 2 with DBIDSelection

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();
    }
}
Also used : DBIDSelection(de.lmu.ifi.dbs.elki.result.DBIDSelection)

Aggregations

DBIDSelection (de.lmu.ifi.dbs.elki.result.DBIDSelection)2 ArrayModifiableDBIDs (de.lmu.ifi.dbs.elki.database.ids.ArrayModifiableDBIDs)1 DBIDArrayIter (de.lmu.ifi.dbs.elki.database.ids.DBIDArrayIter)1 DBIDIter (de.lmu.ifi.dbs.elki.database.ids.DBIDIter)1 ModifiableDBIDs (de.lmu.ifi.dbs.elki.database.ids.ModifiableDBIDs)1