本文整理汇总了TypeScript中Immutable.Map.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Map.get方法的具体用法?TypeScript Map.get怎么用?TypeScript Map.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Immutable.Map
的用法示例。
在下文中一共展示了Map.get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('accepts flattened pairs via of()', () => {
var m: Map<any, any> = Map.of(1, 'a', 2, 'b', 3, 'c');
expect(m.size).toBe(3);
expect(m.get(1)).toBe('a');
expect(m.get(2)).toBe('b');
expect(m.get(3)).toBe('c');
});
示例2: removeNode
removeNode(node: any) {
var nodesAll = this.nodes.filter(n => n !== node).toList();
var parentsAll: Map<number, List<Node>> = this.parents;
var childrenAll: Map<number, List<Node>> = this.children;
var parents = parentsAll.get(node.id);
parents.forEach((parent) => {
var children = childrenAll.get(parent.id);
children = children.filter((child) => child !== node).toList();
childrenAll = childrenAll.set(parent.id, children);
});
parentsAll = parentsAll.set(node.id, List<any>());
var children = childrenAll.get(node.id);
children.forEach((child) => {
var parents = parentsAll.get(child.id);
parents = parents.filter((ancestor) => ancestor !== node).toList();
parentsAll = parentsAll.set(child.id, parents);
});
childrenAll = childrenAll.remove(node.id);
return new Graph(nodesAll, childrenAll, parentsAll);
}
示例3: cadd
const director = (d: Map<State, Complex>, t: number)=>{
const result = Map<State, Complex>().asMutable();
// 量子ゆらぎの定数
const gt0 = t / STEPS;
const gt1 = 1 - gt0;
// const gt = 100 * ((t+1) ** (-1.5)) - 0.1; // t = 99 で0になる!
// 方向
for(let a=0; a<N; a++){
// 位置
for(let v=0, n=2**N; v<n; v++){
// ===== H0
// Sを適用する前の位置
const vb = v ^ (1 << a);
// vbの確率はGrover's diffusion operatorをかけて求める
let s = czero;
for(let b=0; b<N; b++){
const dd = a===b ? 2/N-1 : 2/N;
s = cadd(s, csmul(dd, d.get(makeState(b, vb), czero)));
}
s = csmul(gt0, s);
// ===== H1
let s2 = czero;
for(let w=0; w<n; w++){
const dd = v===w ? 2/n-1 : 2/n;
s2 = cadd(s2, csmul(dd, d.get(makeState(a, w), czero)));
}
s = cadd(s, cmul(csmul(gt1, ci), s2));
result.set(makeState(a, v), s);
}
}
return result.asImmutable();
};
示例4:
disks.filter((disk) => disk.get('online') && (
(
!this.isDiskUsed(disk, diskUsage.get('attached')) &&
!this.isDiskUsed(disk, diskUsage.get('boot')) &&
!this.isDiskUsed(disk, diskUsage.get('reserved'))
) || this.isDiskUsed(disk, diskUsage.get('freed'))
)
示例5: updateCanonical
updateCanonical(callback: Function) {
let canonical = this.cacheMap.get('canonical');
let localData = this.cacheMap.get('local');
let newCanonical = callback.call(null, canonical, localData);
this.cacheMap = this.cacheMap.set(CANONICAL, newCanonical);
}
示例6: removeConnection
removeConnection(parent: any, child: any) {
var parents = this.parents.get(child.id);
var parentsAll = this.parents.set(child.id, parents.filter(ancestor => ancestor !== parent).toList());
var children = this.children.get(parent.id);
var childrenAll = this.children.set(parent.id, children.filter(ch => ch !== child).toList());
return new Graph(this.nodes, childrenAll, parentsAll);
}
示例7: getParent
getParent(node: any) {
var parents = this.parents.get(node.id);
if (parents.size === 0) {
return null;
}
return parents.get(0);
}
示例8: model
model(name?: string): type.Model | undefined {
if (!name) {
name = 'main';
}
if (this.models.has(name)) {
return this.models.get(name);
}
return this.models.get('stdlib·' + name);
}