org.musicontroller.songselection
Class LastPlayedContainer

java.lang.Object
  extended by org.musicontroller.songselection.LastPlayedContainer
All Implemented Interfaces:
java.lang.Cloneable

public class LastPlayedContainer
extends java.lang.Object
implements java.lang.Cloneable

The LastPlayedContainer keeps a List of song-IDs that have been played and/or skipped in recent history. These song-ID's are used by the SongSelector-interface to match to-be-played songs with the ones that have been previously played.

Author:
Varienaja

Constructor Summary
LastPlayedContainer()
           
 
Method Summary
 void addToLastPlayed(long songid)
          Add the played song to a list of recently played songs.
 void addToLastPlayed(long songid, boolean entirely)
          Add the played or skipped song to a list of recently played songs.
 LastPlayedContainer clone()
           
 java.util.Iterator<LastPlayedEntry> getIterator()
           
 int getSize()
           
 void markLastSongAsSkipped()
          Marks the last played Song in the list as 'skipped'.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LastPlayedContainer

public LastPlayedContainer()
Method Detail

addToLastPlayed

public void addToLastPlayed(long songid)
Add the played song to a list of recently played songs. Because this song could be in the list very long (The user might log out and come back later) we store the song-id and reload the song object when needed. This approach prevents Hibernate closed session exceptions.

Parameters:
songid - The id of the Song to add to the list.

addToLastPlayed

public void addToLastPlayed(long songid,
                            boolean entirely)
Add the played or skipped song to a list of recently played songs.

Parameters:
songid - The id of the Song to add to the list.
entirely - whether or not the Song was played entirely..
See Also:
addToLastPlayed(long)

getSize

public int getSize()

getIterator

public java.util.Iterator<LastPlayedEntry> getIterator()

clone

public LastPlayedContainer clone()
                          throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

markLastSongAsSkipped

public void markLastSongAsSkipped()
Marks the last played Song in the list as 'skipped'.



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