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

net.sf.xolite.expressions.jaxb_choice.AndExpression Maven / Gradle / Ivy

package net.sf.xolite.expressions.jaxb_choice;


import javax.xml.bind.annotation.XmlTransient;


/**
 * Logical 'And' expression.
 * 
 * @author BEROL
 */
public class AndExpression extends CompositeExpression {


    public static final String AND_EXPRESSION_TAG = "and";


    public AndExpression() {
        super(2, Integer.MAX_VALUE);
    }


    public AndExpression(BooleanExpression... ops) {
        super(2, Integer.MAX_VALUE);
        addOperands(ops);
        validateThis();
    }


    @Override
    @XmlTransient
    protected String getOperationName() {
        return AND_EXPRESSION_TAG;
    }


    @Override
    public boolean evaluate(ExpressionContext context) {
        validateThis();
        for (BooleanExpression expr : getExpressionGroup()) {
            if (!expr.evaluate(context)) return false;
        }
        return true;
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy