![JAR search and dependency download from the Maven repository](/logo.png)
com.github.dakusui.lisj.func.math.Sub 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.func.math;
import java.math.BigDecimal;
import com.github.dakusui.lisj.Context;
import static com.github.dakusui.lisj.Basic.*;
public class Sub extends NumericFunc {
/**
* Serial version UID.
*/
private static final long serialVersionUID = 30455154598602132L;
@Override
protected BigDecimal bigDecimalsEvaluateLast(Context context, BigDecimal[] evaluatedParams) {
BigDecimal ret = null;
for (BigDecimal cur : evaluatedParams) {
if (ret == null) ret = cur;
else ret = ret.subtract(cur);
}
return ret;
}
@Override
protected Object checkParams(Object params) {
super.checkParams(params);
if (length(params) < 1) throw new IllegalArgumentException(tooFewArguments(params));
return params;
}
private String tooFewArguments(Object params) {
return String.format("Too few arguments(%s) are given.", tostr(params));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy