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();
}
};
hash.putString(")");
hash.putString("Albums(");
- for (Album album : albums) {
+ for (Album album : rootAlbum.getAlbums()) {
+ if (!Album.NOT_EMPTY.apply(album)) {
+ continue;
+ }
hash.putString(album.getFingerprint());
}
hash.putString(")");
/** {@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() + ")]";
}
}