org.musicontroller.songselection
Class AdvancedRandomSongSelector

java.lang.Object
  extended by org.musicontroller.songselection.AdvancedRandomSongSelector
All Implemented Interfaces:
SongSelector

public class AdvancedRandomSongSelector
extends java.lang.Object
implements SongSelector


Constructor Summary
AdvancedRandomSongSelector()
           
 
Method Summary
 void addBandKnowledge(java.lang.Long bandid, int playcount, int skipcount)
          Adds knowledge about a Band.
 void addBandPlay(long bandid)
          Informs the SongSelector that a song of a certain Band has been played.
 void addBandSkip(long bandid)
          Informs the SongSelector that a song of a certain Band has been skipped.
 void addKeywordKnowledge(java.lang.Long keywordid, int playcount, int skipcount)
          Adds knowledge about a Keyword.
 void addKeywordPlay(long keywordid)
          Informs the SongSelector that a song of a certain Keyword has been played.
 void addKeywordSkip(long keywordid)
          Informs the SongSelector that a song of a certain Keyword has been skipped.
 Dao getDao()
           
 int getPenalty(Band band)
          Returns an integer, representing the penalty of a Band.
 int getPenalty(Keyword keyword)
          Returns an integer, representing the penalty of a Keyword.
 Song selectSong(java.util.List<Song> candidates, LastPlayedContainer lpc, IUser user)
          Returns one Song, which is selected using the Advanced Random algorithm.
 void setDao(Dao dao)
          Setter for the DAO.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdvancedRandomSongSelector

public AdvancedRandomSongSelector()
Method Detail

selectSong

public Song selectSong(java.util.List<Song> candidates,
                       LastPlayedContainer lpc,
                       IUser user)
Description copied from interface: SongSelector
Returns one Song, which is selected using the Advanced Random algorithm.

Specified by:
selectSong in interface SongSelector
Parameters:
candidates - The list of Songs that are requested. If this parameter is null, the result is null. If the set of candidates is empty the result is null.
lpc - The collection of the last songs played
user - The User
Returns:
The Song that is best suitable to be played

setDao

public void setDao(Dao dao)
Setter for the DAO.

Parameters:
dao - The DAO.

getDao

public Dao getDao()

getPenalty

public int getPenalty(Band band)
Returns an integer, representing the penalty of a Band.

Parameters:
band - The Band to check the popularity for.
Returns:
An integer equal to or smaller than 0.

getPenalty

public int getPenalty(Keyword keyword)
Returns an integer, representing the penalty of a Keyword.

Parameters:
keyword - The Keyword to check the popularity for.
Returns:
An integer equal to or smaller than 0.

addBandKnowledge

public void addBandKnowledge(java.lang.Long bandid,
                             int playcount,
                             int skipcount)
Adds knowledge about a Band. Knowledge is 'sparse', Bands without plays and skips are not stored.

Parameters:
bandid - The bandid
playcount - The amount of plays for this band
skipcount - The amount of skips for this band

addKeywordKnowledge

public void addKeywordKnowledge(java.lang.Long keywordid,
                                int playcount,
                                int skipcount)
Adds knowledge about a Keyword. Knowledge is 'sparse', Keywords without plays and skips are not stored.

Parameters:
keywordid - The keywordid
playcount - The amount of plays for this keyword
skipcount - The amount of skips for this keyword

addBandPlay

public void addBandPlay(long bandid)
Description copied from interface: SongSelector
Informs the SongSelector that a song of a certain Band has been played.

Specified by:
addBandPlay in interface SongSelector

addBandSkip

public void addBandSkip(long bandid)
Description copied from interface: SongSelector
Informs the SongSelector that a song of a certain Band has been skipped.

Specified by:
addBandSkip in interface SongSelector

addKeywordPlay

public void addKeywordPlay(long keywordid)
Description copied from interface: SongSelector
Informs the SongSelector that a song of a certain Keyword has been played.

Specified by:
addKeywordPlay in interface SongSelector

addKeywordSkip

public void addKeywordSkip(long keywordid)
Description copied from interface: SongSelector
Informs the SongSelector that a song of a certain Keyword has been skipped.

Specified by:
addKeywordSkip in interface SongSelector


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