File: PhotoList.java

package info (click to toggle)
gpsprune 17-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,984 kB
  • ctags: 5,218
  • sloc: java: 39,403; sh: 25; makefile: 17; python: 15
file content (99 lines) | stat: -rw-r--r-- 1,981 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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<MediaObject> inList) {
		super(inList);
	}

	/**
	 * @return clone of list contents
	 */
	public PhotoList cloneList()
	{
		if (getNumMedia() == 0) return this;
		ArrayList<MediaObject> listCopy = new ArrayList<MediaObject>();
		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();
	}
}