HHH-5736 Removing unnecessary instance check. Applying Hibernate formatting.
This commit is contained in:
parent
ed89cef855
commit
2b7573febb
|
@ -24,15 +24,15 @@
|
|||
package org.hibernate.ejb.criteria.predicate;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import java.util.List;
|
||||
import javax.persistence.criteria.Expression;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
|
||||
import org.hibernate.ejb.criteria.ParameterRegistry;
|
||||
import org.hibernate.ejb.criteria.CriteriaBuilderImpl;
|
||||
import org.hibernate.ejb.criteria.CriteriaQueryCompiler;
|
||||
import org.hibernate.ejb.criteria.ParameterRegistry;
|
||||
import org.hibernate.ejb.criteria.Renderable;
|
||||
|
||||
/**
|
||||
|
@ -50,9 +50,9 @@ public class CompoundPredicate
|
|||
/**
|
||||
* Constructs an empty conjunction or disjunction.
|
||||
*
|
||||
* @param criteriaBuilder The query builder from whcih this originates.
|
||||
* @param operator Indicates whether this predicate will funtion
|
||||
* as a conjunction or disjuntion.
|
||||
* @param criteriaBuilder The query builder from which this originates.
|
||||
* @param operator Indicates whether this predicate will function
|
||||
* as a conjunction or disjunction.
|
||||
*/
|
||||
public CompoundPredicate(CriteriaBuilderImpl criteriaBuilder, BooleanOperator operator) {
|
||||
super( criteriaBuilder );
|
||||
|
@ -63,8 +63,8 @@ public class CompoundPredicate
|
|||
* Constructs a conjunction or disjunction over the given expressions.
|
||||
*
|
||||
* @param criteriaBuilder The query builder from which this originates.
|
||||
* @param operator Indicates whether this predicate will funtion
|
||||
* as a conjunction or disjuntion.
|
||||
* @param operator Indicates whether this predicate will function
|
||||
* as a conjunction or disjunction.
|
||||
* @param expressions The expressions to be grouped.
|
||||
*/
|
||||
public CompoundPredicate(
|
||||
|
@ -78,9 +78,9 @@ public class CompoundPredicate
|
|||
/**
|
||||
* Constructs a conjunction or disjunction over the given expressions.
|
||||
*
|
||||
* @param criteriaBuilder The query builder from whcih this originates.
|
||||
* @param operator Indicates whether this predicate will funtion
|
||||
* as a conjunction or disjuntion.
|
||||
* @param criteriaBuilder The query builder from which this originates.
|
||||
* @param operator Indicates whether this predicate will function
|
||||
* as a conjunction or disjunction.
|
||||
* @param expressions The expressions to be grouped.
|
||||
*/
|
||||
public CompoundPredicate(
|
||||
|
@ -153,24 +153,24 @@ public class CompoundPredicate
|
|||
* Create negation of compound predicate by using logic rules:
|
||||
* 1. not (x || y) is (not x && not y)
|
||||
* 2. not (x && y) is (not x || not y)
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Predicate not() {
|
||||
if (this.operator == BooleanOperator.AND) {
|
||||
this.operator = BooleanOperator.OR;
|
||||
} else {
|
||||
this.operator = BooleanOperator.AND;
|
||||
}
|
||||
toggleOperator();
|
||||
for ( Expression expr : this.getExpressions() ) {
|
||||
if ( Predicate.class.isInstance( expr ) ) {
|
||||
( (Predicate) expr ).not();
|
||||
}
|
||||
else if(CompoundPredicate.class.isInstance(expr)) {
|
||||
( (CompoundPredicate) expr ).not();
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private void toggleOperator() {
|
||||
if ( this.operator == BooleanOperator.AND ) {
|
||||
this.operator = BooleanOperator.OR;
|
||||
}
|
||||
else {
|
||||
this.operator = BooleanOperator.AND;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue