![JAR search and dependency download from the Maven repository](/logo.png)
com.github.dakusui.lisj.pred.LogicalPredicate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jcunit Show documentation
Show all versions of jcunit Show documentation
Automated combinatorial testing framework on top of JUnit
package com.github.dakusui.lisj.pred;
import com.github.dakusui.jcunit.exceptions.JCUnitException;
import com.github.dakusui.lisj.Basic;
import com.github.dakusui.lisj.CUT;
import com.github.dakusui.lisj.Context;
import com.github.dakusui.lisj.FormEvaluator;
import com.github.dakusui.lisj.FormResult;
public abstract class LogicalPredicate extends BasePredicate {
/**
* Serial version UID.
*/
private static final long serialVersionUID = -1779614522843256950L;
@Override
protected FormResult evaluateEach(Context context, Object currentParam, FormResult lastResult) throws JCUnitException, CUT {
FormResult ret = super.evaluateEach(context, currentParam, lastResult);
return ret;
}
@Override
protected FormResult evaluateLast(Context context,
Object[] evaluatedParams, FormResult lastResult) {
return lastResult;
}
@Override
protected Object checkParams(Object params) {
super.checkParams(params);
for (Object cur : Basic.iterator(params)) {
if (cur == null) throw new IllegalArgumentException();
}
return params;
}
@Override
protected FormEvaluator newEvaluator(Context context, Object params) {
/*
* Since it's sure that the subclasses of this class doesn't need to
* create child context, FormEvaluator is created with incoming context.
*/
return new FormEvaluator(context, this, checkParams(params), new FormResult(0, Basic.length(params), initialValue()));
}
/*
* Implementations of this class must returns a boolean value which will be used
* when no parameters are given to this predicate.
*/
abstract protected boolean initialValue();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy