aboutsummaryrefslogtreecommitdiff
path: root/Playlist.java
blob: fc1ea949a64f76d10da4391be0d1e7da79e7c146 (plain)
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
import java.util.ArrayList;
import java.io.Serializable;

public class Playlist implements Serializable {
	private static final long serialVersionUID = 6021717365357635741L;

	private int id;
	private String name;
	private ArrayList<Song> songs = new ArrayList<Song>();
	private ArrayList<AudioBook> audiobooks = new ArrayList<AudioBook>();

	public Playlist(String name, ArrayList<Song> songs, ArrayList<AudioBook> audiobooks) {
		this.name=name;
		this.songs=songs;
		this.audiobooks=audiobooks;
	}

	public int getId(){return id;}
	public String getName(){return name.toUpperCase();} //using toUpperCase method because the way I sort by name sort he upper case then the lower case, which is inconvenient.
	public void getSongs(){
		for ( Song s : songs ){
		    System.out.println(s);
		}
	}
	public void getAudioBooks(){
		for (AudioBook b : audiobooks ){
			System.out.println(b);
		}

	}

	public void setId(int id){this.id=id;}
	public void setName(String name){this.name=name;}

	public String toString() {
		return "Id : "+getId()+"\nName : "+getName();
	}
}