
 
 
/**
 * The object that incorporates all user-related data. Calling the getValue()
 * function will transparently return the default for a property
 * if the user hasn't entered anything for it yet. Calling isDefault will let
 * you know whether the value for a particular property is default or user-entered.
 */ 
 function UserData(obj) {
   //The projects the user has checked off
   this.projects = Array(0);
  //The id of the last screen the user viewed in the UI
   this.lastScreen = '';
  //The id of the last question the user answered in the UI
   this.lastQuestion = '';
   for (var property in obj) {
     this[property] = obj[property];
   }
 } 
  
  /**
   * Returns the value the user has entered for the property or the default value
   * if the user has not entered any value.
   * @param string propName The property whose value you want to know
   * @return the value of the property
   */
  UserData.prototype.getValue = function (propName) {
  	if (typeof this[propName] != 'undefined' && this[propName] != undefined && this[propName] != '') return this[propName];
  	return this.defaultAnswers[propName];
  } 
  
  /**
   * Sets the value of the property. Here for parallelism with getValue.
   * @param propName The name of the property you wish to set
   * @param newValue The value of the property.
   * @return this, to allow for method chaining
   */
  UserData.prototype.setValue = function (propName, newValue) {
    this[propName] = newValue;
    return this;
  }
  
  /**
   * Returns false if propName has not been entered by the user, true otherwise
   * @param propName The property you want to check
   * @return true if the user has supplied a value for propName, false otherwise
   */
  UserData.prototype.isDefaultValue = function (propName) {
  	return (typeof this[propName] == 'undefined' || this[propName] == undefined);
  }
  
  /**
   * Return a value from the outputs object
   * @param propName The name of the property you want the value for
   * @return the value of propName
   */
  UserData.prototype.getScore = function (propName) {
    return this.scores[propName];
  }
  


