com.bpodgursky.jbool_expressions.Or Maven / Gradle / Ivy
package com.bpodgursky.jbool_expressions;
import org.apache.commons.lang.StringUtils;
import java.util.List;
public class Or extends NExpression {
public static final String EXPR_TYPE = "or";
private Or(List> children) {
super(children);
}
@Override
protected Expression createInternal(List> children) {
return new Or(children);
}
public String toString(){
return "("+ StringUtils.join(expressions, " | ")+")";
}
@Override
public boolean equals(Expression expr) {
if(!(expr instanceof Or)){
return false;
}
Or other = (Or) expr;
if(other.expressions.length != expressions.length){
return false;
}
for(int i = 0; i < expressions.length; i++){
if(!expressions[i].equals(other.expressions[i])){
return false;
}
}
return true;
}
public static Or of(Expression child1, Expression child2, Expression child3, Expression child4){
return of(ExprUtil.list(child1, child2, child3, child4));
}
public static Or of(Expression child1, Expression child2, Expression child3){
return of(ExprUtil.list(child1, child2, child3));
}
public static Or of(Expression child1, Expression child2){
return of(ExprUtil.list(child1, child2));
}
public static Or of(List> children){
return new Or(children);
}
@Override
public String getExprType() {
return EXPR_TYPE;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy