javazoom.jlgui.player.amp.playlist
Class BasePlaylist

java.lang.Object
  extended by javazoom.jlgui.player.amp.playlist.BasePlaylist
All 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  int _cursorPos
           
protected  java.util.Vector _playlist
           
protected  boolean isModified
           
protected  java.lang.String M3UHome
           
protected  java.lang.String PLSHome
           
 
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.
 java.util.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.
 java.lang.String getM3UHome()
          Get M3U home for relative playlist.
 int getPlaylistSize()
          Returns then number of items in the playlist.
 java.lang.String getPLSHome()
          Get PLS home for relative playlist.
 int getSelectedIndex()
          Returns selected index.
 boolean isModified()
          Checks the modification flag
 boolean load(java.lang.String filename)
          Loads playlist as M3U format.
protected  boolean loadM3U(java.lang.String filename)
          Load playlist from M3U format.
protected  boolean loadPLS(java.lang.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(java.lang.String filename)
          Saves playlist in M3U format.
 void setCursor(int index)
           
 void setM3UHome(java.lang.String string)
          Set optional M3U home for relative playlist.
 boolean setModified(boolean set)
          Set the modification flag for the playlist
 void setPLSHome(java.lang.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_playlist

protected java.util.Vector _playlist

_cursorPos

protected int _cursorPos

isModified

protected boolean isModified

M3UHome

protected java.lang.String M3UHome

PLSHome

protected java.lang.String PLSHome
Constructor Detail

BasePlaylist

public BasePlaylist()
Constructor.

Method Detail

isModified

public boolean isModified()
Description copied from interface: Playlist
Checks the modification flag

Specified by:
isModified in interface Playlist

load

public boolean load(java.lang.String filename)
Loads playlist as M3U format.

Specified by:
load in interface Playlist

loadM3U

protected boolean loadM3U(java.lang.String filename)
Load playlist from M3U format.

Parameters:
filename -
Returns:

loadPLS

protected boolean loadPLS(java.lang.String filename)
Load playlist in PLS format.

Parameters:
filename -
Returns:

save

public boolean save(java.lang.String filename)
Saves playlist in M3U format.

Specified by:
save in interface Playlist

addItemAt

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

Specified by:
addItemAt 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

removeAllItems

public void removeAllItems()
Removes all items from the playlist.

Specified by:
removeAllItems in interface Playlist

appendItem

public void appendItem(PlaylistItem pli)
Append item at the end of the playlist.

Specified by:
appendItem in interface Playlist

sortItems

public void sortItems(int sortmode)
Sorts items of the playlist.

Specified by:
sortItems in interface Playlist

shuffle

public void shuffle()
Shuffles items in the playlist randomly

Specified by:
shuffle in interface Playlist

begin

public void begin()
Moves the cursor at the top of the playlist.

Specified by:
begin in interface Playlist

getItemAt

public PlaylistItem getItemAt(int pos)
Returns item at a given position from the playlist.

Specified by:
getItemAt in interface Playlist

getAllItems

public java.util.Collection getAllItems()
Returns a collection of playlist items.

Specified by:
getAllItems in interface Playlist

getPlaylistSize

public int getPlaylistSize()
Returns then number of items in the playlist.

Specified by:
getPlaylistSize in interface Playlist

getCursor

public PlaylistItem getCursor()
Returns item matching to the cursor.

Specified by:
getCursor in interface Playlist

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

setModified

public boolean setModified(boolean set)
Description copied from interface: Playlist
Set the modification flag for the playlist

Specified by:
setModified in interface Playlist

setCursor

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

getSelectedIndex

public int getSelectedIndex()
Returns selected index.

Specified by:
getSelectedIndex in interface Playlist

getIndex

public int getIndex(PlaylistItem pli)
Returns index of playlist item.

Specified by:
getIndex in interface Playlist

getM3UHome

public java.lang.String getM3UHome()
Get M3U home for relative playlist.

Returns:

setM3UHome

public void setM3UHome(java.lang.String string)
Set optional M3U home for relative playlist.

Parameters:
string -

getPLSHome

public java.lang.String getPLSHome()
Get PLS home for relative playlist.

Returns:

setPLSHome

public void setPLSHome(java.lang.String string)
Set optional PLS home for relative playlist.

Parameters:
string -


JavaZOOM 1999-2006