CloneSet88


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
58230.988SourceElements[2]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
160586
Closure/closure/goog/i18n/datetimeparse.js
258631
Closure/closure/goog/locale/datetimeparse.js
Clone Instance
1
Line Count
60
Source Line
586
Source File
Closure/closure/goog/i18n/datetimeparse.js

/**
 * Parse year field. Year field is special because
 * 1) two digit year need to be resolved.
 * 2) we allow year to take a sign.
 * 3) year field participate in abut processing.
 *
 * @param {string} text the time text to be parsed.
 * @param {Array.<number>} pos Parse position.
 * @param {number} start where this field start.
 * @param {number} value integer value of year.
 * @param {Object} part the pattern part for this field.
 * @param {goog.i18n.DateTimeParse.MyDate_} cal object to hold parsed value.
 *
 * @return {boolean} True if successful.
 * @private
 */
goog.i18n.DateTimeParse.prototype.subParseYear_=
    function (text, pos, start, value, part, cal){
  var ch;
  if (value<  0) {
    //possible sign
    ch=  text.charAt(pos[0]);
    if (ch!=  '+'
        &&           ch!=  '-') {
      return false;
                                }
    pos[0]++;
    value=  this.parseInt_(text, pos);
    if (value<  0) {
      return false;
                   }
    if (ch==  '-') {
      value=  -value;
                   }
                 }
  // only if 2 digit was actually parsed, and pattern say it has 2 digit.
  if (!ch
      &&     pos[0]-  start==  2
      &&                            part.count==  2) {
    cal.setTwoDigitYear_(value);
                                                     }
  else   {
    cal.year=  value;
         }
  return true;
                                                 } ;
/**
 * Parse Month field.
 *
 * @param {string} text the time text to be parsed.
 * @param {Array.<number>} pos Parse position.
 * @param {goog.i18n.DateTimeParse.MyDate_} cal object to hold parsed value.
 * @param {number} value numeric value if this field is expressed using
 *      numeric pattern, or -1 if not.
 *
 * @return {boolean} True if parsing successful.
 * @private
 */
goog.i18n.DateTimeParse.prototype.subParseMonth_=
    function (text, pos, cal, value){
  // when month is symbols, i.e., MMM or MMMM, value will be -1
  if (value<  0) {
    // Want to be able to parse both short and long forms.
    // Try count == 4 first:
    value=  this.matchString_(text, pos, goog.i18n.DateTimeSymbols.MONTHS);
    if (value<  0) { // count == 4 failed, now try count == 3
      value=  this.matchString_(text, pos,
                                goog.i18n.DateTimeSymbols.SHORTMONTHS);
                   }
    if (value<  0) {
      return false;
                   }
    cal.month=  value;
    return true;
                 }
  else   {
    cal.month=  value-  1;
    return true;
         }
                                    } ;


Clone Instance
2
Line Count
58
Source Line
631
Source File
Closure/closure/goog/locale/datetimeparse.js

/**
 * Parse year field. Year field is special because
 * 1) two digit year need to be resolved.
 * 2) we allow year to take a sign.
 * 3) year field participate in abut processing.
 *
 * @param {string} text the time text to be parsed.
 * @param {Array} pos Parse position.
 * @param {number} start where this field start.
 * @param {number} value integer value of year.
 * @param {Object} part the pattern part for this field.
 * @param {Object} cal MyDate_ object that will hold parsed value.
 *
 * @return {boolean} True if successful.
 * @private
 */
goog.locale.DateTimeParse.prototype.subParseYear_=
    function (text, pos, start, value, part, cal){
  var ch;
  if (value<  0) {
    //possible sign
    ch=  text.charAt(pos[0]);
    if (ch!=  '+'
        &&           ch!=  '-') {
      return false;
                                }
    pos[0]++;
    value=  this.parseInt_(text, pos);
    if (value<  0) {
      return false;
                   }
    if (ch==  '-') {
      value=  -value;
                   }
                 }
  // only if 2 digit was actually parsed, and pattern say it has 2 digit.
  if (!ch
      &&     pos[0]-  start==  2
      &&                            part.count==  2) {
    cal.setTwoDigitYear_(value);
                                                     }
  else   {
    cal.year=  value;
         }
  return true;
                                                 } ;
/**
 * Parse Month field.
 *
 * @param {string} text the time text to be parsed.
 * @param {Array} pos Parse position.
 * @param {Object} cal MyDate_ object that will hold parsed value.
 * @param {number} value numeric value if this field is expressed using
 *      numeric pattern, or -1 if not.
 *
 * @return {boolean} True if parsing successful.
 * @private
 */
