blob: edcdfc4b0ad615af99fab00015d12e56073216e5 (
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
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
|
/*
* Name : Song
*
* Description : The Song class is used to create songs while extending MusicalElement
*
* Version : 1.0
*
* Date : 28/12/2020
*
* Copyright : Aimeric ADJUTOR
*/
/**
* The Song class is used to create songs while extending MusicalElement.
*
* @version 1.0
*
* @see MusicalElement
* @author Aimeric ADJUTOR
*/
public class Song extends MusicalElement{
private static final long serialVersionUID = 2112880640160601826L;
private String artist, genre;
/**
* Constructor method.
*
* @param title String
* @param duration int
* @param content String, path to the mp3 file
* @param artist String
* @param genre Genre
*
* @see Genre
*
* @author Aimeric ADJUTOR
* */
public Song(String title, int duration, String content, String artist, Genre genre) {
super(title, duration, content);
this.artist=artist;
this.genre=genre.name();
}
/**
* This method is used to give the artist of the song.
*
* @return artist String
*
* @author Aimeric ADJUTOR
* */
public String getArtist(){return artist;}
/**
* This method is used to give the genre of the song.
*
* @return It returns the genre, which is a String because the constructor use the name method of the Genre class.
*
* @see Genre
* @author Aimeric ADJUTOR
* */
public String getGenre(){return genre;}
/**
* Basic method to set the artist of the song.
*
* @param artist String
*
* @author Aimeric ADJUTOR
* */
public void setArtist(String artist){this.artist=artist;}
/**
* Basic method to set the genre of the song using the name method from the Genre class.
*
* @param genre Genre
*
* @see Genre
*
* @author Aimeric ADJUTOR
* */
public void setGenre(Genre genre){this.genre=genre.name();}
/**
* Basic method to "configure" what does a print of this object actually does.
*
* @return String, using the object's methods
*
* @author Aimeric ADJUTOR
* */
public String toString() {
return "Id : "+getId()+"\nTitle : "+getTitle()+"\nDuration : "+getDuration()+"\nContent : "+getContent()+"\nArtist : "+getArtist()+"\nGenre : "+getGenre()+"\n";
}
}
|