org.eclipse.persistence.jpa.jpql.parser.OrExpression Maven / Gradle / Ivy
/*
* Copyright (c) 2006, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
// Contributors:
// Oracle - initial API and implementation
//
package org.eclipse.persistence.jpa.jpql.parser;
/**
* The OR logical operator chains multiple criteria together. A valid operand of an OR
* operator must be one of: TRUE, FALSE, and NULL. The OR operator has
* a lower precedence than the AND operator.
*
* NULL represents unknown. Therefore, if one operand is NULL and the other operand is
* TRUE the result is TRUE, because one TRUE operand is sufficient for a
* TRUE result. If one operand is NULL and the other operand is either FALSE or
* NULL, the result is NULL (unknown).
*
*
*
* The following table shows how the OR
operator is evaluated based on its two operands:
* TRUE FALSE NULL
* TRUE TRUE TRUE TRUE
* FALSE TRUE FALSE NULL
* NULL TRUE NULL NULL
*
*
* BNF: conditional_expression ::= conditional_expression OR conditional_term
*
* @version 2.5
* @since 2.3
* @author Pascal Filion
*/
public final class OrExpression extends LogicalExpression {
/**
* Creates a new OrExpression
.
*
* @param parent The parent of this expression
*/
public OrExpression(AbstractExpression parent) {
super(parent, OR);
}
@Override
public void accept(ExpressionVisitor visitor) {
visitor.visit(this);
}
@Override
public String getLeftExpressionQueryBNFId() {
return ConditionalExpressionBNF.ID;
}
@Override
public String getRightExpressionQueryBNFId() {
return ConditionalTermBNF.ID;
}
}