org.musicontroller.core
Class Song

java.lang.Object
  extended by org.musicontroller.core.LinkableAbs
      extended by org.musicontroller.core.Song
All Implemented Interfaces:
Linkable

public class Song
extends LinkableAbs

Author:
Varienaja

Constructor Summary
Song()
           
 
Method Summary
 Event addDownloadedEvent(java.util.Date moment, IUser user)
           
 Event addEvent(java.util.Date moment, IUser user, int eventkind)
           
 Event addPlayedEvent(java.util.Date moment, IUser user)
           
 Event addRequestedEvent(java.util.Date moment, IUser user)
           
 Event addSkippedEvent(java.util.Date moment, IUser user)
           
 boolean equals(java.lang.Object o)
           
 AIBag getAibag()
           
 Band getBand()
           
 int getBpm()
           
 java.lang.String getComments()
           
 int getDownloadcount(IUser user, java.util.Date begin, java.util.Date end)
           
 int getEventcount(IUser user, int kind)
           
 int getEventCount(IUser user, int kind, java.util.Date begin, java.util.Date end)
          Counts the amount of events of a certain kind by a certain User
 java.util.Set<Event> getEvents()
          Getter for the set of events of the song.
 java.lang.String getFormattedLength()
           
static java.lang.String getFormattedLength(int lengthinmillis)
           
 Keywordbag getKeywordbag()
          Getter for the bag of keywords associated with the song.
 java.util.Date getLastPlay(IUser user)
          Returns the Date of the last Played-event of this song
 int getLength()
          Returns the song length in milliseconds.
 Link getLink()
           
 Song getParent()
           
 int getPlaycount(IUser user)
           
 int getPlaycount(IUser user, java.util.Date begin, java.util.Date end)
           
 java.util.Set<Contract_PS> getPlaylists()
           
 int getPopularity(IUser user, java.util.Date begin, java.util.Date end)
          Returns an int-representation of the popularity of a song during a certain period.
 int getRequestcount(IUser user)
           
 int getRequestcount(IUser user, java.util.Date begin, java.util.Date end)
           
 int getSkipcount(IUser user)
           
 int getSkipcount(IUser user, java.util.Date begin, java.util.Date end)
           
 java.lang.String getType()
           
 int hashCode()
           
 java.lang.String listKeywords()
          Returns the songs' keywords as a comma separated list of keywords.
 java.lang.String listPlaylists()
           
 void setAibag(AIBag aibag)
           
 void setBand(Band band)
           
 void setBpm(int bpm)
           
 void setComments(java.lang.String comments)
           
 void setEvents(java.util.Set<Event> events)
          Setter for the set of events of the song.
 void setKeywordbag(Keywordbag keywordbag)
          Setter for the bag of keywords associated with this song.
 void setLength(int length)
          Sets the song length in milliseconds.
 void setLength(java.lang.String formattedLength)
          Sets the Songs length.
 void setLink(Link link)
           
 void setParent(Song parent)
           
 void setPlaylists(java.util.Set<Contract_PS> playlists)
           
 java.lang.String toString()
           
 
Methods inherited from class org.musicontroller.core.LinkableAbs
getChanged, getId, getInserted, getName, normalizeName, setChanged, setId, setInserted, setName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Song

public Song()
Method Detail

addEvent

public Event addEvent(java.util.Date moment,
                      IUser user,
                      int eventkind)

addPlayedEvent

public Event addPlayedEvent(java.util.Date moment,
                            IUser user)

addRequestedEvent

public Event addRequestedEvent(java.util.Date moment,
                               IUser user)

addSkippedEvent

public Event addSkippedEvent(java.util.Date moment,
                             IUser user)

addDownloadedEvent

public Event addDownloadedEvent(java.util.Date moment,
                                IUser user)

getBand

public Band getBand()

setBand

public void setBand(Band band)

getBpm

public int getBpm()

setBpm

public void setBpm(int bpm)

getComments

public java.lang.String getComments()

setComments

public void setComments(java.lang.String comments)

getLink

public Link getLink()

setLink

public void setLink(Link link)

getLength

public int getLength()
Returns the song length in milliseconds.

Returns:
The songs length in milliseconds.

setLength

public void setLength(int length)
Sets the song length in milliseconds. Negative lengths are multiplied by -1.

Parameters:
length - The new length in milliseconds.

setLength

public void setLength(java.lang.String formattedLength)
Sets the Songs length. The input has to be in the format hh:mm:ss or mm:ss or ss.

Parameters:
formattedLength - The length in string-format.

getParent

public Song getParent()

setParent

public void setParent(Song parent)

getKeywordbag

public Keywordbag getKeywordbag()
Getter for the bag of keywords associated with the song.

Returns:
The bag of keywords of this song.

setKeywordbag

public void setKeywordbag(Keywordbag keywordbag)
Setter for the bag of keywords associated with this song.

Parameters:
keywordbag - The bag of keywords.

getEvents

public java.util.Set<Event> getEvents()
Getter for the set of events of the song.

Returns:
The set of events.

setEvents

public void setEvents(java.util.Set<Event> events)
Setter for the set of events of the song.

Parameters:
events - The set of events (not null).

getPlaylists

public java.util.Set<Contract_PS> getPlaylists()

setPlaylists

public void setPlaylists(java.util.Set<Contract_PS> playlists)

listKeywords

public java.lang.String listKeywords()
Returns the songs' keywords as a comma separated list of keywords.

Returns:
A string with the songs keywords separated by commas.

listPlaylists

public java.lang.String listPlaylists()

getFormattedLength

public static java.lang.String getFormattedLength(int lengthinmillis)

getFormattedLength

public java.lang.String getFormattedLength()

getPlaycount

public int getPlaycount(IUser user)

getRequestcount

public int getRequestcount(IUser user)

getSkipcount

public int getSkipcount(IUser user)

getPlaycount

public int getPlaycount(IUser user,
                        java.util.Date begin,
                        java.util.Date end)

getRequestcount

public int getRequestcount(IUser user,
                           java.util.Date begin,
                           java.util.Date end)

getSkipcount

public int getSkipcount(IUser user,
                        java.util.Date begin,
                        java.util.Date end)

getDownloadcount

public int getDownloadcount(IUser user,
                            java.util.Date begin,
                            java.util.Date end)

getEventcount

public int getEventcount(IUser user,
                         int kind)

getPopularity

public int getPopularity(IUser user,
                         java.util.Date begin,
                         java.util.Date end)
Returns an int-representation of the popularity of a song during a certain period. The popularity is defined as follows: popularity = playcount + requestcount + downloadcount - skipcount

Only events after the begin-parameter and before the end-parameter are taken into account. These parameters can be left null. When both are null, all events are counted. When begin is null, all events untill end are counted. If end is null, all events after begin are counted.

Parameters:
user - The user to calculate the popularity for.
begin - The begindate, or rather a timestamp.
end - The enddate, also a timestamp
Returns:
The popularity of the song.

getEventCount

public int getEventCount(IUser user,
                         int kind,
                         java.util.Date begin,
                         java.util.Date end)
Counts the amount of events of a certain kind by a certain User

Parameters:
user - The User, if null then the events of all user are added up
kind - The eventkind
begin - The Date after which events will be counted
end - The Date before which events will be counted
Returns:
The amount of events

getLastPlay

public java.util.Date getLastPlay(IUser user)
Returns the Date of the last Played-event of this song

Parameters:
user - The user to return the last Played-event for, if null the last played-event is returned
Returns:
The Date of the last Played-event

getAibag

public AIBag getAibag()

setAibag

public void setAibag(AIBag aibag)

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

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

getType

public java.lang.String getType()


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