org.musicontroller
Class DJImpl

java.lang.Object
  extended by org.musicontroller.DJImpl
All Implemented Interfaces:
DJ, SongChangeListener

public class DJImpl
extends java.lang.Object
implements DJ, SongChangeListener


Constructor Summary
DJImpl()
           
 
Method Summary
 Song choose()
          Lets the DJ choose a new Song to play, using the SongSelector to select a song from the candidates generated by the CandidateSelector
 void confirmPlay()
          Call this when the currently playing Song has been played completely.
 void confirmSkip()
          Call this when the currently playing Song has indeed be skipped.
 CandidateSelector getCandidateSelector()
           
 Song getCurrentSong()
           
 MusiController getMusiController()
           
 int getPlayingTime()
           
 java.util.List<java.lang.Long> getRequests()
           
 SongSelector getSongSelector()
           
 IUser getUser()
           
 boolean mustSkip()
           
 void onSongAdded(Song song)
          Will be called when a new Song object was created.
 void onSongChanged(Song song)
          Will be called when an existing Song was changed (edited).
 void onSongDeleted(Song song)
          Will be called when an existing Song was deleted.
 java.util.List<java.lang.Long> peek(int count)
          Takes a look into the future, and tells which Songs will be played next.
 void playSong(long songid)
          Tells the DJ to skip the currently playing Song, and start playing a new one.
 void requestSong(long songid)
          Requests a song.
 void setCandidateSelector(CandidateSelector selector)
           
 void setMusiController(MusiController musicontroller)
           
 void setPlaying(boolean playing)
          Sets the state of the DJ.
 void setPlayingTime(int millis)
          To be used by the StreamService, to provide feedback to the DJ about the amount of milliseconds that have been played of the current ssong.
 void setSongSelector(SongSelector selector)
           
 void setUser(IUser user)
           
 void skipSong()
          Tells the DJ to skip the currently playing Song.
 void unrequestSong(long songid)
          Unrequests a previously requested Song.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DJImpl

public DJImpl()
Method Detail

setPlaying

public void setPlaying(boolean playing)
Description copied from interface: DJ
Sets the state of the DJ.

Specified by:
setPlaying in interface DJ
Parameters:
playing - Use True, if the DJ is playing or False otherwise.

setMusiController

public void setMusiController(MusiController musicontroller)
Specified by:
setMusiController in interface DJ

getMusiController

public MusiController getMusiController()
Specified by:
getMusiController in interface DJ

getSongSelector

public SongSelector getSongSelector()
Specified by:
getSongSelector in interface DJ

setSongSelector

public void setSongSelector(SongSelector selector)
Specified by:
setSongSelector in interface DJ

getCandidateSelector

public CandidateSelector getCandidateSelector()
Specified by:
getCandidateSelector in interface DJ

setCandidateSelector

public void setCandidateSelector(CandidateSelector selector)
Specified by:
setCandidateSelector in interface DJ

choose

public Song choose()
Description copied from interface: DJ
Lets the DJ choose a new Song to play, using the SongSelector to select a song from the candidates generated by the CandidateSelector

Specified by:
choose in interface DJ
Returns:
A new Song

requestSong

public void requestSong(long songid)
Description copied from interface: DJ
Requests a song.

Specified by:
requestSong in interface DJ
Parameters:
songid - The Id of the Song.

unrequestSong

public void unrequestSong(long songid)
Description copied from interface: DJ
Unrequests a previously requested Song. The Song will be marked 'skipped'.

Specified by:
unrequestSong in interface DJ
Parameters:
songid - The Id of the Song.

skipSong

public void skipSong()
Description copied from interface: DJ
Tells the DJ to skip the currently playing Song.

Specified by:
skipSong in interface DJ

mustSkip

public boolean mustSkip()
Specified by:
mustSkip in interface DJ
Returns:
True, if skipSong was called, False otherwise.

confirmSkip

public void confirmSkip()
Description copied from interface: DJ
Call this when the currently playing Song has indeed be skipped. A skipped-event will be added to the Song.

Specified by:
confirmSkip in interface DJ

confirmPlay

public void confirmPlay()
Description copied from interface: DJ
Call this when the currently playing Song has been played completely. A played-event will be added to the Song.

Specified by:
confirmPlay in interface DJ

playSong

public void playSong(long songid)
Description copied from interface: DJ
Tells the DJ to skip the currently playing Song, and start playing a new one.

Specified by:
playSong in interface DJ
Parameters:
songid - The Id of the new Song to be played.

getRequests

public java.util.List<java.lang.Long> getRequests()
Specified by:
getRequests in interface DJ

setUser

public void setUser(IUser user)
Specified by:
setUser in interface DJ

getUser

public IUser getUser()
Specified by:
getUser in interface DJ

getCurrentSong

public Song getCurrentSong()
Specified by:
getCurrentSong in interface DJ
Returns:
The Song that is currently playing, or null is the DJ is not playing any Song.

peek

public java.util.List<java.lang.Long> peek(int count)
Description copied from interface: DJ
Takes a look into the future, and tells which Songs will be played next. This information is valid until new requests/unrequests are made. Requests will always be in the resultset, followed by 'count' predicted songs.

Specified by:
peek in interface DJ
Parameters:
count - The amount of Songs to predict (maxed at 15).
Returns:
A List of Song-ids that will be played next.

setPlayingTime

public void setPlayingTime(int millis)
Description copied from interface: DJ
To be used by the StreamService, to provide feedback to the DJ about the amount of milliseconds that have been played of the current ssong.

Specified by:
setPlayingTime in interface DJ
Parameters:
millis - The amount of milliseconds the current song has been played.

getPlayingTime

public int getPlayingTime()
Specified by:
getPlayingTime in interface DJ
Returns:
The amount of milliseconds the current song has been played.

onSongAdded

public void onSongAdded(Song song)
Description copied from interface: SongChangeListener
Will be called when a new Song object was created.

Specified by:
onSongAdded in interface SongChangeListener
Parameters:
song - The new Song.

onSongChanged

public void onSongChanged(Song song)
Description copied from interface: SongChangeListener
Will be called when an existing Song was changed (edited).

Specified by:
onSongChanged in interface SongChangeListener
Parameters:
song - The changed Song.

onSongDeleted

public void onSongDeleted(Song song)
Description copied from interface: SongChangeListener
Will be called when an existing Song was deleted.

Specified by:
onSongDeleted in interface SongChangeListener
Parameters:
song - The deleted Song.


Copyright © 2010 A.J.V.. All Rights Reserved.