song
Class User

java.lang.Object
  extended by song.User

public class User
extends java.lang.Object


Constructor Summary
User()
          Creates a new default instance of User
User(java.lang.String allInfo)
          Creates a new instance of User given a comma delimited string containing the last and first name (such as might be obtained via reading in a file that has one line per User) Assumes info is organized as: last,first
User(java.lang.String last, java.lang.String first)
          creates a new instance of User, given last and first name
User(java.lang.String last, java.lang.String first, int idLen)
          creates a new instance of User, given last and first name and length of the user ID.
 
Method Summary
 boolean addSongRating(Song sg, int rate)
          add a song rating, given the song and rating.
 boolean addSongRating(SongRating sngrt)
          add a song rating, given the actual SongRating object to add.
 double getAveRatings()
          report ave (mean) total rating per song .
 java.lang.String getFirstName()
          report user first name
 java.lang.String getLastName()
          report user last name
 java.lang.String getLastNameFirst()
          report name, last name first
 java.lang.String getLastSongRatingString()
          report string representation for last song rating added.
 SongRating getMatchingSongRating(Song toFind)
          return a SongRating object corresponding to the passed Song - if the Song isn't found the returned SongRating will be a newly created one with the default rating
 SongRating getNthSongRating(int n)
          report work info for Nth song rating presuming that there are that many song ratings.
 double getNthSongRatingRating(int n)
          report song rating for Nth song rating presuming that there are that many song ratings.
 Song getNthSongRatingSong(int n)
          report song for Nth song rating presuming that there are that many song ratings.
 java.lang.String getNthSongRatingString(int n)
          report string representation for Nth song rating presuming that there are that many song ratings.
 int getNumSongRatings()
          report number of ratings of songs
 java.lang.String getUserID()
          report user ID - to user of User class, this is a String
 java.lang.String getWholeName()
          report whole name
 boolean isMatchingSongRatingFound(Song toFind)
          return whether the passed Song is found in the users song rating info
 void setFirstName(java.lang.String first)
          set first name to a sepcific value.
 void setLastName(java.lang.String last)
          set last name to a specific value.
 void sortSongRatings()
          sort song ratings based on song rating's comparaison (the rating itself)
 java.lang.String toShortString()
          produce a shorter friendly string version of the object
 java.lang.String toString()
          produce a friendly string version of the object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

User

public User()
Creates a new default instance of User


User

public User(java.lang.String last,
            java.lang.String first)
creates a new instance of User, given last and first name


User

public User(java.lang.String last,
            java.lang.String first,
            int idLen)
creates a new instance of User, given last and first name and length of the user ID. If the pay rate is too low, it defaults to the minimum wage. If the length of the ID is too short, uses default length.


User

public User(java.lang.String allInfo)
Creates a new instance of User given a comma delimited string containing the last and first name (such as might be obtained via reading in a file that has one line per User) Assumes info is organized as: last,first

Method Detail

getUserID

public java.lang.String getUserID()
report user ID - to user of User class, this is a String


getLastName

public java.lang.String getLastName()
report user last name


getFirstName

public java.lang.String getFirstName()
report user first name


getWholeName

public java.lang.String getWholeName()
report whole name


getLastNameFirst

public java.lang.String getLastNameFirst()
report name, last name first


getNumSongRatings

public int getNumSongRatings()
report number of ratings of songs


getNthSongRating

public SongRating getNthSongRating(int n)
report work info for Nth song rating presuming that there are that many song ratings. Starts with 1 like humans count.


getNthSongRatingString

public java.lang.String getNthSongRatingString(int n)
report string representation for Nth song rating presuming that there are that many song ratings. Starts with 1 like humans count.


getNthSongRatingSong

public Song getNthSongRatingSong(int n)
report song for Nth song rating presuming that there are that many song ratings. Starts with 1 like humans count. Returns negative if n is invalid.


getNthSongRatingRating

public double getNthSongRatingRating(int n)
report song rating for Nth song rating presuming that there are that many song ratings. Starts with 1 like humans count. Returns negative if n is invalid.


getAveRatings

public double getAveRatings()
report ave (mean) total rating per song . Returns 0 if no song ratings.


getLastSongRatingString

public java.lang.String getLastSongRatingString()
report string representation for last song rating added.


getMatchingSongRating

public SongRating getMatchingSongRating(Song toFind)
return a SongRating object corresponding to the passed Song - if the Song isn't found the returned SongRating will be a newly created one with the default rating


isMatchingSongRatingFound

public boolean isMatchingSongRatingFound(Song toFind)
return whether the passed Song is found in the users song rating info


setLastName

public void setLastName(java.lang.String last)
set last name to a specific value. Cannot really validate.


setFirstName

public void setFirstName(java.lang.String first)
set first name to a sepcific value. Cannot really validate.


addSongRating

public boolean addSongRating(SongRating sngrt)
add a song rating, given the actual SongRating object to add. Always returns true.


addSongRating

public boolean addSongRating(Song sg,
                             int rate)
add a song rating, given the song and rating. Constructs the object to add. returns true if the rating is reasonable.


toString

public java.lang.String toString()
produce a friendly string version of the object

Overrides:
toString in class java.lang.Object

toShortString

public java.lang.String toShortString()
produce a shorter friendly string version of the object


sortSongRatings

public void sortSongRatings()
sort song ratings based on song rating's comparaison (the rating itself)