CloneSet61


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
158210.991SourceElements[8]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
117654
Closure/closure/goog/i18n/timezone.js
215854
Closure/closure/goog/locale/timezone.js
Clone Instance
1
Line Count
176
Source Line
54
Source File
Closure/closure/goog/i18n/timezone.js

/**
 * TimeZone class implemented a time zone resolution and name information
 * source for client applications. The time zone object is initiated from
 * a time zone information object. Application can initiate a time zone
 * statically, or it may choose to initiate from a data obtained from server.
 * Each time zone information array is small, but the whole set of data
 * is too much for client application to download. If end user is allowed to
 * change time zone setting, dynamic retrieval should be the method to use.
 * In case only time zone offset is known, there is a decent fallback
 * that only use the time zone offset to create a TimeZone object.
 * A whole set of time zone information array was available under
 * http://go/js_locale_data. It is generated based on CLDR and
 * Olson time zone data base (through pytz), and will be updated timely.
 *
 * @constructor
 */
goog.i18n.TimeZone=  function ( )
                                {
  /**
   * The standard time zone id.
   * @type {string}
   * @private
   */
  this.timeZoneId_;


  /**
   * The standard, non-daylight time zone offset, in minutes WEST of UTC.
   * @type {number}
   * @private
   */
  this.standardOffset_;


  /**
   * An array of strings that can have 2 or 4 elements.  The first two elements
   * are the long and short names for standard time in this time zone, and the
   * last two elements (if present) are the long and short names for daylight
   * time in this time zone.
   * @type {Array.<string>}
   * @private
   */
  this.tzNames_;


  /**
   * This array specifies the Daylight Saving Time transitions for this time
   * zone.  This is a flat array of numbers which are interpreted in pairs:
   * [time1, adjustment1, time2, adjustment2, ...] where each time is a DST
   * transition point given as a number of hours since 00:00 UTC, January 1,
   * 1970, and each adjustment is the adjustment to apply for times after the
   * DST transition, given as minutes EAST of UTC.
   * @type {Array.<number>}
   * @private
   */
  this.transitions_;
                                } ;

/**
 * The number of milliseconds in an hour.
 * @type {number}
 * @private
 */
goog.i18n.TimeZone.MILLISECONDS_PER_HOUR_=  3600*  1000;


/**
 * Indices into the array of time zone names.
 * @enum {number}
 */
goog.i18n.TimeZone.NameType=  {
  STD_SHORT_NAME: 0,
  STD_LONG_NAME: 1,
  DLT_SHORT_NAME: 2,
  DLT_LONG_NAME: 3            } ;



/**
 * This factory method creates a time zone instance.  It takes either an object
 * containing complete time zone information, or a single number representing a
 * constant time zone offset.  If the latter form is used, DST functionality is
 * not available.
 *
 * @param {number|Object} timeZoneData If this parameter is a number, it should
 *     indicate minutes WEST of UTC to be used as a constant time zone offset.
 *     Otherwise, it should be an object with these four fields:
 *     <ul>
 *     <li>id: A string ID for the time zone.
 *     <li>std_offset: The standard time zone offset in minutes EAST of UTC.
 *     <li>names: An array of four names (standard short name, standard long
 *           name, daylight short name, daylight long, name)
 *     <li>transitions: An array of numbers which are interpreted in pairs:
 *           [time1, adjustment1, time2, adjustment2, ...] where each time is
 *           a DST transition point given as a number of hours since 00:00 UTC,
 *           January 1, 1970, and each adjustment is the adjustment to apply
 *           for times after the DST transition, given as minutes EAST of UTC.
 *     </ul>
 * @return {goog.i18n.TimeZone} A goog.i18n.TimeZone object for the given
 *     time zone data.
 */
goog.i18n.TimeZone.createTimeZone=  function (timeZoneData){
  if (typeof timeZoneData==  'number') {
    return goog.i18n.TimeZone.createSimpleTimeZone_(timeZoneData);
                                       }
  var tz=  new goog.i18n.TimeZone( );
  tz.timeZoneId_=  timeZoneData['id'];
  tz.standardOffset_=  -timeZoneData['std_offset'];
  tz.tzNames_=  timeZoneData['names'];
  tz.transitions_=  timeZoneData['transitions'];
  return tz;
                                                           } ;


