| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 42 | 2 | 3 | 0.987 | SourceElements[3] |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 45 | 144 | Closure/closure/goog/i18n/datetimeformat.js |
| 2 | 42 | 115 | Closure/closure/goog/locale/datetimeformat.js |
| ||||
/**
* regular expression pattern for parsing pattern string
* @type {Array.<RegExp>}
* @private
*/
goog.i18n.DateTimeFormat.TOKENS_= [
//quote string
/^'(?:[^']|'')*'/,
// pattern chars
/^(?:G+|y+|M+|k+|S+|E+|a+|h+|K+|H+|c+|L+|Q+|d+|m+|s+|v+|z+|Z+)/,
// and all the other chars
/^[^'GyMkSEahKHcLQdmsvzZ]+/ // and all the other chars
];
/**
* These are token types, corresponding to above token definitions.
* @enum {number}
* @private
*/
goog.i18n.DateTimeFormat.PartTypes_= {
QUOTED_STRING: 0,
FIELD: 1,
LITERAL: 2 } ;
/**
* Apply specified pattern to this formatter object.
* @param {string} pattern String specifying how the date should be formatted.
* @private
*/
goog.i18n.DateTimeFormat.prototype.applyPattern_= function (pattern){
// lex the pattern, once for all uses
while (pattern) {
for (var i= 0; i< goog.i18n.DateTimeFormat.TOKENS_.length; ++i) {
var m= pattern.match(goog.i18n.DateTimeFormat.TOKENS_[i]);
if (m) {
var part= m[0];
pattern= pattern.substring(part.length);
if (i== goog.i18n.DateTimeFormat.PartTypes_.QUOTED_STRING) {
if (part== "''") {
part= "'"; // '' -> '
}
else {
part= part.substring(1, part.length- 1); // strip quotes
part= part.replace(/''/, "'");
}
}
this.patternParts_.push( { text: part, type: i } );
break;
}
}
}
} ;
|
| ||||
/**
* regular expression pattern for parsing pattern string
* @private
*/
goog.locale.DateTimeFormat.TOKENS_= [
//quote string
/^'(?:[^']|'')*'/,
// pattern chars
/^(?:G+|y+|M+|k+|S+|E+|a+|h+|K+|H+|c+|L+|Q+|d+|m+|s+|v+|z+|Z+)/,
// and all the other chars
/^[^'GyMkSEahKHcLQdmsvzZ]+/ // and all the other chars
];
/**
* These are token types, corresponding to above token definitions.
* @enum {number}
*/
goog.locale.DateTimeFormat.PartTypes= {
QUOTED_STRING: 0,
FIELD: 1,
LITERAL: 2 } ;
/**
* Apply specified pattern to this formatter object.
* @param {string} pattern String specifying how the date should be formatted.
* @deprecated Use goog.i18n.DateTimeFormat.
*/
goog.locale.DateTimeFormat.prototype.applyPattern= function (pattern){
// lex the pattern, once for all uses
while (pattern) {
for (var i= 0; i< goog.locale.DateTimeFormat.TOKENS_.length; ++i) {
var m= pattern.match(goog.locale.DateTimeFormat.TOKENS_[i]);
if (m) {
var part= m[0];
pattern= pattern.substring(part.length);
if (i== goog.locale.DateTimeFormat.PartTypes.QUOTED_STRING) {
if (part== "''") {
part= "'"; // '' -> '
}
else {
part= part.substring(1, part.length- 1); // strip quotes
part= part.replace(/''/, "'");
}
}
this.patternParts_.push( { text: part, type: i } );
break;
}
}
}
} ;
|
| |||
/**
* regular expression pattern for parsing pattern string
* @private
*/
/**
* regular expression pattern for parsing pattern string
* @type {Array.<RegExp>}
* @private
*/
goog. [[#variable5db07ea0]].DateTimeFormat.TOKENS_=[
//quote string
/^'(?:[^']|'')*'/,
// pattern chars
/^(?:G+|y+|M+|k+|S+|E+|a+|h+|K+|H+|c+|L+|Q+|d+|m+|s+|v+|z+|Z+)/,
// and all the other chars
/^[^'GyMkSEahKHcLQdmsvzZ]+/ // and all the other chars
];
/**
* These are token types, corresponding to above token definitions.
* @enum {number}
*/
/**
* These are token types, corresponding to above token definitions.
* @enum {number}
* @private
*/
goog. [[#variable5db07ea0]].DateTimeFormat. [[#variable5db07d80]]= {QUOTED_STRING: 0,
FIELD: 1,
LITERAL: 2 } ;
/**
* Apply specified pattern to this formatter object.
* @param {string} pattern String specifying how the date should be formatted.
* @deprecated Use goog.i18n.DateTimeFormat.
*/
/**
* Apply specified pattern to this formatter object.
* @param {string} pattern String specifying how the date should be formatted.
* @private
*/
goog. [[#variable5db07ea0]].DateTimeFormat.prototype. [[#variable5db07ce0]]= function (pattern)
{
// lex the pattern, once for all uses
while (pattern)
{ for (var i=0; i<goog. [[#variable5db07ea0]].DateTimeFormat.TOKENS_.length; ++i)
{ var m=pattern.match(goog. [[#variable5db07ea0]].DateTimeFormat.TOKENS_[i]);
if (m)
{ var part=m[0];
pattern=pattern.substring(part.length);
if (i==goog. [[#variable5db07ea0]].DateTimeFormat. [[#variable5db07d80]].QUOTED_STRING)
{ if (part=="''")
{ part="'"; // '' -> '
}
else
{ part=part.substring(1,part.length-1); // strip quotes
part=part.replace(/''/,"'");
}
}
this.patternParts_.push( {text:part,
type:i } );
break;
}
}
}
} ;
|
| CloneAbstraction |
| Parameter Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| 1 | 1 | [[#5db07ea0]] | locale |
| 1 | 2 | [[#5db07ea0]] | i18n |
| 2 | 1 | [[#5db07d80]] | PartTypes |
| 2 | 2 | [[#5db07d80]] | PartTypes_ |
| 3 | 1 | [[#5db07ce0]] | applyPattern |
| 3 | 2 | [[#5db07ce0]] | applyPattern_ |