1 package tim.prune.data;
3 import java.util.ArrayList;
6 * Class to hold a list of Photos, using the MediaList superclass
8 public class PhotoList extends MediaList
19 * @param inList ArrayList containing Photo objects
21 private PhotoList(ArrayList<MediaObject> inList) {
26 * @return clone of list contents
28 public PhotoList cloneList()
30 if (getNumMedia() == 0) return this;
31 ArrayList<MediaObject> listCopy = new ArrayList<MediaObject>();
32 listCopy.addAll(_media);
33 return new PhotoList(listCopy);
37 * @return the number of photos in the list
39 public int getNumPhotos() {
44 * Add a Photo to the list
45 * @param inPhoto Photo object to add
47 public void addPhoto(Photo inPhoto) {
52 * Add a Photo to the list
53 * @param inPhoto Photo object to add
54 * @param inIndex index at which to add photo
56 public void addPhoto(Photo inPhoto, int inIndex) {
57 addMedia(inPhoto, inIndex);
61 * Remove the selected photo from the list
62 * @param inIndex index number to remove
64 public void deletePhoto(int inIndex) {
69 * Get the index of the given Photo
70 * @param inPhoto Photo object to check
71 * @return index of this Photo in the list, or -1 if not found
73 public int getPhotoIndex(Photo inPhoto) {
74 return getMediaIndex(inPhoto);
78 * Get the Photo at the given index
79 * @param inIndex index number, starting at 0
80 * @return specified Photo object
82 public Photo getPhoto(int inIndex) {
83 return (Photo) getMedia(inIndex);
87 * @return true if photo list contains correlated photos
89 public boolean hasCorrelatedPhotos() {
90 return hasCorrelatedMedia();
94 * Remove all correlated photos from the list
96 public void removeCorrelatedPhotos() {
97 removeCorrelatedMedia();