sk.baka.ambient.collection
Interface IDynamicPlaylistTrackProvider

All Superinterfaces:
Closeable, Iterator<TrackMetadataBean>, Serializable
All Known Implementing Classes:
AbstractTrackProvider, LibraryTrackProvider, MediaStoreTrackProvider

public interface IDynamicPlaylistTrackProvider
extends Iterator<TrackMetadataBean>, Serializable, Closeable

Provides tracks on demand for the DynamicPlaylistStrategy playlist. The provider must maintain a history of provided tracks so that no tracks are provided two times (unless this functionality is explicitly required - for example when a playlist with same tracks is provided).

When there are no more items to play, the provider should clean up after itself and wait to be garbage-collected.

All providers must be serializable.

Author:
Martin Vysny

Method Summary
 void removeFromHistory(int trackCount)
          Removes given amount of oldest tracks from the history.
 void reset()
          Reinitializes itself - polls tracks from the DB etc.
 void setRandom(Random random, TrackMetadataBean currentTrack)
          Sets the random mode of tracks provided next by the provider.
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 
Methods inherited from interface java.io.Closeable
close
 

Method Detail

removeFromHistory

void removeFromHistory(int trackCount)
Removes given amount of oldest tracks from the history.

Parameters:
trackCount - how many tracks to remove. If Integer.MAX_VALUE then entire history should be cleaned up.

setRandom

void setRandom(Random random,
               TrackMetadataBean currentTrack)
Sets the random mode of tracks provided next by the provider. By default the Random.TRACK is set.

Parameters:
random - the random mode, never null.
currentTrack - optional current track. When Random.ALBUM, the provider should start providing an album starting with this track.

reset

void reset()
Reinitializes itself - polls tracks from the DB etc.



Copyright © 2007-2008. All Rights Reserved.