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

de.rwth.swc.coffee4j.model.constraints.BooleanFunction1 Maven / Gradle / Ivy

package de.rwth.swc.coffee4j.model.constraints;

import de.rwth.swc.coffee4j.engine.util.Preconditions;

import java.util.List;

/**
 * A helper function used to define constraints which involves one parameter.
 *
 * @param  type of the first parameter
 */
@FunctionalInterface
public interface BooleanFunction1 extends ConstraintFunction {
    
    @SuppressWarnings("unchecked")
    default boolean check(List arguments) {
        Preconditions.notNull(arguments);
        Preconditions.check(arguments.size() == 1);
        
        final A a = (A) arguments.get(0);
        
        return apply(a);
    }
    
    /**
     * Checks whether the value give for the parameter is allowed.
     *
     * @param a the value for the first parameter
     * @return whether the value is allowed
     */
    boolean apply(A a);
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy