CloneSet78


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
47240.957SourceElements[2]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
143163
Closure/closure/goog/math/integer.js
247150
Closure/closure/goog/math/long.js
Clone Instance
1
Line Count
43
Source Line
163
Source File
Closure/closure/goog/math/integer.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);


Clone Instance
2
Line Count
47
Source Line
150
Source File
Closure/closure/goog/math/long.js

/**
 * 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;


Clone AbstractionParameter Count: 4Parameter Bindings

/**
 * 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 Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#62d439e0]]
Long 
12[[#62d439e0]]
Integer 
21[[#62d439c0]]
'number format error: interior "-" character: '+str 
22[[#62d439c0]]
'number format error: interior "-" character' 
31[[#62d438a0]]
TWO_PWR_16_DBL_ 
32[[#62d438a0]]
TWO_PWR_32_DBL_ 
41[[#62d43840]]
1<<16 
42[[#62d43840]]
(1<<16)*(1<<16)