All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.janno.evaluator.dice.function.IfIn Maven / Gradle / Ivy

The newest version!
package de.janno.evaluator.dice.function;

import de.janno.evaluator.dice.ExpressionException;
import de.janno.evaluator.dice.ExpressionPosition;
import de.janno.evaluator.dice.Roll;

import static de.janno.evaluator.dice.ValidatorUtil.checkContainsSingleElement;

public class IfIn extends AbstractIf {
    public IfIn(int maxNumberOfElements, boolean keepChildrenRolls) {
        super("ifIn", maxNumberOfElements, keepChildrenRolls);
    }

    @Override
    protected boolean compare(Roll input, int inputPosition, Roll compareTo, int compareToPosition, ExpressionPosition expressionPosition) throws ExpressionException {
        checkContainsSingleElement(expressionPosition, input, "%d argument".formatted(inputPosition));
        return compareTo.isElementsContainsElementWithValueAndTag(input.getElements().getFirst());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy