/*
 * Copyright (c) 2005 Absolutely Training Limited
 *  
 * Created on 07-Feb-2005
 */

 // constructor


function Score(){
	this.raw = 0;
	this.max = null;
	this.min = null;
	this.scaled = null;
	this._children = "scaled,raw,min,max";
	        
                this.propertiesArray = new Array("raw", "max", "min", "scaled");

		this.propertiesArrayForTest = new Array("raw");
		

        this.type="score";
        this.validator = new Validator();
}

// create and discard an initial Object to force the prototype object to be
// created in Navigator 3

new Score();  
Score.prototype = new RTEDataObject();
Score.prototype.constructor = Score;

Score.prototype.setRaw = function(raw){
        if (!this.validator.validateReal(raw)){
			return VariableInfo.ERROR_406;
		}
		this.raw=raw;
        return VariableInfo.NO_SET_ERROR;
};

Score.prototype.setMax = function(max){
        if (!this.validator.validateReal(max)){
            return VariableInfo.ERROR_406;
	}
        this.max = max;
	return VariableInfo.NO_SET_ERROR;
};

Score.prototype.setMin = function(min){
	    if (!this.validator.validateReal(min)){
		    return VariableInfo.ERROR_406;
	    }
	    this.min = min;
	    return VariableInfo.NO_SET_ERROR;
};

Score.prototype.setScaled = function(scaled){
	
    if (!this.validator.validateReal(scaled)){
            return VariableInfo.ERROR_406;
	}else if (!this.validator.validateRange(scaled, "-1.0", "1.0")){
		return VariableInfo.ERROR_407;		
    }else{
	    this.scaled = scaled;
		return VariableInfo.NO_SET_ERROR;
	}
};