/**
 * This factory method creates a time zone object with a constant offset.
 * @param {number} timeZoneOffsetInMinutes Offset in minutes WEST of UTC.
 * @return {goog.i18n.TimeZone} A time zone object with the given constant
 *     offset.  Note that the time zone ID of this object will use the POSIX
 *     convention, which has a reversed sign ("Etc/GMT+8" means UTC-8 or PST).
 * @private
 */
goog.i18n.TimeZone.createSimpleTimeZone_=  function (timeZoneOffsetInMinutes){
  var tz=  new goog.i18n.TimeZone( );
  tz.standardOffset_=  timeZoneOffsetInMinutes;
  tz.timeZoneId_=
      goog.i18n.TimeZone.composePosixTimeZoneID_(timeZoneOffsetInMinutes);
  var str=  goog.i18n.TimeZone.composeUTCString_(timeZoneOffsetInMinutes);
  tz.tzNames_=  [str, str];
  tz.transitions_=  [ ];
  return tz;
                                                                             } ;


/**
 * Generate a GMT-relative string for a constant time zone offset.
 * @param {number} offset The time zone offset in minutes WEST of UTC.
 * @return {string} The GMT string for this offset, which will indicate
 *     hours EAST of UTC.
 * @private
 */
goog.i18n.TimeZone.composeGMTString_=  function (offset){
  var parts=  ['GMT'];
  parts.push(offset<=  0
             ?             '+'
             :                   '-');
  offset=  Math.abs(offset);
  parts.push(goog.string.padNumber(Math.floor(offset/  60)%  100, 2),
             ':', goog.string.padNumber(offset%  60, 2));
  return parts.join('');
                                                        } ;
/**
 * Generate a POSIX time zone ID for a constant time zone offset.
 * @param {number} offset The time zone offset in minutes WEST of UTC.
 * @return {string} The POSIX time zone ID for this offset, which will indicate
 *     hours WEST of UTC.
 * @private
 */
goog.i18n.TimeZone.composePosixTimeZoneID_=  function (offset){
  if (offset==  0) {
    return 'Etc/GMT';
                   }
  var parts=  ['Etc/GMT', offset<  0
                          ?            '-'
                          :                  '+'];
  offset=  Math.abs(offset);
  parts.push(Math.floor(offset/  60)%  100);
  offset=  offset%  60;
  if (offset!=  0) {
    parts.push(':', goog.string.padNumber(offset, 2));
                   }
  return parts.join('');
                                                              } ;
/**
 * Generate a UTC-relative string for a constant time zone offset.
 * @param {number} offset The time zone offset in minutes WEST of UTC.
 * @return {string} The UTC string for this offset, which will indicate
 *     hours EAST of UTC.
 * @private
 */
goog.i18n.TimeZone.composeUTCString_=  function (offset){
  if (offset==  0) {
    return 'UTC';
                   }
  var parts=  ['UTC', offset<  0
                      ?            '+'
                      :                  '-'];
  offset=  Math.abs(offset);
  parts.push(Math.floor(offset/  60)%  100);
  offset=  offset%  60;
  if (offset!=  0) {
    parts.push(':', offset);
                   }
  return parts.join('');
                                                        } ;


Clone Instance
2
Line Count
158
Source Line
54
Source File
Closure/closure/goog/locale/timezone.js

/**
 * TimeZone class implemented a time zone resolution and name information
 * source for client applications. The time zone object is initiated from
 * a time zone information array. Application can initiate a time zone
 * statically, or it may choose to initiate from a data obtained from server.
 * Each time zone information array is small, but the whole set of data
 * is too much for client application to download. If end user is allowed to
 * change time zone setting, dynamic retrieval should be the method to use.
 * In case only time zone offset is known, there is a decent fallback
 * that only use the time zone offset to create a TimeZone object.
 * A whole set of time zone information array was available under
 * http://go/js_locale_data.  It is generated based on CLDR and
 * Olson time zone data base (through pytz), and will be updated timely.
 *
 * @constructor
 * @deprecated Use goog.i18n.TimeZone.
 */
