<commit_before>package hu.webarticum.jsatbuilder.satbuilder.common;

import java.util.Arrays;
import java.util.List;

import hu.webarticum.jsatbuilder.sat.Solver;
import hu.webarticum.jsatbuilder.satbuilder.core.AbstractConstraint;
import hu.webarticum.jsatbuilder.satbuilder.core.CollapseException;
import hu.webarticum.jsatbuilder.satbuilder.core.Definition;

public class ConditionConstraint extends AbstractConstraint {
    
    private final Definition definition;
    
    private final Solver.CLAUSE_PRIORITY priority;
    
    public ConditionConstraint(Definition definition, Solver.CLAUSE_PRIORITY priority) {
        super(false);
        this.definition = definition;
        this.priority = priority;
        getDependencyManager().linkDependency(definition);
    }

    @Override
    public List<Definition> getDependencies() {
        return Arrays.<Definition>asList(definition);
    }

    @Override
    public void dependencyRemoved(Definition definition) throws CollapseException {
        remove();
    }

    @Override
    public void fillSolver(Solver solver) {
        Solver.Clause clause = new Solver.Clause(new Solver.Literal(definition, true));
        if (priority == null) {
            solver.add(clause);
        } else {
            solver.addOptional(clause, priority);
        }
    }<commit_msg>Add one more constructor to ConditionConstraint<commit_after>package hu.webarticum.jsatbuilder.satbuilder.common;

import java.util.Arrays;
import java.util.List;

import hu.webarticum.jsatbuilder.sat.Solver;
import hu.webarticum.jsatbuilder.satbuilder.core.AbstractConstraint;
import hu.webarticum.jsatbuilder.satbuilder.core.CollapseException;
import hu.webarticum.jsatbuilder.satbuilder.core.Definition;

public class ConditionConstraint extends AbstractConstraint {
    
    private final Definition definition;
    
    private final Solver.CLAUSE_PRIORITY priority;

    public ConditionConstraint(Definition definition) {
        this(definition, null);
    }
    
    public ConditionConstraint(Definition definition, Solver.CLAUSE_PRIORITY priority) {
        super(false);
        this.definition = definition;
        this.priority = priority;
        getDependencyManager().linkDependency(definition);
    }

    @Override
    public List<Definition> getDependencies() {
        return Arrays.<Definition>asList(definition);
    }

    @Override
    public void dependencyRemoved(Definition definition) throws CollapseException {
        remove();
    }

    @Override
    public void fillSolver(Solver solver) {
        Solver.Clause clause = new Solver.Clause(new Solver.Literal(definition, true));
        if (priority == null) {
            solver.add(clause);
        } else {
            solver.addOptional(clause, priority);
        }
    }
{'fraction_non_alphanumeric': 0.0853352456077447, 'fraction_numerical': 0.0, 'mean_word_length': 3.4145569620253164, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1120183', 'n_tokens_mistral': 775, 'n_tokens_neox': 748, 'n_words': 150}