org.musicontroller.songselection
Class RandomCandidateSelector

java.lang.Object
  extended by org.musicontroller.songselection.RandomCandidateSelector
All Implemented Interfaces:
CandidateSelector

public class RandomCandidateSelector
extends java.lang.Object
implements CandidateSelector

Randomly selects a preset number of songs from the song collection.

Version:
$Id: RandomCandidateSelector.java,v 1.1 2010/03/16 18:55:42 varienaja Exp $
Author:
drexler

Constructor Summary
RandomCandidateSelector()
          Default constructor sets the playRequestInOrder property to false.
 
Method Summary
 void addToCandidates(Song song)
          Adds a Song to the pool.
 int getCandidateCount()
          Getter for the number of candidates that will be returned in a list of candidate Songs.
 Dao getDao()
           
 void playRequestsAtRandom()
          Instructs the selector to play the requested songs in random order.
 void playRequestsInOrder()
          Instructs the selector to select requested songs in the order of entry.
 void removeFromCandidates(Song song)
          Removes a Song from the pool.
 boolean requestsPlayedAtRandom()
          Returns true if the requests will be played at random or false otherwise.
 boolean requestsPlayedInOrder()
          Returns true if the requests will be played in order of entry or false otherwise.
 java.util.List<Song> selectCandidates(int count)
          Selects a selection of candidate-Songs from the pool.
 java.util.List<Song> selectCandidates(java.util.List<java.lang.Long> requests)
          Selects candidate-Songs from the pool.
 void setCandidateCount(int candidatecount)
          Setter for the number of candidates in the candidate set.
 void setDao(Dao dao)
          Sets the Dao and initializes the internal set of songIDs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomCandidateSelector

public RandomCandidateSelector()
Default constructor sets the playRequestInOrder property to false.

Method Detail

setDao

public void setDao(Dao dao)
Sets the Dao and initializes the internal set of songIDs.

Parameters:
dao - The Dao.

getDao

public Dao getDao()

playRequestsInOrder

public void playRequestsInOrder()
Description copied from interface: CandidateSelector
Instructs the selector to select requested songs in the order of entry. TODO if this setting changes, the DJ must revise its predictions

Specified by:
playRequestsInOrder in interface CandidateSelector

playRequestsAtRandom

public void playRequestsAtRandom()
Description copied from interface: CandidateSelector
Instructs the selector to play the requested songs in random order. TODO if this setting changes, the DJ must revise its predictions

Specified by:
playRequestsAtRandom in interface CandidateSelector

selectCandidates

public java.util.List<Song> selectCandidates(java.util.List<java.lang.Long> requests)
Description copied from interface: CandidateSelector
Selects candidate-Songs from the pool. If requests were made, all those requests are returned, even if there are more than candidatecount of them.

Specified by:
selectCandidates in interface CandidateSelector
Parameters:
requests - An optional list of requested songs.
Returns:
A list of candidate Songs

selectCandidates

public java.util.List<Song> selectCandidates(int count)
Description copied from interface: CandidateSelector
Selects a selection of candidate-Songs from the pool.

Specified by:
selectCandidates in interface CandidateSelector
Parameters:
count - The amount of candidates to select. When this value is bigger than the amount of songs available in the pool, a as much Songs as possible are returned.
Returns:
A list of candidate Songs, in which no Song appears more than once.

removeFromCandidates

public void removeFromCandidates(Song song)
Description copied from interface: CandidateSelector
Removes a Song from the pool.

Specified by:
removeFromCandidates in interface CandidateSelector
Parameters:
song - The Song to remove.

requestsPlayedAtRandom

public boolean requestsPlayedAtRandom()
Description copied from interface: CandidateSelector
Returns true if the requests will be played at random or false otherwise.

Specified by:
requestsPlayedAtRandom in interface CandidateSelector
Returns:
True if the requests will be played at random.

requestsPlayedInOrder

public boolean requestsPlayedInOrder()
Description copied from interface: CandidateSelector
Returns true if the requests will be played in order of entry or false otherwise.

Specified by:
requestsPlayedInOrder in interface CandidateSelector
Returns:
True if the requests will be played in the order of entry.

getCandidateCount

public int getCandidateCount()
Description copied from interface: CandidateSelector
Getter for the number of candidates that will be returned in a list of candidate Songs.

Specified by:
getCandidateCount in interface CandidateSelector
Returns:
The size of the candidate list.

setCandidateCount

public void setCandidateCount(int candidatecount)
Setter for the number of candidates in the candidate set.

Parameters:
candidatecount - The size of the candidate set.

addToCandidates

public void addToCandidates(Song song)
Description copied from interface: CandidateSelector
Adds a Song to the pool.

Specified by:
addToCandidates in interface CandidateSelector
Parameters:
song - The Song to add.


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