goog.locale.TimeZone=  function ( )
                                  {
  /**
   * The standard time zone id.
   * @type {string}
   * @private
   */
  this.timeZoneId_;


  /**
   * The standard, non-daylight time zone offset.
   * @type {number}
   * @private
   */
  this.standardOffset_;


  /**
   * An array of string that can have 2 or 4 elements, long and short names for
   * standard time zone, and long and short names for daylight time zone if it
   * has daylight time transitions.
   * @type {Array}
   * @private
   */
  this.tzNames_;


  /**
   * Daylight/standard time transition array. It lists transition points since
   * 1970 until some year in future. It always in pair of (transition point) +
   * (time zone offset adjustment)
   * @type {Array}
   * @private
   */
  this.transitions_;
                                  } ;
/**
 * Milliseconds per hour constant.
 * @type {number}
 * @private
 */
goog.locale.TimeZone.MILLISECONDS_PER_HOUR_=  3600*  1000;

/**
 * Enum of time zone names. The value will be used as index of in time zone
 * name array.
 * @enum {number}
 * @deprecated Use goog.i18n.TimeZone.NameType.
 */
goog.locale.TimeZone.NameType=  {
  STD_SHORT_NAME: 0,
  STD_LONG_NAME: 1,
  DLT_SHORT_NAME: 2,
  DLT_LONG_NAME: 3              } ;



/**
 * This factory method creates a time zone instance. It takes either a time zone
 * information array or a simple timezone offset. The latter form does not offer
 * the same set of functionalities as first form.
 *
 * @param {number|Array} timeZoneData this parameter could take 2 types,
 *     if it is a number, a simple TimeZone object will be created. Otherwise,
 *     it should be a array that holds all time zone related information.
 * @return {goog.locale.TimeZone} A goog.locale.TimeZone object for the given
 *     time zone data.
 * @deprecated Use goog.i18n.TimeZone.createTimeZone.
 */
goog.locale.TimeZone.createTimeZone=  function (timeZoneData){
  if (typeof timeZoneData==  'number') {
    return goog.locale.TimeZone.createSimpleTimeZone_(timeZoneData);
                                       }
  var tz=  new goog.locale.TimeZone( );
  tz.timeZoneId_=  timeZoneData['id'];
  tz.standardOffset_=  -timeZoneData['std_offset'];
  tz.tzNames_=  timeZoneData['names'];
  tz.transitions_=  timeZoneData['transitions'];
  return tz;
                                                             } ;


/**
 * This factory method provides a decent fallback to create a time zone object
 * just based on a given time zone offset.
 * @param {number} timeZoneOffsetInMinutes time zone offset in minutes.
 * @return {goog.locale.TimeZone} A goog.locale.TimeZone object generated by
 *     just using the time zone offset information.
 * @private
 */
goog.locale.TimeZone.createSimpleTimeZone_=  function (timeZoneOffsetInMinutes){
  var tz=  new goog.locale.TimeZone( );
  tz.standardOffset_=  timeZoneOffsetInMinutes;
  tz.timeZoneId_=
      goog.locale.TimeZone.composePosixTimeZoneID_(timeZoneOffsetInMinutes);
  var str=  goog.locale.TimeZone.composeUTCString_(timeZoneOffsetInMinutes);
  tz.tzNames_=  [str, str];
  tz.transitions_=  [ ];
  return tz;
                                                                               } ;


/**
 * Generate GMT string given a time zone offset.
 * @param {number} offset time zone offset in minutes.
 * @return {string} GMT string for this offset.
 * @private
 */
goog.locale.TimeZone.composeGMTString_=  function (offset){
  var parts=  ['GMT'];
  parts.push(offset<=  0
             ?             '+'
             :                   '-');
  offset=  Math.abs(offset);
  parts.push(goog.string.padNumber(Math.floor(offset/  60)%  100, 2),
             ':', goog.string.padNumber(offset%  60, 2));
  return parts.join('');
                                                          } ;
