comp202.fall2007.a5.util
Class Song

Object
  extended by comp202.fall2007.a5.util.Song

public class Song
extends Object

A Song object records the attributes of a digital audio track. These attributes includes the title of the audio track, the artist who produced it, the album on which it appears, the disc number, the track number, the playing length of the the track, and the path of the file on disk which contains this track.

Song objects are immutable; that is, the value of their attributes cannot be changed after they have been created.


Field Summary
static int EMPTY_TRACK
          Constant indicating that the track attribute is undefined.
 
Constructor Summary
Song(java.io.File filePath, String artist, String album, String title, int trackNumber, int length)
          Creates a new Song object with the specified attributes, and a disc number attribute equal to 1.
Song(java.io.File filePath, String artist, String album, String title, int discNumber, int trackNumber, int length)
          Creates a new Song object with the specified attributes.
 
Method Summary
 String getAlbum()
          Returns the title of the album on which this Song appears.
 String getArtist()
          Returns the name of the artist who produced this Song.
 int getDiscNumber()
          Returns the disc number of this Song.
 java.io.File getFilePath()
          Returns the path of the file on disk containing the audio track represented by this Song object.
 int getLength()
          Returns the length of this Song in seconds.
 String getTitle()
          Returns the title of this Song.
 int getTrackNumber()
          Returns the track number of this Song.
 String toString()
          Returns a String representation of this Song.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_TRACK

public static final int EMPTY_TRACK
Constant indicating that the track attribute is undefined.

See Also:
Constant Field Values
Constructor Detail

Song

public Song(java.io.File filePath,
            String artist,
            String album,
            String title,
            int discNumber,
            int trackNumber,
            int length)
Creates a new Song object with the specified attributes.

Parameters:
filePath - The path of the file on disk containing the audio track represented by the newly-created Song object.
artist - The artist who produced the newly-created Song.
album - The album on which the newly-created Song appears.
title - The title of the newly-created Song.
discNumber - The disc number of the newly-created Song.
trackNumber - The track number of the newly-created Song.
length - The length in seconds of the audio track represented by the newly-created Song.

Song

public Song(java.io.File filePath,
            String artist,
            String album,
            String title,
            int trackNumber,
            int length)
Creates a new Song object with the specified attributes, and a disc number attribute equal to 1.

Parameters:
filePath - The path of the file on disk containing the audio track represented by the newly-created Song object.
artist - The name of the artist who produced the newly-created Song.
album - The title of the album on which the newly-created Song appears.
title - The title of the newly-created Song.
trackNumber - The track number of the newly-created Song.
length - The length in seconds of the audio track represented by the newly-created Song.
Method Detail

getFilePath

public java.io.File getFilePath()
Returns the path of the file on disk containing the audio track represented by this Song object.

Returns:
The path of the file on disk containing the audio track represented by this Song object.

getArtist

public String getArtist()
Returns the name of the artist who produced this Song.

Returns:
The name of the artist who produced this Song.

getAlbum

public String getAlbum()
Returns the title of the album on which this Song appears.

Returns:
The title of the album on which this Song appears.

getTitle

public String getTitle()
Returns the title of this Song.

Returns:
The title of this Song.

getTrackNumber

public int getTrackNumber()
Returns the track number of this Song.

Returns:
The track number of this Song.

getDiscNumber

public int getDiscNumber()
Returns the disc number of this Song.

Returns:
The disc number of this Song.

getLength

public int getLength()
Returns the length of this Song in seconds.

Returns:
The length of this Song in seconds.

toString

public String toString()
Returns a String representation of this Song.

Overrides:
toString in class Object
Returns:
A String representation of this Song.