com.bpodgursky.jbool_expressions.NExpression Maven / Gradle / Ivy
package com.bpodgursky.jbool_expressions;
import java.util.Arrays;
import java.util.List;
import com.bpodgursky.jbool_expressions.rules.Rule;
import com.bpodgursky.jbool_expressions.rules.RuleSet;
import com.google.common.collect.Lists;
public abstract class NExpression extends Expression{
public final Expression[] expressions;
protected NExpression(List> expressions){
if(expressions.isEmpty()){
throw new IllegalArgumentException("Arguments length 0!");
}
this.expressions = expressions.toArray(ExprUtil.expr(0));
Arrays.sort(this.expressions);
}
@Override
public Expression apply(List> rules) {
List> childCopy = Lists.newArrayList();
for(Expression expr: expressions){
childCopy.add(RuleSet.applyAll(expr, rules));
}
return createInternal(childCopy);
}
public List> getChildren(){
return ExprUtil.list(expressions);
}
protected abstract Expression createInternal(List> children);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy