- * The ID of the reply
- * @return This Sone (for method chaining)
- */
- public Sone removeLikedReplyId(String replyId) {
- likedReplyIds.remove(replyId);
- return this;
- }
-
- /**
- * Returns the albums of this Sone.
- *
- * @return The albums of this Sone
- */
- public List<Album> getAlbums() {
- return Collections.unmodifiableList(albums);
- }
-
- /**
- * Returns a flattened list of all albums of this Sone. The resulting list
- * contains parent albums before child albums so that the resulting list can
- * be parsed in a single pass.
- *
- * @return The flattened albums
- */
- public List<Album> getAllAlbums() {
- List<Album> flatAlbums = new ArrayList<Album>();
- flatAlbums.addAll(albums);
- int lastAlbumIndex = 0;
- while (lastAlbumIndex < flatAlbums.size()) {
- int previousAlbumCount = flatAlbums.size();
- for (Album album : new ArrayList<Album>(flatAlbums.subList(lastAlbumIndex, flatAlbums.size()))) {
- flatAlbums.addAll(album.getAlbums());
- }
- lastAlbumIndex = previousAlbumCount;
- }
- return flatAlbums;
- }
-
- /**
- * Returns all images of a Sone. Images of a album are inserted into this
- * list before images of all child albums.
- *
- * @return The list of all images
- */
- public List<Image> getAllImages() {
- List<Image> allImages = new ArrayList<Image>();
- for (Album album : getAllAlbums()) {
- allImages.addAll(album.getImages());
- }
- return allImages;
- }
-
- /**
- * Adds an album to this Sone.
- *
- * @param album
- * The album to add
- */
- public void addAlbum(Album album) {
- Validation.begin().isNotNull("Album", album).check().isEqual("Album Owner", album.getSone(), this).check();
- if (!albums.contains(album)) {
- albums.add(album);
- }
- }
-
- /**
- * Sets the albums of this Sone.
- *
- * @param albums
- * The albums of this Sone
- */
- public void setAlbums(Collection<? extends Album> albums) {
- Validation.begin().isNotNull("Albums", albums).check();
- this.albums.clear();
- for (Album album : albums) {
- addAlbum(album);
- }
- }
-
- /**
- * Removes an album from this Sone.
- *
- * @param album
- * The album to remove