sk.baka.ambient.collection.local
Class LibraryTrackProvider

java.lang.Object
  extended by sk.baka.ambient.collection.local.AbstractTrackProvider
      extended by sk.baka.ambient.collection.local.LibraryTrackProvider
All Implemented Interfaces:
Closeable, Serializable, Iterator<TrackMetadataBean>, IDynamicPlaylistTrackProvider

public final class LibraryTrackProvider
extends AbstractTrackProvider

Provides tracks from the library.

Author:
Martin Vysny
See Also:
Serialized Form

Constructor Summary
LibraryTrackProvider(Random random)
          Creates new library track provider.
 
Method Summary
protected  List<TrackMetadataBean> getAlbumTracks(String album)
          Fetches all tracks for given album.
protected  TrackMetadataBean getTrackFromCursor(Cursor c)
          Converts current row to a track bean.
protected  Cursor newCursor(boolean albums)
          Creates new cursor, depending on the value of albums argument.
 
Methods inherited from class sk.baka.ambient.collection.local.AbstractTrackProvider
close, getRandom, hasNext, next, remove, removeFromHistory, reset, setRandom
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LibraryTrackProvider

public LibraryTrackProvider(Random random)
Creates new library track provider.

Parameters:
random - initial random value.
Method Detail

getAlbumTracks

protected List<TrackMetadataBean> getAlbumTracks(String album)
Description copied from class: AbstractTrackProvider
Fetches all tracks for given album.

Specified by:
getAlbumTracks in class AbstractTrackProvider
Parameters:
album - the album to fetch.
Returns:
track list, never null, may be empty if no such album exists. Not required to be sorted.

getTrackFromCursor

protected TrackMetadataBean getTrackFromCursor(Cursor c)
Description copied from class: AbstractTrackProvider
Converts current row to a track bean. The cursor was provided by AbstractTrackProvider.newCursor(boolean) invoked with false.

Specified by:
getTrackFromCursor in class AbstractTrackProvider
Parameters:
c - the cursor, never null, always on a valid line.
Returns:
non-null track instance.

newCursor

protected Cursor newCursor(boolean albums)
Description copied from class: AbstractTrackProvider
Creates new cursor, depending on the value of albums argument.

Specified by:
newCursor in class AbstractTrackProvider
Parameters:
albums - if true then the cursor must provide string album names only, sorted by a random order. If false then the cursor must provide tracks sorted by random order.
Returns:
cursor, not null.


Copyright © 2007-2008. All Rights Reserved.