@@ -0,0 +1,2394 @@
+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.Playlist;%0Aimport com.marverenic.music.instances.Song;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport rx.Observable;%0A%0Apublic class PlaylistRule extends AutoPlaylistRule implements Parcelable %7B%0A%0A    protected PlaylistRule(@Field int field, @Match int match, String value) %7B%0A        super(PLAYLIST, field, match, value);%0A    %7D%0A%0A    protected PlaylistRule(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 playlistStore.getPlaylists()%0A                .map(library -%3E %7B%0A                    List%3CPlaylist%3E filtered = new ArrayList%3C%3E();%0A                    for (Playlist playlist : library) %7B%0A                        if (includePlaylist(playlist)) %7B%0A                            filtered.add(playlist);%0A                        %7D%0A                    %7D%0A%0A                    return filtered;%0A                %7D)%0A                .flatMap(Observable::from)%0A                .concatMap(playlistStore::getSongs);%0A    %7D%0A%0A    @SuppressLint(%22SwitchIntDef%22)%0A    private boolean includePlaylist(Playlist playlist) %7B%0A        switch (getField()) %7B%0A            case ID:%0A                return checkId(playlist.getPlaylistId());%0A            case NAME:%0A                return checkString(playlist.getPlaylistName());%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%3CPlaylistRule%3E CREATOR = new Creator%3CPlaylistRule%3E() %7B%0A        @Override%0A        public PlaylistRule createFromParcel(Parcel in) %7B%0A            return new PlaylistRule(in);%0A        %7D%0A%0A        @Override%0A        public PlaylistRule%5B%5D newArray(int size) %7B%0A            return new PlaylistRule%5Bsize%5D;%0A        %7D%0A    %7D;%0A%7D%0A

Create PlaylistRule class