code: public static <S extends Storable> Cursor<S> applyFilter(Filter<S> filter,
                                                               FilterValues<S> filterValues,
                                                               Cursor<S> cursor)
      {
          if (filter.isOpen()) {
              return cursor;
          }
          if (filter.isClosed()) {
              throw new IllegalArgumentException();
          }
  
          // Make sure the filter is the same one that filterValues should be using.
          filter = filter.bind();
  
          Object[] values = filterValues == null ? null : filterValues.getValuesFor(filter);
          return FilteredCursorGenerator.getFactory(filter).newFilteredCursor(cursor, values);
      }
docs: Returns a Cursor that is filtered by the given Filter and FilterValues.
  The given Filter must be composed only of the same PropertyFilter
  instances as used to construct the FilterValues. An
  IllegalStateException will result otherwise.
  
  @param filter filter to apply
  @param filterValues values for filter, which may be null if filter has no parameters
  @param cursor cursor to wrap
  @return wrapped cursor which filters results
  @throws IllegalStateException if any values are not specified
  @throws IllegalArgumentException if filter is closed