X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=src%2Ftim%2Fprune%2Fdata%2FPhotoList.java;fp=src%2Ftim%2Fprune%2Fdata%2FPhotoList.java;h=328196259dcd1b20b259c436cc600c7ab6e9b52a;hp=0000000000000000000000000000000000000000;hb=ce6f2161b8596f7018d6a76bff79bc9e571f35fd;hpb=2d8cb72e84d5cc1089ce77baf1e34ea3ea2f8465 diff --git a/src/tim/prune/data/PhotoList.java b/src/tim/prune/data/PhotoList.java new file mode 100644 index 0000000..3281962 --- /dev/null +++ b/src/tim/prune/data/PhotoList.java @@ -0,0 +1,99 @@ +package tim.prune.data; + +import java.util.ArrayList; + +/** + * Class to hold a list of Photos, using the MediaList superclass + */ +public class PhotoList extends MediaList +{ + /** + * Empty constructor + */ + public PhotoList() { + this(null); + } + + /** + * Constructor + * @param inList ArrayList containing Photo objects + */ + private PhotoList(ArrayList inList) { + super(inList); + } + + /** + * @return clone of list contents + */ + public PhotoList cloneList() + { + if (getNumMedia() == 0) return this; + ArrayList listCopy = new ArrayList(); + listCopy.addAll(_media); + return new PhotoList(listCopy); + } + + /** + * @return the number of photos in the list + */ + public int getNumPhotos() { + return getNumMedia(); + } + + /** + * Add a Photo to the list + * @param inPhoto Photo object to add + */ + public void addPhoto(Photo inPhoto) { + addMedia(inPhoto); + } + + /** + * Add a Photo to the list + * @param inPhoto Photo object to add + * @param inIndex index at which to add photo + */ + public void addPhoto(Photo inPhoto, int inIndex) { + addMedia(inPhoto, inIndex); + } + + /** + * Remove the selected photo from the list + * @param inIndex index number to remove + */ + public void deletePhoto(int inIndex) { + deleteMedia(inIndex); + } + + /** + * Get the index of the given Photo + * @param inPhoto Photo object to check + * @return index of this Photo in the list, or -1 if not found + */ + public int getPhotoIndex(Photo inPhoto) { + return getMediaIndex(inPhoto); + } + + /** + * Get the Photo at the given index + * @param inIndex index number, starting at 0 + * @return specified Photo object + */ + public Photo getPhoto(int inIndex) { + return (Photo) getMedia(inIndex); + } + + /** + * @return true if photo list contains correlated photos + */ + public boolean hasCorrelatedPhotos() { + return hasCorrelatedMedia(); + } + + /** + * Remove all correlated photos from the list + */ + public void removeCorrelatedPhotos() { + removeCorrelatedMedia(); + } +}