/**
 * POSIX time zone ID as fallback.
 * @param {number} offset time zone offset in minutes.
 * @return {string} posix time zone id for given offset.
 * @private
 */
goog.locale.TimeZone.composePosixTimeZoneID_=  function (offset){
  if (offset==  0) {
    return 'Etc/GMT';
                   }
  var parts=  ['Etc/GMT', offset<  0
                          ?            '-'
                          :                  '+'];
  offset=  Math.abs(offset);
  parts.push(Math.floor(offset/  60)%  100);
  offset=  offset%  60;
  if (offset!=  0) {
    parts.push(':', goog.string.padNumber(offset, 2));
                   }
  return parts.join('');
                                                                } ;
/**
 * Generate UTC string.
 * @param {number} offset time zone offset in minutes.
 * @return {string} UTC string for given offset.
 * @private
 */
goog.locale.TimeZone.composeUTCString_=  function (offset){
  if (offset==  0) {
    return 'UTC';
                   }
  var parts=  ['UTC', offset<  0
                      ?            '+'
                      :                  '-'];
  offset=  Math.abs(offset);
  parts.push(Math.floor(offset/  60)%  100);
  offset=  offset%  60;
  if (offset!=  0) {
    parts.push(':', offset);
                   }
  return parts.join('');
                                                          } ;


Clone AbstractionParameter Count: 1Parameter Bindings

/**
 * TimeZone class implemented a time zone resolution and name information
 * source for client applications. The time zone object is initiated from
 * a time zone information array. Application can initiate a time zone
 * statically, or it may choose to initiate from a data obtained from server.
 * Each time zone information array is small, but the whole set of data
 * is too much for client application to download. If end user is allowed to
 * change time zone setting, dynamic retrieval should be the method to use.
 * In case only time zone offset is known, there is a decent fallback
 * that only use the time zone offset to create a TimeZone object.
 * A whole set of time zone information array was available under
 * http://go/js_locale_data.  It is generated based on CLDR and
 * Olson time zone data base (through pytz), and will be updated timely.
 *
 * @constructor
 * @deprecated Use goog.i18n.TimeZone.
 */
/**
 * TimeZone class implemented a time zone resolution and name information
 * source for client applications. The time zone object is initiated from
 * a time zone information object. Application can initiate a time zone
 * statically, or it may choose to initiate from a data obtained from server.
 * Each time zone information array is small, but the whole set of data
 * is too much for client application to download. If end user is allowed to
 * change time zone setting, dynamic retrieval should be the method to use.
 * In case only time zone offset is known, there is a decent fallback
 * that only use the time zone offset to create a TimeZone object.
 * A whole set of time zone information array was available under
 * http://go/js_locale_data. It is generated based on CLDR and
 * Olson time zone data base (through pytz), and will be updated timely.
 *
 * @constructor
 */
