package net.pterodactylus.sone.data;
-import static com.google.common.base.Preconditions.*;
+import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.FluentIterable.from;
import static java.util.Arrays.asList;
import static net.pterodactylus.sone.data.Album.FLATTENER;
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
-public class Sone implements Fingerprintable, Comparable<Sone> {
+public class Sone implements Identified, Fingerprintable, Comparable<Sone> {
/**
* Enumeration for the possible states of a {@link Sone}.
@Override
public boolean apply(Sone sone) {
- return sone.getTime() != 0;
+ return (sone == null) ? false : sone.getTime() != 0;
}
};
@Override
public boolean apply(Sone sone) {
- return sone.getIdentity() instanceof OwnIdentity;
+ return (sone == null) ? false : sone.getIdentity() instanceof OwnIdentity;
}
};
@Override
public boolean apply(Sone sone) {
- return !sone.getRootAlbum().getAlbums().isEmpty();
+ return (sone == null) ? false : !sone.getRootAlbum().getAlbums().isEmpty();
}
};
private final Set<String> likedReplyIds = new CopyOnWriteArraySet<String>();
/** The root album containing all albums. */
- private final Album rootAlbum = new Album().setSone(this);
+ private final Album rootAlbum = new AlbumImpl().setSone(this);
/** Sone-specific options. */
private Options options = new Options();
/** {@inheritDoc} */
@Override
public String toString() {
- return getClass().getName() + "[identity=" + identity + ",requestUri=" + requestUri + ",insertUri(" + String.valueOf(insertUri).length() + "),friends(" + friendSones.size() + "),posts(" + posts.size() + "),replies(" + replies.size() + ")]";
+ return getClass().getName() + "[identity=" + identity + ",requestUri=" + requestUri + ",insertUri(" + String.valueOf(insertUri).length() + "),friends(" + friendSones.size() + "),posts(" + posts.size() + "),replies(" + replies.size() + "),albums(" + getRootAlbum().getAlbums().size() + ")]";
}
}