]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/data/PhotoList.java
454055309285340476057efe4a51ad86a152ec74
[GpsPrune.git] / tim / prune / data / PhotoList.java
1 package tim.prune.data;
2
3 import java.util.ArrayList;
4
5 /**
6  * Class to hold a list of Photos, using the MediaList superclass
7  */
8 public class PhotoList extends MediaList
9 {
10         /**
11          * Empty constructor
12          */
13         public PhotoList() {
14                 this(null);
15         }
16
17         /**
18          * Constructor
19          * @param inList ArrayList containing Photo objects
20          */
21         private PhotoList(ArrayList<MediaFile> inList) {
22                 super(inList);
23         }
24
25         /**
26          * @return clone of list contents
27          */
28         public PhotoList cloneList()
29         {
30                 if (getNumMedia() == 0) return this;
31                 ArrayList<MediaFile> listCopy = new ArrayList<MediaFile>();
32                 listCopy.addAll(_media);
33                 return new PhotoList(listCopy);
34         }
35
36         /**
37          * @return the number of photos in the list
38          */
39         public int getNumPhotos() {
40                 return getNumMedia();
41         }
42
43         /**
44          * Add a Photo to the list
45          * @param inPhoto Photo object to add
46          */
47         public void addPhoto(Photo inPhoto) {
48                 addMedia(inPhoto);
49         }
50
51         /**
52          * Add a Photo to the list
53          * @param inPhoto Photo object to add
54          * @param inIndex index at which to add photo
55          */
56         public void addPhoto(Photo inPhoto, int inIndex) {
57                 addMedia(inPhoto, inIndex);
58         }
59
60         /**
61          * Remove the selected photo from the list
62          * @param inIndex index number to remove
63          */
64         public void deletePhoto(int inIndex) {
65                 deleteMedia(inIndex);
66         }
67
68         /**
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
72          */
73         public int getPhotoIndex(Photo inPhoto) {
74                 return getMediaIndex(inPhoto);
75         }
76
77         /**
78          * Get the Photo at the given index
79          * @param inIndex index number, starting at 0
80          * @return specified Photo object
81          */
82         public Photo getPhoto(int inIndex) {
83                 return (Photo) getMedia(inIndex);
84         }
85
86         /**
87          * @return true if photo list contains correlated photos
88          */
89         public boolean hasCorrelatedPhotos() {
90                 return hasCorrelatedMedia();
91         }
92
93         /**
94          * Remove all correlated photos from the list
95          */
96         public void removeCorrelatedPhotos() {
97                 removeCorrelatedMedia();
98         }
99 }