critInProgress = prepareCriteria();
}
for (int j = 0; j < inputReferences.size(); j++) {
Reference ref = (Reference)inputReferences.get(j);
context.remove(ref.getExpression());
}
if (critInProgress == QueryRewriter.FALSE_CRITERIA) {
critInProgress = null;
consumedCriteria();
return false;
}
boolean validRow = true;
for (Iterator i = Criteria.separateCriteriaByAnd(critInProgress).iterator(); i.hasNext();) {
Criteria crit = (Criteria)i.next();
Object value = null;
boolean nullAllowed = false;
Reference parameter = null;
if (crit instanceof IsNullCriteria) {
parameter = (Reference)((IsNullCriteria)crit).getExpression();
nullAllowed = true;
} else if (crit instanceof CompareCriteria) {
CompareCriteria compare = (CompareCriteria)crit;
value = compare.getRightExpression();
parameter = (Reference)compare.getLeftExpression();
} else {
Assertion.failed("Unknown predicate type"); //$NON-NLS-1$
}
if (value instanceof Expression) {
value = eval.evaluate((Expression)value, null);
}
if (value == null && !nullAllowed) {
validRow = false;
break;
}
ElementSymbol parameterSymbol = parameter.getExpression();
if (context.containsVariable(parameterSymbol)) {
Object existingValue = context.getValue(parameterSymbol);
if ((value != null && !value.equals(existingValue)) || (value == null && existingValue != null)) {
validRow = false;
break;
}
}
context.setValue(parameterSymbol, value);
}
critInProgress = null;
consumedCriteria();
if (!validRow) {
return false;
}
for (int j = 0; j < inputReferences.size(); j++) {
Object defaultValue = inputDefaults.get(j);
Reference ref = (Reference)inputReferences.get(j);
if (defaultValue != null && !context.containsVariable(ref.getExpression())) {
context.setValue(ref.getExpression(), defaultValue);
}
}
return true;
}