| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 58 | 2 | 3 | 0.988 | SourceElements[2] |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 60 | 586 | Closure/closure/goog/i18n/datetimeparse.js |
| 2 | 58 | 631 | 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.<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;
}
} ;
|
| ||||
/**
* 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;
}
} ;
|
| |||
/**
* 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 Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| 1 | 1 | [[#62956560]] | locale |
| 1 | 2 | [[#62956560]] | i18n |
| 2 | 1 | [[#61a38a80]] | this |
| 2 | 2 | [[#61a38a80]] | goog.i18n |
| 3 | 1 | [[#62956480]] | symbols_ |
| 3 | 2 | [[#62956480]] | DateTimeSymbols |