<commit_before>package jpaoletti.jpm.core.operations;

import java.util.List;
import jpaoletti.jpm.core.InstanceId;
import jpaoletti.jpm.core.PMContext;
import jpaoletti.jpm.core.PMException;

/**
 *
 * @author jpaoletti
 */
public class SelectItemOperation extends OperationCommandSupport {

    public SelectItemOperation(String operationId) {
        super(operationId);
    }

    public SelectItemOperation() {
        super("selectitem");
    }

    @Override
    protected void doExecute(PMContext ctx) throws PMException {
        super.doExecute(ctx);
        final String _item = (String) ctx.getParameter("idx");
        if (_item != null) {
            final InstanceId id = buildInstanceId(ctx.getEntity(), _item);
            final List<InstanceId> selectedIndexes = ctx.getEntityContainer().getSelectedInstanceIds();
            if (selectedIndexes.contains(id)) {
                selectedIndexes.remove(id);
            } else {
                selectedIndexes.add(id);
            }
        }
    }

    @Override
    protected boolean checkEntity() {
        return true;
    }
}<commit_msg>Select item dont check for operation existance<commit_after>package jpaoletti.jpm.core.operations;

import java.util.List;
import jpaoletti.jpm.core.InstanceId;
import jpaoletti.jpm.core.PMContext;
import jpaoletti.jpm.core.PMException;

/**
 *
 * @author jpaoletti
 */
public class SelectItemOperation extends OperationCommandSupport {

    public SelectItemOperation(String operationId) {
        super(operationId);
    }

    public SelectItemOperation() {
        super("selectitem");
    }

    @Override
    protected void doExecute(PMContext ctx) throws PMException {
        super.doExecute(ctx);
        final String _item = (String) ctx.getParameter("idx");
        if (_item != null) {
            final InstanceId id = buildInstanceId(ctx.getEntity(), _item);
            final List<InstanceId> selectedIndexes = ctx.getEntityContainer().getSelectedInstanceIds();
            if (selectedIndexes.contains(id)) {
                selectedIndexes.remove(id);
            } else {
                selectedIndexes.add(id);
            }
        }
    }

    @Override
    protected boolean checkEntity() {
        return true;
    }

    @Override
    protected boolean checkOperation() {
        return false;
    }
}
{'fraction_non_alphanumeric': 0.0993576017130621, 'fraction_numerical': 0.0, 'mean_word_length': 2.627329192546584, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2897078', 'n_tokens_mistral': 653, 'n_tokens_neox': 650, 'n_words': 132}