goog.locale.DateTimeParse.prototype.subParseMonth_=
    function (text, pos, cal, value){
  // when month is symbols, i.e., MMM or MMMM, value will be -1
  if (value<  0) {
    // Want to be able to parse both short and long forms.
    // Try count == 4 first:
    value=  this.matchString_(text, pos, this.symbols_.MONTHS);
    if (value<  0) { // count == 4 failed, now try count == 3
      value=  this.matchString_(text, pos, this.symbols_.SHORTMONTHS);
                   }
    if (value<  0) {
      return false;
                   }
    cal.month=  value;
    return true;
                 }
  else   {
    cal.month=  value-  1;
    return true;
         }
                                    } ;


Clone AbstractionParameter Count: 3Parameter Bindings

/**
 * Parse year field. Year field is special because
 * 1) two digit year need to be resolved.
 * 2) we allow year to take a sign.
 * 3) year field participate in abut processing.
 *
 * @param {string} text the time text to be parsed.
 * @param {Array} pos Parse position.
 * @param {number} start where this field start.
 * @param {number} value integer value of year.
 * @param {Object} part the pattern part for this field.
 * @param {Object} cal MyDate_ object that will hold parsed value.
 *
 * @return {boolean} True if successful.
 * @private
 */
/**
 * Parse year field. Year field is special because
 * 1) two digit year need to be resolved.
 * 2) we allow year to take a sign.
 * 3) year field participate in abut processing.
 *
 * @param {string} text the time text to be parsed.
 * @param {Array.<number>} pos Parse position.
 * @param {number} start where this field start.
 * @param {number} value integer value of year.
 * @param {Object} part the pattern part for this field.
 * @param {goog.i18n.DateTimeParse.MyDate_} cal object to hold parsed value.
 *
 * @return {boolean} True if successful.
 * @private
 */
goog. [[#variable62956560]].DateTimeParse.prototype.subParseYear_= function (text,pos,start,value,part,cal)
                                                                   { var ch;
                                                                     if (value<0)
                                                                       {
                                                                         //possible sign
                                                                         ch=text.charAt(pos[0]);
                                                                         if (ch!='+'
                                                                             && ch!='-')
                                                                           { return false;
                                                                           }
                                                                         pos[0]++;
                                                                         value=this.parseInt_(text,pos);
                                                                         if (value<0)
                                                                           { return false;
                                                                           }
                                                                         if (ch=='-')
                                                                           { value=-value;
                                                                           }
                                                                       }
                                                                     // only if 2 digit was actually parsed, and pattern say it has 2 digit.
                                                                     if (!ch
                                                                         && pos[0]-start==2
                                                                         && part.count==2)
                                                                       { cal.setTwoDigitYear_(value);
                                                                       }
                                                                     else
                                                                       { cal.year=value;
                                                                       }
                                                                     return true;
                                                                   } ;
/**
 * Parse Month field.
 *
 * @param {string} text the time text to be parsed.
 * @param {Array} pos Parse position.
 * @param {Object} cal MyDate_ object that will hold parsed value.
 * @param {number} value numeric value if this field is expressed using
 *      numeric pattern, or -1 if not.
 *
 * @return {boolean} True if parsing successful.
 * @private
 */
/**
 * Parse Month field.
 *
 * @param {string} text the time text to be parsed.
 * @param {Array.<number>} pos Parse position.
 * @param {goog.i18n.DateTimeParse.MyDate_} cal object to hold parsed value.
 * @param {number} value numeric value if this field is expressed using
 *      numeric pattern, or -1 if not.
 *
 * @return {boolean} True if parsing successful.
 * @private
 */
goog. [[#variable62956560]].DateTimeParse.prototype.subParseMonth_= function (text,pos,cal,value)
                                                                    {
                                                                      // when month is symbols, i.e., MMM or MMMM, value will be -1
                                                                      if (value<0)
                                                                        {
                                                                          // Want to be able to parse both short and long forms.
                                                                          // Try count == 4 first:
                                                                          value=this.matchString_(text,pos, [[#variable61a38a80]]. [[#variable62956480]].MONTHS);
                                                                          if (value<0)
                                                                            { // count == 4 failed, now try count == 3
                                                                              value=this.matchString_(text,pos, [[#variable61a38a80]]. [[#variable62956480]].SHORTMONTHS);
                                                                            }
                                                                          if (value<0)
                                                                            { return false;
                                                                            }
                                                                          cal.month=value;
                                                                          return true;
                                                                        }
                                                                      else
                                                                        { cal.month=value-1;
                                                                          return true;
                                                                        }
                                                                    } ;
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#62956560]]
locale 
12[[#62956560]]
i18n 
21[[#61a38a80]]
this 
22[[#61a38a80]]
goog.i18n 
31[[#62956480]]
symbols_ 
32[[#62956480]]
DateTimeSymbols