Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
59 | 2 | 6 | 0.983 | ExpressionStatement |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 59 | 167 | Closure/closure/goog/i18n/datetimeparse.js |
2 | 59 | 211 | 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. * @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_( ); } ; |
| ||||
/** * 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_( ); } ; |
| |||
/** * 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 Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#575fba60]] | i18n |
1 | 2 | [[#575fba60]] | locale |
2 | 1 | [[#208f70c0]] | applyPattern_ |
2 | 2 | [[#208f70c0]] | applyPattern |
3 | 1 | [[#575fb8c0]] | i |
3 | 2 | [[#575fb8c0]] | i+1 |
4 | 1 | [[#575adfe0]] | pattern.length-1 |
4 | 2 | [[#575adfe0]] | pattern.length |
5 | 1 | [[#575fb6c0]] | '\'' |
5 | 2 | [[#575fb6c0]] | ch |
6 | 1 | [[#575fb680]] | i++; |
6 | 2 | [[#575fb680]] | ++i; |