CloneSet74


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
59260.983ExpressionStatement
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
159167
Closure/closure/goog/i18n/datetimeparse.js
259211
Closure/closure/goog/locale/datetimeparse.js
Clone Instance
1
Line Count
59
Source Line
167
Source File
Closure/closure/goog/i18n/datetimeparse.js

/**
 * Apply a pattern to this Parser. The pattern string will be parsed and saved
 * in "compiled" form.
 * Note: this method is somewhat similar to the pattern parsing methold in
 *       datetimeformat. If you see something wrong here, you might want
 *       to check the other.
 * @param {string} pattern It describes the format of date string that need to
 *     be parsed.
 * @private
 */
goog.i18n.DateTimeParse.prototype.applyPattern_=  function (pattern){
  var inQuote=  false;
  var buf=  '';

  for (var i=  0; i<  pattern.length; i++) {
    var ch=  pattern.charAt(i);

    // handle space, add literal part (if exist), and add space part
    if (ch==  ' ') {
      if (buf.length>  0) {
        this.patternParts_.push( {text: buf, count: 0, abutStart: false } );
        buf=  '';
                          }
      this.patternParts_.push( {text: ' ', count: 0, abutStart: false } );
      while (i<  pattern.length-  1
             &&                        pattern.charAt(i+  1)==  ' ') {
        i++;
                                                                     }
                   }
    else   if (inQuote) {
      // inside quote, except '', just copy or exit
      if (ch==  '\'') {
        if (i+  1<  pattern.length
            &&                        pattern.charAt(i+  1)==  '\'') {
          // quote appeared twice continuously, interpret as one quote.
          buf+=  '\'';
          i++;
                                                                     }
        else   {
          // exit quote
          inQuote=  false;
               }
                      }
      else   {
        // literal
        buf+=  ch;
             }
                        }
           else
           if (goog.i18n.DateTimeParse.PATTERN_CHARS_.indexOf(ch)>=  0) {
      // outside quote, it is a pattern char
      if (buf.length>  0) {
        this.patternParts_.push( {text: buf, count: 0, abutStart: false } );
        buf=  '';
                          }
      var count=  this.getNextCharCount_(pattern, i);
      this.patternParts_.push( {text: ch, count: count, abutStart: false } );
      i+=  count-  1;
                                                                        }
           else
           if (ch==  '\'') {
      // Two consecutive quotes is a quote literal, inside or outside of quotes.
      if (i+  1<  pattern.length
          &&                        pattern.charAt(i+  1)==  '\'') {
        buf+=  '\'';
        i++;
                                                                   }
      else   {
        inQuote=  true;
             }
                           }
           else
           {
      buf+=  ch;
           }
                                           }
  if (buf.length>  0) {
    this.patternParts_.push( {text: buf, count: 0, abutStart: false } );
                      }
  this.markAbutStart_( );
                                                                    } ;


Clone Instance
2
Line Count
59
Source Line
211
Source File
Closure/closure/goog/locale/datetimeparse.js

/**
 * Apply a pattern to this Parser. The pattern string will be parsed and saved
 * in "compiled" form.
 * Note: this method is somewhat similar to the pattern parsing methold in
 *       datetimeformat. If you see something wrong here, you might want
 *       to check the other.
 * @param {string} pattern It describes the format of date string that need to
 *     be parsed.
 * @deprecated Use goog.i18n.DateTimeParse.
 */
goog.locale.DateTimeParse.prototype.applyPattern=  function (pattern){
  var inQuote=  false;
  var buf=  '';

  for (var i=  0; i<  pattern.length; i++) {
    var ch=  pattern.charAt(i);

    // handle space, add literal part (if exist), and add space part
    if (ch==  ' ') {
      if (buf.length>  0) {
        this.patternParts_.push( {text: buf, count: 0, abutStart: false } );
        buf=  '';
                          }
      this.patternParts_.push( {text: ' ', count: 0, abutStart: false } );
      while (i+  1<  pattern.length
             &&                        pattern.charAt(i+  1)==  ' ') {
        i++;
                                                                     }
                   }
    else   if (inQuote) {
      // inside quote, except '', just copy or exit
      if (ch==  '\'') {
        if (i+  1<  pattern.length
            &&                        pattern.charAt(i+  1)==  '\'') {
          // quote appeared twice continuously, interpret as one quote.
          buf+=  ch;
          ++i;
                                                                     }
        else   {
          // exit quote
          inQuote=  false;
               }
                      }
      else   {
        // literal
        buf+=  ch;
             }
                        }
           else
           if (goog.locale.DateTimeParse.PATTERN_CHARS_.indexOf(ch)>=  0) {
      // outside quote, it is a pattern char
      if (buf.length>  0) {
        this.patternParts_.push( {text: buf, count: 0, abutStart: false } );
        buf=  '';
                          }
      var count=  this.getNextCharCount_(pattern, i);
      this.patternParts_.push( {text: ch, count: count, abutStart: false } );
      i+=  count-  1;
                                                                          }
           else
           if (ch==  '\'') {
      // Two consecutive quotes is a quote literal, inside or outside of quotes.
      if (i+  1<  pattern.length
          &&                        pattern.charAt(i+  1)==  '\'') {
        buf+=  "'";
        i++;
                                                                   }
      else   {
        inQuote=  true;
             }
                           }
           else
           {
      buf+=  ch;
           }
                                           }
  if (buf.length>  0) {
    this.patternParts_.push( {text: buf, count: 0, abutStart: false } );
                      }
  this.markAbutStart_( );
                                                                     } ;


