} else if (getOperator() instanceof Operator.InOperator) {
Collection predicates = new ArrayList();
for (Iterator iter = getIterator(rightValue); iter.hasNext();) {
Object o = iter.next();
if (o instanceof Function) {
predicates.add(getPredicate(new LiteralFunction(leftValue), OperatorConstants.EQUALS_OPERATOR, (Function) o, getLine(), getColumn()));
} else {
predicates.add(getPredicate(new LiteralFunction(leftValue), OperatorConstants.EQUALS_OPERATOR, new LiteralFunction(o), getLine(), getColumn()));
}
}
if (predicates.isEmpty()) {
throw new IllegalStateException("IN expression contains no elements!");
} else if (predicates.size() == 1) {
predicates.add(FalsePredicate.getInstance());
}
return AnyPredicate.getInstance(predicates).evaluate(target);
} else if (getOperator() instanceof Operator.NotInOperator) {
Collection predicates = new ArrayList();
for (Iterator iter = getIterator(rightValue); iter.hasNext();) {
Object o = iter.next();
if (o instanceof Function) {
predicates.add(getPredicate(new LiteralFunction(leftValue), OperatorConstants.EQUALS_OPERATOR, (Function) o, getLine(), getColumn()));
} else {
predicates.add(getPredicate(new LiteralFunction(leftValue), OperatorConstants.EQUALS_OPERATOR, new LiteralFunction(o), getLine(), getColumn()));
}
}
if (predicates.isEmpty()) {
throw new IllegalStateException("NOT IN expression contains no elements!");
} else if (predicates.size() == 1) {
predicates.add(FalsePredicate.getInstance());
}
return !AnyPredicate.getInstance(predicates).evaluate(target);
} else if (getOperator() instanceof Operator.BetweenOperator) {
Object[] array = getArray(rightValue);
Predicate predicate1 = getPredicate(new LiteralFunction(leftValue), OperatorConstants.MORE_THAN_OR_EQUAL_OPERATOR, (Function) array[0], getLine(), getColumn());
Predicate predicate2 = getPredicate(new LiteralFunction(leftValue), OperatorConstants.LESS_THAN_OR_EQUAL_OPERATOR, (Function) array[1], getLine(), getColumn());
return AndPredicate.getInstance(predicate1, predicate2).evaluate(target);
} else if (getOperator() instanceof Operator.NotBetweenOperator) {
Object[] array = getArray(rightValue);
Predicate predicate1 = getPredicate(new LiteralFunction(leftValue), OperatorConstants.MORE_THAN_OR_EQUAL_OPERATOR, (Function) array[0], getLine(), getColumn());
Predicate predicate2 = getPredicate(new LiteralFunction(leftValue), OperatorConstants.LESS_THAN_OR_EQUAL_OPERATOR, (Function) array[1], getLine(), getColumn());
return !AndPredicate.getInstance(predicate1, predicate2).evaluate(target);
} else if (getOperator() instanceof Operator.HasLengthOperator) {
return StringUtils.hasLength(leftValue != null ? leftValue.toString() : null);
} else if (getOperator() instanceof Operator.HasNoLengthOperator) {
return !StringUtils.hasLength(leftValue != null ? leftValue.toString() : null);