|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsk.baka.ambient.collection.local.AbstractTrackProvider
public abstract class AbstractTrackProvider
Provides random mix of tracks from the entire library.
Implementation note: this object causes a database Cursor to
be opened for a long time - not probably a good strategy.
| Constructor Summary | |
|---|---|
protected |
AbstractTrackProvider(Random random)
Creates a new provider. |
| Method Summary | |
|---|---|
void |
close()
|
protected abstract List<TrackMetadataBean> |
getAlbumTracks(String album)
Fetches all tracks for given album. |
protected Random |
getRandom()
Returns current random value. |
protected abstract TrackMetadataBean |
getTrackFromCursor(Cursor c)
Converts current row to a track bean. |
boolean |
hasNext()
|
protected abstract Cursor |
newCursor(boolean albums)
Creates new cursor, depending on the value of albums
argument. |
TrackMetadataBean |
next()
|
void |
remove()
|
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 track)
Sets the random mode of tracks provided next by the provider. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractTrackProvider(Random random)
random - The track ordering.| Method Detail |
|---|
protected final Random getRandom()
public void reset()
IDynamicPlaylistTrackProvider
reset in interface IDynamicPlaylistTrackProviderpublic void removeFromHistory(int trackCount)
IDynamicPlaylistTrackProvider
removeFromHistory in interface IDynamicPlaylistTrackProvidertrackCount - how many tracks to remove. If Integer.MAX_VALUE then
entire history should be cleaned up.
public void setRandom(Random random,
TrackMetadataBean track)
IDynamicPlaylistTrackProviderRandom.TRACK is set.
setRandom in interface IDynamicPlaylistTrackProviderrandom - the random mode, never null.track - optional current track. When Random.ALBUM, the
provider should start providing an album starting with this
track.public boolean hasNext()
hasNext in interface Iterator<TrackMetadataBean>public TrackMetadataBean next()
next in interface Iterator<TrackMetadataBean>public void remove()
remove in interface Iterator<TrackMetadataBean>public void close()
close in interface Closeableprotected abstract List<TrackMetadataBean> getAlbumTracks(String album)
album - the album to fetch.
null, may be empty if no such
album exists. Not required to be sorted.protected abstract Cursor newCursor(boolean albums)
albums
argument.
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.
null.protected abstract TrackMetadataBean getTrackFromCursor(Cursor c)
newCursor(boolean) invoked with false.
c - the cursor, never null, always on a valid
line.
null track instance.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||