ca.spaz.cron.user
Interface User

All Known Implementing Classes:
CRONUser

public interface User


Method Summary
 void addUserChangeListener(UserChangeListener l)
          Add a listener for user change events.
 void addUserMetrics(java.util.Date date, UserMetrics metrics)
          Add a new set of metrics for a particular date.
 void addUserMetrics(UserMetrics metrics)
          Add a new set of metrics for the current time.
 java.lang.Integer getAge()
          Get the user's age
 java.util.Date getBirthDate()
          Get the user's birthdate
 java.lang.Double getHeightInCM()
          Get the user's height in cm
 java.lang.String getName()
          Get the name of the user.
 Target getTarget(NutrientInfo nutrient)
          Get the target value for a particular nutrient.
 java.util.List getUserMetrics()
          Get a List of all user metrics.
 java.util.List getUserMetrics(java.util.Date date)
          Get a List of all user metrics for a given day.
 java.lang.String getUserPreference(java.lang.String prefName)
          This gets a user preference by name.
 boolean isFemale()
          Get the gender of the user.
 boolean isMale()
          Get the gender of the user.
 void removeUserChangeListener(UserChangeListener l)
          Remove a listener for user change events.
 void removeUserMetrics(UserMetrics metrics)
          Remove a set of user metrics from the database.
 void setBirthDate(java.util.Date date)
          Set the user's birthdate
 void setGender(boolean male)
          Set the gender of the user
 void setHeightInCM(java.lang.Double height)
          Set the user's height in cm
 void setName(java.lang.String name)
          Set the name of the user
 void setTarget(NutrientInfo nutrient, Target target)
          Set a target value for a particular NutrientInfo.
 void setUserPreference(java.lang.String prefName, java.lang.String value)
          Sets the value of a user preference.
 

Method Detail

getName

java.lang.String getName()
Get the name of the user.

Returns:
The user's name.

setName

void setName(java.lang.String name)
Set the name of the user

Parameters:
name -

isMale

boolean isMale()
Get the gender of the user.

Returns:
the gender of the user.

isFemale

boolean isFemale()
Get the gender of the user.

Returns:
the gender of the user.

setGender

void setGender(boolean male)
Set the gender of the user

Parameters:
male - true if the user is male, false otherwise.

getBirthDate

java.util.Date getBirthDate()
Get the user's birthdate

Returns:
the user's birthdate.

setBirthDate

void setBirthDate(java.util.Date date)
Set the user's birthdate

Parameters:
date -

getAge

java.lang.Integer getAge()
Get the user's age

Returns:
the user's age

getHeightInCM

java.lang.Double getHeightInCM()
Get the user's height in cm

Returns:
the user's height in cm

setHeightInCM

void setHeightInCM(java.lang.Double height)
Set the user's height in cm

Parameters:
height -

getUserPreference

java.lang.String getUserPreference(java.lang.String prefName)
This gets a user preference by name.

Parameters:
prefName - the ID of the preference.
Returns:
the value of the user's preference.

setUserPreference

void setUserPreference(java.lang.String prefName,
                       java.lang.String value)
Sets the value of a user preference. This value is subject to validation by the validators configured in CRONConfiguration. In the case where the value is not legal, this method will silently fail.

Parameters:
prefName - Tne ID of the preference.
value - The new value for the preference.
To Do:
Determine better error handling for setting an invalid value.

getUserMetrics

java.util.List getUserMetrics()
Get a List of all user metrics. These are the values that the user is tracking.

Returns:
a List containing UserMetrics objects for each date the user has a metric for.

getUserMetrics

java.util.List getUserMetrics(java.util.Date date)
Get a List of all user metrics for a given day. The day in the Date provided will be used to select them.

Parameters:
date - The date to search for metrics from.
Returns:
the User's metrics for the provided date.

addUserMetrics

void addUserMetrics(java.util.Date date,
                    UserMetrics metrics)
Add a new set of metrics for a particular date.

Parameters:
date -
metrics -

addUserMetrics

void addUserMetrics(UserMetrics metrics)
Add a new set of metrics for the current time.

Parameters:
metrics -

removeUserMetrics

void removeUserMetrics(UserMetrics metrics)
Remove a set of user metrics from the database.

Parameters:
metrics -

setTarget

void setTarget(NutrientInfo nutrient,
               Target target)
Set a target value for a particular NutrientInfo.

Parameters:
nutrient -
target -

getTarget

Target getTarget(NutrientInfo nutrient)
Get the target value for a particular nutrient.

Parameters:
nutrient -
Returns:
the nutrient's current Target

addUserChangeListener

void addUserChangeListener(UserChangeListener l)
Add a listener for user change events.

Parameters:
l - the listener.

removeUserChangeListener

void removeUserChangeListener(UserChangeListener l)
Remove a listener for user change events.

Parameters:
l - the listener.


Copyright © 2005 Spaz. All Rights Reserved.