當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript collection.ListWrapper類代碼示例

本文整理匯總了TypeScript中@angular/facade/src/collection.ListWrapper的典型用法代碼示例。如果您正苦於以下問題:TypeScript ListWrapper類的具體用法?TypeScript ListWrapper怎麽用?TypeScript ListWrapper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ListWrapper類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it('should return the last sampleSize runs when it has at least the given size', () => {
   createValidator(2);
   var sample = [mv(0, 0, {'a': 1}), mv(1, 1, {'b': 2}), mv(2, 2, {'c': 3})];
   expect(validator.validate(ListWrapper.slice(sample, 0, 2)))
       .toEqual(ListWrapper.slice(sample, 0, 2));
   expect(validator.validate(sample)).toEqual(ListWrapper.slice(sample, 1, 3));
 });
開發者ID:Jake-Church,項目名稱:angular,代碼行數:7,代碼來源:size_validator_spec.ts

示例2: it

 it('should return the last sampleSize runs when the regression slope is >0', () => {
   createValidator({size: 2, metric: 'script'});
   var sample = [mv(0, 0, {'script': 1}), mv(1, 1, {'script': 2}), mv(2, 2, {'script': 3})];
   expect(validator.validate(ListWrapper.slice(sample, 0, 2)))
       .toEqual(ListWrapper.slice(sample, 0, 2));
   expect(validator.validate(sample)).toEqual(ListWrapper.slice(sample, 1, 3));
 });
開發者ID:Jake-Church,項目名稱:angular,代碼行數:7,代碼來源:regression_slope_validator_spec.ts

示例3: _addEvents

 /** @internal */
 private _addEvents(events: {[key: string]: string}[]) {
   var needSort = false;
   events.forEach(event => {
     if (StringWrapper.equals(event['ph'], 'X')) {
       needSort = true;
       var startEvent = {};
       var endEvent = {};
       StringMapWrapper.forEach(event, (value, prop) => {
         startEvent[prop] = value;
         endEvent[prop] = value;
       });
       startEvent['ph'] = 'B';
       endEvent['ph'] = 'E';
       endEvent['ts'] = startEvent['ts'] + startEvent['dur'];
       this._remainingEvents.push(startEvent);
       this._remainingEvents.push(endEvent);
     } else {
       this._remainingEvents.push(event);
     }
   });
   if (needSort) {
     // Need to sort because of the ph==='X' events
     ListWrapper.sort(this._remainingEvents, (a, b) => {
       var diff = a['ts'] - b['ts'];
       return diff > 0 ? 1 : diff < 0 ? -1 : 0;
     });
   }
 }
開發者ID:chong999,項目名稱:angular,代碼行數:29,代碼來源:perflog_metric.ts

示例4: _update

function _update(node: TreeNode<UrlSegment>, changes: any[]): TreeNode<UrlSegment> {
  let rest = changes.slice(1);
  let outlet = _outlet(changes);
  let segment = _segment(changes);
  if (isString(segment) && segment[0] == "/") segment = segment.substring(1);

  // reach the end of the tree => create new tree nodes.
  if (isBlank(node)) {
    let urlSegment = new UrlSegment(segment, null, outlet);
    let children = rest.length === 0 ? [] : [_update(null, rest)];
    return new TreeNode<UrlSegment>(urlSegment, children);

    // different outlet => preserve the subtree
  } else if (outlet != node.value.outlet) {
    return node;

    // same outlet => modify the subtree
  } else {
    let urlSegment = isStringMap(segment) ? new UrlSegment(null, segment, null) :
                                            new UrlSegment(segment, null, outlet);
    if (rest.length === 0) {
      return new TreeNode<UrlSegment>(urlSegment, []);
    }

    return new TreeNode<UrlSegment>(urlSegment,
                                    _updateMany(ListWrapper.clone(node.children), rest));
  }
}
開發者ID:davewragg,項目名稱:angular,代碼行數:28,代碼來源:link.ts

示例5: validate

 validate(completeSample: MeasureValues[]): MeasureValues[] {
   if (completeSample.length >= this._sampleSize) {
     return ListWrapper.slice(
         completeSample, completeSample.length - this._sampleSize, completeSample.length);
   } else {
     return null;
   }
 }
開發者ID:Jake-Church,項目名稱:angular,代碼行數:8,代碼來源:size_validator.ts

示例6: _findUrlSegment

function _findUrlSegment(segment: RouteSegment, routeTree: RouteTree): UrlSegment {
  let s = segment;
  let res = null;
  while (isBlank(res)) {
    res = ListWrapper.last(s.urlSegments);
    s = routeTree.parent(s);
  }
  return res;
}
開發者ID:davewragg,項目名稱:angular,代碼行數:9,代碼來源:link.ts

示例7: remove

 remove(key: string) {
   if (!StringWrapper.contains(key, '.')) {
     return this._data.delete(key);
   }
   var pieces = key.split('.');
   var last = ListWrapper.last(pieces);
   pieces.length = pieces.length - 1;
   var target = this._resolve(pieces, this);
   return target.remove(last);
 }
開發者ID:cassand,項目名稱:angular,代碼行數:10,代碼來源:common.ts

示例8: set

 set(key: string, value) {
   if (key.indexOf('.') == -1) {
     this._data[key] = value;
     return;
   }
   var pieces = key.split('.');
   var last = ListWrapper.last(pieces);
   pieces.length = pieces.length - 1;
   var target = this._resolve(pieces, this);
   target[last] = value;
 }
開發者ID:cassand,項目名稱:angular,代碼行數:11,代碼來源:common.ts

示例9: get

 get(key: string) {
   if (key.indexOf('.') == -1) {
     return this._data[key];
   }
   var pieces = key.split('.');
   var last = ListWrapper.last(pieces);
   pieces.length = pieces.length - 1;
   var target = this._resolve(pieces, this);
   if (target == null) {
     return null;
   }
   return target[last];
 }
開發者ID:cassand,項目名稱:angular,代碼行數:13,代碼來源:common.ts

示例10: _computeStageButtons

 _computeStageButtons() {
   var disabled = true;
   this.stages = ListWrapper.clone(STATUS_LIST.map((status) => {
     var isCurrent = this._offering.status == status;
     var stage = new Stage();
     stage.name = status;
     stage.isDisabled = disabled;
     stage.backgroundColor = disabled ? '#DDD' : isCurrent ? '#DDF' : '#FDD';
     if (isCurrent) {
       disabled = false;
     }
     return stage;
   }));
 }
開發者ID:Jake-Church,項目名稱:angular,代碼行數:14,代碼來源:cells.ts


注:本文中的@angular/facade/src/collection.ListWrapper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。