@dra2020/baseclient 1.0.92 → 1.0.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,10 +12,12 @@ interface Entry {
|
|
|
12
12
|
export declare function reverseBlockMapping(bm: BlockMapping): ReverseBlockMapping;
|
|
13
13
|
export declare class MultiBlockMapping {
|
|
14
14
|
entries: Entry[];
|
|
15
|
+
stamp: number;
|
|
15
16
|
constructor(tag?: string, bm?: BlockMapping);
|
|
16
17
|
add(tag: string, bm: BlockMapping): void;
|
|
17
18
|
remove(tag: string): void;
|
|
18
19
|
map(blockid: string): string;
|
|
20
|
+
multimap(blockid: string): string[];
|
|
19
21
|
bmOf(tag: string): BlockMapping;
|
|
20
22
|
mapmain(blockid: string): string;
|
|
21
23
|
rev(geoid: string): string[];
|
|
@@ -24,10 +24,12 @@ export function reverseBlockMapping(bm: BlockMapping): ReverseBlockMapping
|
|
|
24
24
|
export class MultiBlockMapping
|
|
25
25
|
{
|
|
26
26
|
entries: Entry[];
|
|
27
|
+
stamp: number;
|
|
27
28
|
|
|
28
29
|
constructor(tag?: string, bm?: BlockMapping)
|
|
29
30
|
{
|
|
30
31
|
this.entries = [];
|
|
32
|
+
this.stamp = Math.trunc(Math.random() * Number.MAX_SAFE_INTEGER / 2);
|
|
31
33
|
if (tag && bm)
|
|
32
34
|
this.entries.push({ tag, bm });
|
|
33
35
|
}
|
|
@@ -37,13 +39,17 @@ export class MultiBlockMapping
|
|
|
37
39
|
this.entries.forEach(e => { if (e.tag === tag) { e.bm = bm; delete e.rbm; bm = null } });
|
|
38
40
|
if (bm)
|
|
39
41
|
this.entries.push({ tag, bm });
|
|
42
|
+
this.stamp++;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
remove(tag: string): void
|
|
43
46
|
{
|
|
44
47
|
for (let i = this.entries.length-1; i >= 0; i--)
|
|
45
48
|
if (this.entries[i].tag === tag)
|
|
49
|
+
{
|
|
50
|
+
this.stamp++;
|
|
46
51
|
this.entries.splice(i, 1);
|
|
52
|
+
}
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
map(blockid: string): string
|
|
@@ -58,6 +64,13 @@ export class MultiBlockMapping
|
|
|
58
64
|
return undefined;
|
|
59
65
|
}
|
|
60
66
|
|
|
67
|
+
multimap(blockid: string): string[]
|
|
68
|
+
{
|
|
69
|
+
let a: string[] = [];
|
|
70
|
+
this.entries.forEach(e => { if (e.bm[blockid]) a.push(e.bm[blockid]) });
|
|
71
|
+
return a;
|
|
72
|
+
}
|
|
73
|
+
|
|
61
74
|
bmOf(tag: string): BlockMapping
|
|
62
75
|
{
|
|
63
76
|
let e = this.entries.find(e => e.tag === tag);
|