本文整理汇总了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;未经允许,请勿转载。 |
请发表评论