+ /** Filter to remove Sones that have not been downloaded. */
+ public static final Predicate<Sone> EMPTY_SONE_FILTER = new Predicate<Sone>() {
+
+ @Override
+ public boolean apply(Sone sone) {
+ return (sone != null) && (sone.getTime() != 0);
+ }
+ };
+
+ /** Filter that matches all {@link Sone#isLocal() local Sones}. */
+ public static final Predicate<Sone> LOCAL_SONE_FILTER = new Predicate<Sone>() {
+
+ @Override
+ public boolean apply(Sone sone) {
+ return (sone != null) && (sone.getIdentity() instanceof OwnIdentity);
+ }
+
+ };
+
+ /** Filter that matches Sones that have at least one album. */
+ public static final Predicate<Sone> HAS_ALBUM_FILTER = new Predicate<Sone>() {
+
+ @Override
+ public boolean apply(Sone sone) {
+ return (sone != null) && !sone.getRootAlbum().getAlbums().isEmpty();
+ }
+ };
+
+ public static final Function<Sone, List<Album>> toAllAlbums = new Function<Sone, List<Album>>() {
+ @Override
+ public List<Album> apply(@Nullable Sone sone) {
+ return (sone == null) ? Collections.<Album>emptyList() : FLATTENER.apply(
+ sone.getRootAlbum());
+ }
+ };
+
+ public static final Function<Sone, List<Image>> toAllImages = new Function<Sone, List<Image>>() {
+ @Override
+ public List<Image> apply(@Nullable Sone sone) {
+ return (sone == null) ? Collections.<Image>emptyList() :
+ from(FLATTENER.apply(sone.getRootAlbum()))
+ .transformAndConcat(IMAGES).toList();
+ }
+ };