protected And and( Constraint constraint1, Constraint constraint2 ) { return new And(constraint1, constraint2); }
/** * Walk the supplied constraint to extract a list of the constraints that can be AND-ed together. For example, given the * constraint tree ((C1 AND C2) AND (C3 OR C4)), this method would result in a list of three separate criteria: [C1,C2,(C3 OR * C4)]. The resulting <code>andConstraints</code> list will contain Constraint objects that all must be true. * * @param constraint the input constraint * @param andableConstraints the collection into which all non-{@link And AND} constraints should be placed */ protected void separateAndConstraints( Constraint constraint, List<Constraint> andableConstraints ) { if (constraint == null) return; assert andableConstraints != null; if (constraint instanceof And) { And and = (And)constraint; separateAndConstraints(and.left(), andableConstraints); separateAndConstraints(and.right(), andableConstraints); } else { andableConstraints.add(constraint); } }
protected boolean indexAppliesTo( And and ) { // look if the index applies to any part of the AND return indexAppliesTo(and.getConstraint1()) || indexAppliesTo(and.getConstraint2()); }
/** * Walk the supplied constraint to extract a list of the constraints that can be AND-ed together. For example, given the * constraint tree ((C1 AND C2) AND (C3 OR C4)), this method would result in a list of three separate criteria: [C1,C2,(C3 OR * C4)]. The resulting <code>andConstraints</code> list will contain Constraint objects that all must be true. * * @param constraint the input constraint * @param andableConstraints the collection into which all non-{@link And AND} constraints should be placed */ protected void separateAndConstraints( Constraint constraint, List<Constraint> andableConstraints ) { if (constraint == null) return; assert andableConstraints != null; if (constraint instanceof And) { And and = (And)constraint; separateAndConstraints(and.left(), andableConstraints); separateAndConstraints(and.right(), andableConstraints); } else { andableConstraints.add(constraint); } }
protected And and( Constraint constraint1, Constraint constraint2 ) { return new And(constraint1, constraint2); }
protected boolean indexAppliesTo( And and ) { // look if the index applies to any part of the AND return indexAppliesTo(and.getConstraint1()) || indexAppliesTo(and.getConstraint2()); }
protected And and( Constraint left, Constraint right ) { return new And(left, right); }
if (constraint instanceof And) { And and = (And)constraint; Constraint left = replaceSubqueriesWithBindVariables(context, and.left(), subqueriesByVariableName); Constraint right = replaceSubqueriesWithBindVariables(context, and.right(), subqueriesByVariableName); if (left == and.left() && right == and.right()) return and; return new And(left, right);
@Override public javax.jcr.query.qom.And and( javax.jcr.query.qom.Constraint constraint1, javax.jcr.query.qom.Constraint constraint2 ) { Constraint jcrConstraint1 = CheckArg.getInstanceOf(constraint1, Constraint.class, "constraint1"); Constraint jcrConstraint2 = CheckArg.getInstanceOf(constraint2, Constraint.class, "constraint2"); return new And(jcrConstraint1, jcrConstraint2); }
if (constraint instanceof And) { And and = (And)constraint; Constraint left = replaceAliasesWithProperties(context, and.left(), propertyByAlias); Constraint right = replaceAliasesWithProperties(context, and.right(), propertyByAlias); if (left == and.left() && right == and.right()) return and; return new And(left, right);
@Override public javax.jcr.query.qom.And and( javax.jcr.query.qom.Constraint constraint1, javax.jcr.query.qom.Constraint constraint2 ) { Constraint jcrConstraint1 = CheckArg.getInstanceOf(constraint1, Constraint.class, "constraint1"); Constraint jcrConstraint2 = CheckArg.getInstanceOf(constraint2, Constraint.class, "constraint2"); return new And(jcrConstraint1, jcrConstraint2); }
if (constraint instanceof And) { And and = (And)constraint; Constraint left = replaceSubqueriesWithBindVariables(context, and.left(), subqueriesByVariableName); Constraint right = replaceSubqueriesWithBindVariables(context, and.right(), subqueriesByVariableName); if (left == and.left() && right == and.right()) return and; return new And(left, right);