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

org.eclipse.persistence.jpa.jpql.parser.AndExpression Maven / Gradle / Ivy

There is a newer version: 5.0.0-B03
Show newest version
/*
 * Copyright (c) 2006, 2018 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;

import org.eclipse.persistence.jpa.jpql.WordParser;

/**
 * The AND logical operator chains multiple criteria together. A valid operand of an
 * AND operator must be one of: TRUE, FALSE, and NULL. The
 * AND operator has a higher precedence than the OR operator.
 * 

* NULL represents unknown. Therefore, if one operand is NULL and the other operand * is FALSE the result is FALSE, because one FALSE operand is sufficient for * a FALSE result. If one operand is NULL and the other operand is either * TRUE or NULL, the result is NULL (unknown). *

* The following table shows how the AND operator is evaluated based on its two operands: * *

* * * * *
TRUEFALSENULL
TRUE TRUE FALSE NULL
FALSE FALSE FALSE FALSE
NULL NULL FALSE NULL
* *
BNF: conditional_term ::= conditional_term AND conditional_factor

* * @version 2.5 * @since 2.3 * @author Pascal Filion */ public final class AndExpression extends LogicalExpression { /** * Creates a new AndExpression. * * @param parent The parent of this expression */ public AndExpression(AbstractExpression parent) { super(parent, AND); } /** * {@inheritDoc} */ public void accept(ExpressionVisitor visitor) { visitor.visit(this); } /** * {@inheritDoc} */ @Override public String getLeftExpressionQueryBNFId() { return ConditionalTermBNF.ID; } /** * {@inheritDoc} */ @Override public String getRightExpressionQueryBNFId() { return ConditionalFactorBNF.ID; } /** * {@inheritDoc} */ @Override protected boolean isParsingComplete(WordParser wordParser, String word, Expression expression) { return word.equalsIgnoreCase(AND) || word.equalsIgnoreCase(OR) || super.isParsingComplete(wordParser, word, expression); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy