@@ -0,0 +1,2313 @@
+package com.marverenic.music.instances.playlistrules;%0A%0Aimport android.annotation.SuppressLint;%0Aimport android.os.Parcel;%0Aimport android.os.Parcelable;%0A%0Aimport com.marverenic.music.data.store.MusicStore;%0Aimport com.marverenic.music.data.store.PlayCountStore;%0Aimport com.marverenic.music.data.store.PlaylistStore;%0Aimport com.marverenic.music.instances.Genre;%0Aimport com.marverenic.music.instances.Song;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport rx.Observable;%0A%0Apublic class GenreRule extends AutoPlaylistRule implements Parcelable %7B%0A%0A    protected GenreRule(@Field int field, @Match int match, String value) %7B%0A        super(GENRE, field, match, value);%0A    %7D%0A%0A    protected GenreRule(Parcel in) %7B%0A        super(in);%0A    %7D%0A%0A    @Override%0A    public Observable%3CList%3CSong%3E%3E applyFilter(PlaylistStore playlistStore, MusicStore musicStore,%0A                                              PlayCountStore playCountStore) %7B%0A        return musicStore.getGenres()%0A                .map(library -%3E %7B%0A                    List%3CGenre%3E filtered = new ArrayList%3C%3E();%0A                    for (Genre genre : library) %7B%0A                        if (includeGenre(genre)) %7B%0A                            filtered.add(genre);%0A                        %7D%0A                    %7D%0A%0A                    return filtered;%0A                %7D)%0A                .flatMap(Observable::from)%0A                .concatMap(musicStore::getSongs);%0A    %7D%0A%0A    @SuppressLint(%22SwitchIntDef%22)%0A    private boolean includeGenre(Genre genre) %7B%0A        switch (getField()) %7B%0A            case ID:%0A                return checkId(genre.getGenreId());%0A            case NAME:%0A                return checkString(genre.getGenreName());%0A        %7D%0A        throw new IllegalArgumentException(%22Cannot compare against field %22 + getField());%0A    %7D%0A%0A    @Override%0A    public void writeToParcel(Parcel dest, int flags) %7B%0A        super.writeToParcel(dest, flags);%0A    %7D%0A%0A    @Override%0A    public int describeContents() %7B%0A        return 0;%0A    %7D%0A%0A    public static final Creator%3CGenreRule%3E CREATOR = new Creator%3CGenreRule%3E() %7B%0A        @Override%0A        public GenreRule createFromParcel(Parcel in) %7B%0A            return new GenreRule(in);%0A        %7D%0A%0A        @Override%0A        public GenreRule%5B%5D newArray(int size) %7B%0A            return new GenreRule%5Bsize%5D;%0A        %7D%0A    %7D;%0A%7D%0A

Create GenreRule class