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

org.holmes.statement.OrStatement Maven / Gradle / Ivy

Go to download

Holmes is a library that provides a simple and fluent API for writing business rules validations on Java projects.

The newest version!
package org.holmes.statement;

import org.holmes.Statement;

/**
 * A disjunctive {@link Statement}. The evaluation is short-circuited; i.e., if
 * the first statement is evaluated as true, the second statement is never
 * evaluated.
 * 
 * @author diegossilveira
 */
public class OrStatement implements Statement {

	private final Statement firstStatement;

	private final Statement secondStatement;

	public OrStatement(Statement firstStatement, Statement secondStatement) {

		this.firstStatement = firstStatement;
		this.secondStatement = secondStatement;
	}

	@Override
	public boolean evaluate() {

		return firstStatement.evaluate() || secondStatement.evaluate();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy