blob: 34fae7adb3c29262ec525b1b0700c094099feb00 (
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
39
|
import java.util.*;
import java.io.Serializable;
public class Album implements Serializable {
private int id, duration;
private Date date;
private String title, artist;
private ArrayList<Song> songs = new ArrayList<Song>();
public Album(int id, String title, int duration, String artist, Date date, ArrayList<Song> songs) {
this.id=id;
this.title=title;
this.duration=this.getDuration();
this.artist=artist;
this.date=date;
this.songs=songs;
}
public int getId(){return id;}
public String getTitle(){return title;}
public int getDuration(){
for (Song s : songs) {duration+=s.getDuration();} //increase with each song's getDuration()
return duration;
}
public String getArtist(){return artist;}
public Date getDate(){return date;}
public ArrayList<Song> getSongs(){return songs;}
public void setId(){this.id=id;}
public void setTitle(){this.title=title;}
public void setArtist(){this.artist=artist;}
public void setDate(){this.date=date;}
}
|