Package MediaPlayer
Class Song
- java.lang.Object
-
- MediaPlayer.Song
-
-
Constructor Summary
Constructors Constructor Description Song(java.lang.String title, java.lang.String artist, java.lang.String album, java.lang.String duration)Creates a new Song with the given attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Song other)java.lang.StringgetAlbum()java.lang.StringgetArtist()java.lang.StringgetDuration()java.lang.StringgetTitle()java.lang.Object[]toPlaylistRow(int position)Converts the song data to an array for playlist table display.java.lang.StringtoString()java.lang.Object[]toTableRow()Converts the song data to an array for database table display.
-
-
-
Constructor Detail
-
Song
public Song(java.lang.String title, java.lang.String artist, java.lang.String album, java.lang.String duration)Creates a new Song with the given attributes.- Parameters:
title- The title of the songartist- The artist who performed the songalbum- The album the song belongs toduration- The duration of the song in MM:SS format
-
-
Method Detail
-
getTitle
public java.lang.String getTitle()
- Returns:
- The title of the song
-
getArtist
public java.lang.String getArtist()
- Returns:
- The artist of the song
-
getAlbum
public java.lang.String getAlbum()
- Returns:
- The album of the song
-
getDuration
public java.lang.String getDuration()
- Returns:
- The duration of the song
-
toTableRow
public java.lang.Object[] toTableRow()
Converts the song data to an array for database table display.- Returns:
- Object array with [title, artist, album, duration]
-
toPlaylistRow
public java.lang.Object[] toPlaylistRow(int position)
Converts the song data to an array for playlist table display.- Parameters:
position- The position of the song in the playlist- Returns:
- Object array with [position, title, artist, duration]
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-