Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
47 | 2 | 4 | 0.957 | SourceElements[2] |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 43 | 163 | Closure/closure/goog/math/integer.js |
2 | 47 | 150 | Closure/closure/goog/math/long.js |
| ||||
/** * Returns an Integer representation of the given string, written using the * given radix. * @param {string} str The textual representation of the Integer. * @param {number=} opt_radix The radix in which the text is written. * @return {goog.math.Integer} The corresponding Integer value. */ goog.math.Integer.fromString= function (str, opt_radix){ if (str.length== 0) { throw Error('number format error: empty string'); } var radix= opt_radix || 10; if (radix< 2 || 36< radix) { throw Error('radix out of range: '+ radix); } if (str.charAt(0)== '-') { return goog.math.Integer.fromString(str.substring(1), radix).negate( ); } else if (str.indexOf('-')>= 0) { throw Error('number format error: interior "-" character'); } // Do several (8) digits each time through the loop, so as to // minimize the calls to the very expensive emulated div. var radixToPower= goog.math.Integer.fromNumber(Math.pow(radix, 8)); var result= goog.math.Integer.ZERO; for (var i= 0; i< str.length; i+= 8) { var size= Math.min(8, str.length- i); var value= parseInt(str.substring(i, i+ size), radix); if (size< 8) { var power= goog.math.Integer.fromNumber(Math.pow(radix, size)); result= result.multiply(power).add(goog.math.Integer.fromNumber(value)); } else { result= result.multiply(radixToPower); result= result.add(goog.math.Integer.fromNumber(value)); } } return result; } ; /** * A number used repeatedly in calculations. This must appear before the first * call to the from* functions below. * @type {number} * @private */ goog.math.Integer.TWO_PWR_32_DBL_= (1<< 16)* (1<< 16); |
| ||||
/** * Returns a Long representation of the given string, written using the given * radix. * @param {string} str The textual representation of the Long. * @param {number=} opt_radix The radix in which the text is written. * @return {goog.math.Long} The corresponding Long value. */ goog.math.Long.fromString= function (str, opt_radix){ if (str.length== 0) { throw Error('number format error: empty string'); } var radix= opt_radix || 10; if (radix< 2 || 36< radix) { throw Error('radix out of range: '+ radix); } if (str.charAt(0)== '-') { return goog.math.Long.fromString(str.substring(1), radix).negate( ); } else if (str.indexOf('-')>= 0) { throw Error('number format error: interior "-" character: '+ str); } // Do several (8) digits each time through the loop, so as to // minimize the calls to the very expensive emulated div. var radixToPower= goog.math.Long.fromNumber(Math.pow(radix, 8)); var result= goog.math.Long.ZERO; for (var i= 0; i< str.length; i+= 8) { var size= Math.min(8, str.length- i); var value= parseInt(str.substring(i, i+ size), radix); if (size< 8) { var power= goog.math.Long.fromNumber(Math.pow(radix, size)); result= result.multiply(power).add(goog.math.Long.fromNumber(value)); } else { result= result.multiply(radixToPower); result= result.add(goog.math.Long.fromNumber(value)); } } return result; } ; // NOTE: the compiler should inline these constant values below and then remove // these variables, so there should be no runtime penalty for these. /** * Number used repeated below in calculations. This must appear before the * first call to any from* function below. * @type {number} * @private */ goog.math.Long.TWO_PWR_16_DBL_= 1<< 16; |
| |||
/** * Returns a Long representation of the given string, written using the given * radix. * @param {string} str The textual representation of the Long. * @param {number=} opt_radix The radix in which the text is written. * @return {goog.math.Long} The corresponding Long value. */ /** * Returns an Integer representation of the given string, written using the * given radix. * @param {string} str The textual representation of the Integer. * @param {number=} opt_radix The radix in which the text is written. * @return {goog.math.Integer} The corresponding Integer value. */ goog.math. [[#variable62d439e0]].fromString= function (str,opt_radix) { if (str.length==0) { throw Error('number format error: empty string'); } var radix=opt_radix || 10; if (radix<2 || 36<radix) { throw Error('radix out of range: '+radix); } if (str.charAt(0)=='-') { return goog.math. [[#variable62d439e0]].fromString(str.substring(1),radix).negate( ); } else if (str.indexOf('-')>=0) { throw Error( [[#variable62d439c0]]); } // Do several (8) digits each time through the loop, so as to // minimize the calls to the very expensive emulated div. var radixToPower=goog.math. [[#variable62d439e0]].fromNumber(Math.pow(radix,8)); var result=goog.math. [[#variable62d439e0]].ZERO; for (var i=0; i<str.length; i+=8) { var size=Math.min(8,str.length-i); var value=parseInt(str.substring(i,i+size),radix); if (size<8) { var power=goog.math. [[#variable62d439e0]].fromNumber(Math.pow(radix,size)); result=result.multiply(power).add(goog.math. [[#variable62d439e0]].fromNumber(value)); } else { result=result.multiply(radixToPower); result=result.add(goog.math. [[#variable62d439e0]].fromNumber(value)); } } return result; } ; // NOTE: the compiler should inline these constant values below and then remove // these variables, so there should be no runtime penalty for these. /** * Number used repeated below in calculations. This must appear before the * first call to any from* function below. * @type {number} * @private */ /** * A number used repeatedly in calculations. This must appear before the first * call to the from* functions below. * @type {number} * @private */ goog.math. [[#variable62d439e0]]. [[#variable62d438a0]]= [[#variable62d43840]]; |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#62d439e0]] | Long |
1 | 2 | [[#62d439e0]] | Integer |
2 | 1 | [[#62d439c0]] | 'number format error: interior "-" character: '+str |
2 | 2 | [[#62d439c0]] | 'number format error: interior "-" character' |
3 | 1 | [[#62d438a0]] | TWO_PWR_16_DBL_ |
3 | 2 | [[#62d438a0]] | TWO_PWR_32_DBL_ |
4 | 1 | [[#62d43840]] | 1<<16 |
4 | 2 | [[#62d43840]] | (1<<16)*(1<<16) |