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