|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsk.baka.ambient.playlist.StaticPlaylistStrategy
public final class StaticPlaylistStrategy
A regular, old-school playlist. Manages the song ordering in playlist and queues. Supports shuffle and track repeat. Based on a 'static' list of tracks.
| Constructor Summary | |
|---|---|
StaticPlaylistStrategy(IPlaylistStrategy strategy)
Creates new static playlist strategy, optionally mimicking given strategy. |
|
| Method Summary | |
|---|---|
void |
add(int i,
List<TrackMetadataBean> tracks)
Inserts given tracks before track with given index. |
void |
clearQueue()
Clears queue from queued. |
void |
dequeue(int track)
Dequeues given track if it was queued previously. |
int |
getCurrentlyPlaying()
Returns currently playing track. |
List<PlaylistItem> |
getPlayItems()
Returns list of playlist items. |
List<Integer> |
getQueue()
Returns currently queued tracks. |
Random |
getRandom()
Returns current random mode. |
Interval |
move(Interval interval,
int target)
Moves selected tracks before track with given index. |
Interval |
moveBy(Interval interval,
int delta)
Moves selected tracks up or down at least delta tracks,
depending on the 'delta' value. |
int |
next()
Moves to next track to be played. |
int |
peekNext()
Peeks at the next track without actually changing the current track. |
int |
play(int track)
Plays given track. |
int |
previous()
Returns previous track to be played. |
void |
queue(Interval tracksToQueue)
Queue this track for playing, after all other queued tracks. |
void |
reinit()
Reinitializes the playlist - recomputes new random track ordering etc. |
void |
remove(Interval interval)
Removes tracks with given index from the playlist. |
void |
replaceLocations(Map<String,String> locationMap)
Modifies the playlist by changing all PlaylistItem locations. |
void |
setRandom(Random random)
Sets the random mode. |
void |
shuffle()
Randomize the playlist. |
int |
size()
Returns the playlist length. |
void |
sortByAlbumOrder()
Sorts the playlist with album order ordering. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StaticPlaylistStrategy(IPlaylistStrategy strategy)
strategy - the strategy to mimic. If null then an empty
playlist is created.| Method Detail |
|---|
public int getCurrentlyPlaying()
IPlaylistStrategy
getCurrentlyPlaying in interface IPlaylistStrategy-1 if nothing is being
played. Index to the IPlaylistStrategy.getPlayItems() list.public void shuffle()
IPlaylistStrategy
shuffle in interface IPlaylistStrategypublic int size()
IPlaylistStrategy
size in interface IPlaylistStrategypublic void sortByAlbumOrder()
IPlaylistStrategy
sortByAlbumOrder in interface IPlaylistStrategypublic List<PlaylistItem> getPlayItems()
IPlaylistStrategyReturns list of playlist items. The operation must be quick - it should for example provide immutable view on an internal playlist structure, it should not recompute the list anew on each call.
Each PlaylistItem in the list must be an unique instance.
getPlayItems in interface IPlaylistStrategypublic void clearQueue()
IPlaylistStrategy
clearQueue in interface IPlaylistStrategypublic List<Integer> getQueue()
IPlaylistStrategy
getQueue in interface IPlaylistStrategynull.public void setRandom(Random random)
IPlaylistStrategy
setRandom in interface IPlaylistStrategyrandom - the random mode, never null.public void remove(Interval interval)
IPlaylistStrategy-1.
remove in interface IPlaylistStrategyinterval - the interval to remove
public void add(int i,
List<TrackMetadataBean> tracks)
IPlaylistStrategy
add in interface IPlaylistStrategyi - the index, must not be negative.tracks - the tracks meta, must not be null.public void dequeue(int track)
IPlaylistStrategy
dequeue in interface IPlaylistStrategytrack - the track to dequeue.public void queue(Interval tracksToQueue)
IPlaylistStrategy
queue in interface IPlaylistStrategytracksToQueue - the tracks to queue, index to the IPlaylistStrategy.getPlayItems()
list.public void reinit()
IPlaylistStrategyIPlaylistStrategy.getCurrentlyPlaying()
will return -1).
reinit in interface IPlaylistStrategypublic int peekNext()
IPlaylistStrategy
peekNext in interface IPlaylistStrategy-1 when there's no track
left. Dynamic playlist may return -1 when there
are no upcoming tracks and the queue is empty.public int next()
IPlaylistStrategy-1 if no more
tracks are to be played - this also causes the
IPlaylistStrategy.getCurrentlyPlaying() method to return -1.
Calling this method while not playing anything will start to play first
track.
next in interface IPlaylistStrategy-1 if no more items are
to be played. Index to the IPlaylistStrategy.getPlayItems() list.public int play(int track)
IPlaylistStrategy
play in interface IPlaylistStrategytrack - the track to play. Index to the IPlaylistStrategy.getPlayItems() list.
If -1 then the current track pointer is moved
before first track and the playback is stopped.
public int previous()
IPlaylistStrategy-1 if we are
at the beginning of the playing track sequence. Calling this method while
not playing anything will start to play last track.
previous in interface IPlaylistStrategy-1 if
we are at the beginning of the playing track sequence.public Random getRandom()
IPlaylistStrategy
getRandom in interface IPlaylistStrategynull.
public Interval move(Interval interval,
int target)
IPlaylistStrategy
move in interface IPlaylistStrategyinterval - the interval to movetarget - move tracks before track with this index. If this index is
contained in the interval then nothing is done.
public Interval moveBy(Interval interval,
int delta)
IPlaylistStrategy
Moves selected tracks up or down at least delta tracks,
depending on the 'delta' value. The playlist may decide to move tracks by
more tracks than requested - for example, the dynamic playlist will skip
the currently playing/queued tracks. If the move is not possible (for
example there are not enough tracks) then move the tracks to the
beginning (or end) of the playlist.
Currently played track will not be changed, although the queue indices. Currently played track will not be changed, although the track index may change.
moveBy in interface IPlaylistStrategyinterval - the interval to movedelta - move tracks up 'delta' tracks (if delta is negative), or down
'delta' tracks (if delta is positive). Do nothing if delta is
zero.
public void replaceLocations(Map<String,String> locationMap)
IPlaylistStrategyPlaylistItem locations.
replaceLocations in interface IPlaylistStrategylocationMap - maps old locations to new locations.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||