Clone AbstractionParameter Count: 6Parameter Bindings

/**
 * Apply a pattern to this Parser. The pattern string will be parsed and saved
 * in "compiled" form.
 * Note: this method is somewhat similar to the pattern parsing methold in
 *       datetimeformat. If you see something wrong here, you might want
 *       to check the other.
 * @param {string} pattern It describes the format of date string that need to
 *     be parsed.
 * @private
 */
/**
 * Apply a pattern to this Parser. The pattern string will be parsed and saved
 * in "compiled" form.
 * Note: this method is somewhat similar to the pattern parsing methold in
 *       datetimeformat. If you see something wrong here, you might want
 *       to check the other.
 * @param {string} pattern It describes the format of date string that need to
 *     be parsed.
 * @deprecated Use goog.i18n.DateTimeParse.
 */
goog. [[#variable575fba60]].DateTimeParse.prototype. [[#variable208f70c0]]= function (pattern)
                                                                            { var inQuote= false;
                                                                              var buf='';
                                                                              for (var i=0; i<pattern.length; i++)
                                                                                { var ch=pattern.charAt(i);
                                                                                  // handle space, add literal part (if exist), and add space part
                                                                                  if (ch==' ')
                                                                                    { if (buf.length>0)
                                                                                        { this.patternParts_.push( {text:buf,
                                                                                                                    count: 0,
                                                                                                                    abutStart: false } );
                                                                                          buf='';
                                                                                        }
                                                                                      this.patternParts_.push( {text: ' ',
                                                                                                                count: 0,
                                                                                                                abutStart: false } );
                                                                                      while ( [[#variable575fb8c0]]< [[#variable575adfe0]]
                                                                                             && pattern.charAt(i+1)==' ')
                                                                                        { i++;
                                                                                        }
                                                                                    }
                                                                                  else
                                                                                    if (inQuote)
                                                                                      {
                                                                                        // inside quote, except '', just copy or exit
                                                                                        if (ch=='\'')
                                                                                          { if (i+1<pattern.length
                                                                                                && pattern.charAt(i+1)=='\'')
                                                                                              {
                                                                                                // quote appeared twice continuously, interpret as one quote.
                                                                                                buf+= [[#variable575fb6c0]];
                                                                                                 [[#variable575fb680]]
                                                                                              }
                                                                                            else
                                                                                              {
                                                                                                // exit quote
                                                                                                inQuote= false;
                                                                                              }
                                                                                          }
                                                                                        else
                                                                                          {
                                                                                            // literal
                                                                                            buf+=ch;
                                                                                          }
                                                                                      }
                                                                                    else
                                                                                      if (goog. [[#variable575fba60]].DateTimeParse.PATTERN_CHARS_.indexOf(ch)>=0)
                                                                                        {
                                                                                          // outside quote, it is a pattern char
                                                                                          if (buf.length>0)
                                                                                            { this.patternParts_.push( {text:buf,
                                                                                                                        count: 0,
                                                                                                                        abutStart: false } );
                                                                                              buf='';
                                                                                            }
                                                                                          var count=this.getNextCharCount_(pattern,i);
                                                                                          this.patternParts_.push( {text:ch,
                                                                                                                    count:count,
                                                                                                                    abutStart: false } );
                                                                                          i+=count-1;
                                                                                        }
                                                                                      else
                                                                                        if (ch=='\'')
                                                                                          {
                                                                                            // Two consecutive quotes is a quote literal, inside or outside of quotes.
                                                                                            if (i+1<pattern.length
                                                                                                && pattern.charAt(i+1)=='\'')
                                                                                              { buf+='\'';
                                                                                                i++;
                                                                                              }
                                                                                            else
                                                                                              { inQuote= true;
                                                                                              }
                                                                                          }
                                                                                        else
                                                                                          { buf+=ch;
                                                                                          }
                                                                                }
                                                                              if (buf.length>0)
                                                                                { this.patternParts_.push( {text:buf,
                                                                                                            count: 0,
                                                                                                            abutStart: false } );
                                                                                }
                                                                              this.markAbutStart_( );
                                                                            } ;
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#575fba60]]
i18n 
12[[#575fba60]]
locale 
21[[#208f70c0]]
applyPattern_ 
22[[#208f70c0]]
applyPattern 
31[[#575fb8c0]]
i 
32[[#575fb8c0]]
i+1 
41[[#575adfe0]]
pattern.length-1 
42[[#575adfe0]]
pattern.length 
51[[#575fb6c0]]
'\'' 
52[[#575fb6c0]]
ch 
61[[#575fb680]]
i++; 
62[[#575fb680]]
++i;