goog. [[#variable1f1528c0]].TimeZone= function ( )
                                      {
                                        /**
                                           * The standard time zone id.
                                           * @type {string}
                                           * @private
                                           */
                                        this.timeZoneId_;
                                        /**
                                           * The standard, non-daylight time zone offset.
                                           * @type {number}
                                           * @private
                                           */
                                        /**
                                           * The standard, non-daylight time zone offset, in minutes WEST of UTC.
                                           * @type {number}
                                           * @private
                                           */
                                        this.standardOffset_;
                                        /**
                                           * An array of string that can have 2 or 4 elements, long and short names for
                                           * standard time zone, and long and short names for daylight time zone if it
                                           * has daylight time transitions.
                                           * @type {Array}
                                           * @private
                                           */
                                        /**
                                           * An array of strings that can have 2 or 4 elements.  The first two elements
                                           * are the long and short names for standard time in this time zone, and the
                                           * last two elements (if present) are the long and short names for daylight
                                           * time in this time zone.
                                           * @type {Array.<string>}
                                           * @private
                                           */
                                        this.tzNames_;
                                        /**
                                           * Daylight/standard time transition array. It lists transition points since
                                           * 1970 until some year in future. It always in pair of (transition point) +
                                           * (time zone offset adjustment)
                                           * @type {Array}
                                           * @private
                                           */
                                        /**
                                           * This array specifies the Daylight Saving Time transitions for this time
                                           * zone.  This is a flat array of numbers which are interpreted in pairs:
                                           * [time1, adjustment1, time2, adjustment2, ...] where each time is a DST
                                           * transition point given as a number of hours since 00:00 UTC, January 1,
                                           * 1970, and each adjustment is the adjustment to apply for times after the
                                           * DST transition, given as minutes EAST of UTC.
                                           * @type {Array.<number>}
                                           * @private
                                           */
                                        this.transitions_;
                                      } ;
/**
 * Milliseconds per hour constant.
 * @type {number}
 * @private
 */
/**
 * The number of milliseconds in an hour.
 * @type {number}
 * @private
 */
goog. [[#variable1f1528c0]].TimeZone.MILLISECONDS_PER_HOUR_=3600*1000;
/**
 * Enum of time zone names. The value will be used as index of in time zone
 * name array.
 * @enum {number}
 * @deprecated Use goog.i18n.TimeZone.NameType.
 */
/**
 * Indices into the array of time zone names.
 * @enum {number}
 */
goog. [[#variable1f1528c0]].TimeZone.NameType= {STD_SHORT_NAME: 0,
                                                STD_LONG_NAME: 1,
                                                DLT_SHORT_NAME: 2,
                                                DLT_LONG_NAME: 3 } ;
/**
 * This factory method creates a time zone instance. It takes either a time zone
 * information array or a simple timezone offset. The latter form does not offer
 * the same set of functionalities as first form.
 *
 * @param {number|Array} timeZoneData this parameter could take 2 types,
 *     if it is a number, a simple TimeZone object will be created. Otherwise,
 *     it should be a array that holds all time zone related information.
 * @return {goog.locale.TimeZone} A goog.locale.TimeZone object for the given
 *     time zone data.
 * @deprecated Use goog.i18n.TimeZone.createTimeZone.
 */
/**
 * This factory method creates a time zone instance.  It takes either an object
 * containing complete time zone information, or a single number representing a
 * constant time zone offset.  If the latter form is used, DST functionality is
 * not available.
 *
 * @param {number|Object} timeZoneData If this parameter is a number, it should
 *     indicate minutes WEST of UTC to be used as a constant time zone offset.
 *     Otherwise, it should be an object with these four fields:
 *     <ul>
 *     <li>id: A string ID for the time zone.
 *     <li>std_offset: The standard time zone offset in minutes EAST of UTC.
 *     <li>names: An array of four names (standard short name, standard long
 *           name, daylight short name, daylight long, name)
 *     <li>transitions: An array of numbers which are interpreted in pairs:
 *           [time1, adjustment1, time2, adjustment2, ...] where each time is
 *           a DST transition point given as a number of hours since 00:00 UTC,
 *           January 1, 1970, and each adjustment is the adjustment to apply
 *           for times after the DST transition, given as minutes EAST of UTC.
 *     </ul>
 * @return {goog.i18n.TimeZone} A goog.i18n.TimeZone object for the given
 *     time zone data.
 */
goog. [[#variable1f1528c0]].TimeZone.createTimeZone= function (timeZoneData)
                                                     { if (typeof timeZoneData=='number')
                                                         { return goog. [[#variable1f1528c0]].TimeZone.createSimpleTimeZone_(timeZoneData);
                                                         }
                                                       var tz=new goog. [[#variable1f1528c0]].TimeZone( );
                                                       tz.timeZoneId_=timeZoneData['id'];
                                                       tz.standardOffset_=-timeZoneData['std_offset'];
                                                       tz.tzNames_=timeZoneData['names'];
                                                       tz.transitions_=timeZoneData['transitions'];
                                                       return tz;
                                                     } ;
/**
 * This factory method provides a decent fallback to create a time zone object
 * just based on a given time zone offset.
 * @param {number} timeZoneOffsetInMinutes time zone offset in minutes.
 * @return {goog.locale.TimeZone} A goog.locale.TimeZone object generated by
 *     just using the time zone offset information.
 * @private
 */
/**
 * This factory method creates a time zone object with a constant offset.
 * @param {number} timeZoneOffsetInMinutes Offset in minutes WEST of UTC.
 * @return {goog.i18n.TimeZone} A time zone object with the given constant
 *     offset.  Note that the time zone ID of this object will use the POSIX
 *     convention, which has a reversed sign ("Etc/GMT+8" means UTC-8 or PST).
 * @private
 */
goog. [[#variable1f1528c0]].TimeZone.createSimpleTimeZone_= function (timeZoneOffsetInMinutes)
                                                            { var tz=new goog. [[#variable1f1528c0]].TimeZone( );
                                                              tz.standardOffset_=timeZoneOffsetInMinutes;
                                                              tz.timeZoneId_=goog. [[#variable1f1528c0]].TimeZone.composePosixTimeZoneID_(timeZoneOffsetInMinutes);
                                                              var str=goog. [[#variable1f1528c0]].TimeZone.composeUTCString_(timeZoneOffsetInMinutes);
                                                              tz.tzNames_=[str,str];
                                                              tz.transitions_=[ ];
                                                              return tz;
                                                            } ;
/**
 * Generate GMT string given a time zone offset.
 * @param {number} offset time zone offset in minutes.
 * @return {string} GMT string for this offset.
 * @private
 */
/**
 * Generate a GMT-relative string for a constant time zone offset.
 * @param {number} offset The time zone offset in minutes WEST of UTC.
 * @return {string} The GMT string for this offset, which will indicate
 *     hours EAST of UTC.
 * @private
 */
goog. [[#variable1f1528c0]].TimeZone.composeGMTString_= function (offset)
                                                        { var parts=['GMT'];
                                                          parts.push(offset<=0
                                                                     ?'+'
                                                                     : '-');
                                                          offset=Math.abs(offset);
                                                          parts.push(goog.string.padNumber(Math.floor(offset/60)%100,2),':',goog.string.padNumber(offset%60,2));
                                                          return parts.join('');
                                                        } ;
/**
 * POSIX time zone ID as fallback.
 * @param {number} offset time zone offset in minutes.
 * @return {string} posix time zone id for given offset.
 * @private
 */
/**
 * Generate a POSIX time zone ID for a constant time zone offset.
 * @param {number} offset The time zone offset in minutes WEST of UTC.
 * @return {string} The POSIX time zone ID for this offset, which will indicate
 *     hours WEST of UTC.
 * @private
 */
goog. [[#variable1f1528c0]].TimeZone.composePosixTimeZoneID_= function (offset)
                                                              { if (offset==0)
                                                                  { return 'Etc/GMT';
                                                                  }
                                                                var parts=['Etc/GMT',offset<0
                                                                                     ?'-'
                                                                                     : '+'];
                                                                offset=Math.abs(offset);
                                                                parts.push(Math.floor(offset/60)%100);
                                                                offset=offset%60;
                                                                if (offset!=0)
                                                                  { parts.push(':',goog.string.padNumber(offset,2));
                                                                  }
                                                                return parts.join('');
                                                              } ;
/**
 * Generate UTC string.
 * @param {number} offset time zone offset in minutes.
 * @return {string} UTC string for given offset.
 * @private
 */
/**
 * Generate a UTC-relative string for a constant time zone offset.
 * @param {number} offset The time zone offset in minutes WEST of UTC.
 * @return {string} The UTC string for this offset, which will indicate
 *     hours EAST of UTC.
 * @private
 */
goog. [[#variable1f1528c0]].TimeZone.composeUTCString_= function (offset)
                                                        { if (offset==0)
                                                            { return 'UTC';
                                                            }
                                                          var parts=['UTC',offset<0
                                                                           ?'+'
                                                                           : '-'];
                                                          offset=Math.abs(offset);
                                                          parts.push(Math.floor(offset/60)%100);
                                                          offset=offset%60;
                                                          if (offset!=0)
                                                            { parts.push(':',offset);
                                                            }
                                                          return parts.join('');
                                                        } ;
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#1f1528c0]]
locale 
12[[#1f1528c0]]
i18n