Location: A review of cardiac cellular electrophysiology models @ a80b964384c0 / dojo-presentation / js / dojo / dojox / dtl / filter / integers.js

Author:
David Nickerson <nickerso@users.sourceforge.net>
Date:
2010-05-04 12:37:19+12:00
Desc:
adding initial version of SED-ML L1V1 file reproducing what is in graphs/BR-INa-variants.xml
Permanent Source URI:
https://models.cellml.org/workspace/a1/rawfile/a80b964384c0c7683d7c5d07b73a5af7a973d46c/dojo-presentation/js/dojo/dojox/dtl/filter/integers.js

dojo.provide("dojox.dtl.filter.integers");

dojo.mixin(dojox.dtl.filter.integers, {
	add: function(value, arg){
		value = parseInt(value);
		arg = parseInt(arg);
		return isNaN(arg) ? value : value + arg;
	},
	get_digit: function(value, arg){
		// summary:
		//		Given a whole number, returns the 1-based requested digit of it
		// desciprtion:
		//		1 is the right-most digit, 2 is the second-right-most digit, etc. Returns the
		//		original value for invalid input (if input or argument is not an integer,
		//		or if argument is less than 1). Otherwise, output is always an integer.
		value = parseInt(value);
		arg = parseInt(arg) - 1;
		if(arg >= 0){
			value += "";
			if(arg < value.length){
				value = parseInt(value.charAt(arg));
			}else{
				value = 0;
			}
		}
		return (isNaN(value) ? 0 : value);
	}
});