if (predicate instanceof Exists) {
return Predicates.exists();
} else if (predicate instanceof In) {
return ((In<S>) predicate).transform(this);
} else if (predicate instanceof Range) {
Range range = (Range) predicate;
Set<Integer> possibleValues = Sets.newHashSet();
for (int i = 0; i < values.size(); i += 1) {
Set<S> items = values.get(i);
if (items.size() == Integer.MAX_VALUE) {
// items may not be finite, do not consider each item
possibleValues.add(i);
} else {
// check each item in the set
for (S item : items) {
if (range.contains(item)) {
possibleValues.add(i);
break; // no need to test additional items in this set
}
}
}