javazoom.jlgui.player.amp.playlist

Class BasePlaylist

Implemented Interfaces:
Playlist

public class BasePlaylist
extends java.lang.Object
implements Playlist

BasePlaylist implementation. This class implements Playlist interface using a Vector. It support .m3u and .pls playlist format.

Field Summary

protected String
M3UHome
protected String
PLSHome
protected int
_cursorPos
protected Vector
_playlist
protected boolean
isModified

Constructor Summary

BasePlaylist()
Constructor.

Method Summary

void
addItemAt(PlaylistItem pli, int pos)
Adds item at a given position in the playlist.
void
appendItem(PlaylistItem pli)
Append item at the end of the playlist.
void
begin()
Moves the cursor at the top of the playlist.
Collection
getAllItems()
Returns a collection of playlist items.
PlaylistItem
getCursor()
Returns item matching to the cursor.
int
getIndex(PlaylistItem pli)
Returns index of playlist item.
PlaylistItem
getItemAt(int pos)
Returns item at a given position from the playlist.
String
getM3UHome()
Get M3U home for relative playlist.
String
getPLSHome()
Get PLS home for relative playlist.
int
getPlaylistSize()
Returns then number of items in the playlist.
int
getSelectedIndex()
Returns selected index.
boolean
isModified()
Checks the modification flag
boolean
load(String filename)
Loads playlist as M3U format.
protected boolean
loadM3U(String filename)
Load playlist from M3U format.
protected boolean
loadPLS(String filename)
Load playlist in PLS format.
void
nextCursor()
Computes cursor position (next).
void
previousCursor()
Computes cursor position (previous).
void
removeAllItems()
Removes all items from the playlist.
void
removeItem(PlaylistItem pli)
Searchs and removes item from the playlist.
void
removeItemAt(int pos)
Removes item at a given position from the playlist.
boolean
save(String filename)
Saves playlist in M3U format.
void
setCursor(int index)
void
setM3UHome(String string)
Set optional M3U home for relative playlist.
boolean
setModified(boolean set)
Set the modification flag for the playlist
void
setPLSHome(String string)
Set optional PLS home for relative playlist.
void
shuffle()
Shuffles items in the playlist randomly
void
sortItems(int sortmode)
Sorts items of the playlist.

Field Details

M3UHome

protected String M3UHome

PLSHome

protected String PLSHome

_cursorPos

protected int _cursorPos

_playlist

protected Vector _playlist

isModified

protected boolean isModified

Constructor Details

BasePlaylist

public BasePlaylist()
Constructor.

Method Details

addItemAt

public void addItemAt(PlaylistItem pli,
                      int pos)
Adds item at a given position in the playlist.
Specified by:
addItemAt in interface Playlist

appendItem

public void appendItem(PlaylistItem pli)
Append item at the end of the playlist.
Specified by:
appendItem in interface Playlist

begin

public void begin()
Moves the cursor at the top of the playlist.
Specified by:
begin in interface Playlist

getAllItems

public Collection getAllItems()
Returns a collection of playlist items.
Specified by:
getAllItems in interface Playlist

getCursor

public PlaylistItem getCursor()
Returns item matching to the cursor.
Specified by:
getCursor in interface Playlist

getIndex

public int getIndex(PlaylistItem pli)
Returns index of playlist item.
Specified by:
getIndex in interface Playlist

getItemAt

public PlaylistItem getItemAt(int pos)
Returns item at a given position from the playlist.
Specified by:
getItemAt in interface Playlist

getM3UHome

public String getM3UHome()
Get M3U home for relative playlist.
Returns:

getPLSHome

public String getPLSHome()
Get PLS home for relative playlist.
Returns:

getPlaylistSize

public int getPlaylistSize()
Returns then number of items in the playlist.
Specified by:
getPlaylistSize in interface Playlist

getSelectedIndex

public int getSelectedIndex()
Returns selected index.
Specified by:
getSelectedIndex in interface Playlist

isModified

public boolean isModified()
Checks the modification flag
Specified by:
isModified in interface Playlist

load

public boolean load(String filename)
Loads playlist as M3U format.
Specified by:
load in interface Playlist

loadM3U

protected boolean loadM3U(String filename)
Load playlist from M3U format.
Parameters:
filename -
Returns:

loadPLS

protected boolean loadPLS(String filename)
Load playlist in PLS format.
Parameters:
filename -
Returns:

nextCursor

public void nextCursor()
Computes cursor position (next).
Specified by:
nextCursor in interface Playlist

previousCursor

public void previousCursor()
Computes cursor position (previous).
Specified by:
previousCursor in interface Playlist

removeAllItems

public void removeAllItems()
Removes all items from the playlist.
Specified by:
removeAllItems in interface Playlist

removeItem

public void removeItem(PlaylistItem pli)
Searchs and removes item from the playlist.
Specified by:
removeItem in interface Playlist

removeItemAt

public void removeItemAt(int pos)
Removes item at a given position from the playlist.
Specified by:
removeItemAt in interface Playlist

save

public boolean save(String filename)
Saves playlist in M3U format.
Specified by:
save in interface Playlist

setCursor

public void setCursor(int index)
Specified by:
setCursor in interface Playlist

setM3UHome

public void setM3UHome(String string)
Set optional M3U home for relative playlist.
Parameters:
string -

setModified

public boolean setModified(boolean set)
Set the modification flag for the playlist
Specified by:
setModified in interface Playlist

setPLSHome

public void setPLSHome(String string)
Set optional PLS home for relative playlist.
Parameters:
string -

shuffle

public void shuffle()
Shuffles items in the playlist randomly
Specified by:
shuffle in interface Playlist

sortItems

public void sortItems(int sortmode)
Sorts items of the playlist.
Specified by:
sortItems in interface Playlist

JavaZOOM 1999-2006