@fable-org/fable-library-ts 1.9.0 → 2.0.0-beta.1
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.
- package/Array.ts +1378 -1377
- package/CHANGELOG.md +11 -1
- package/Choice.ts +301 -301
- package/FSharp.Collections.ts +34 -34
- package/FSharp.Core.CompilerServices.ts +37 -37
- package/FSharp.Core.ts +184 -86
- package/Global.ts +37 -37
- package/List.ts +1417 -1417
- package/Map.ts +1552 -1552
- package/MutableMap.ts +345 -345
- package/MutableSet.ts +249 -249
- package/Native.ts +11 -11
- package/Random.ts +181 -180
- package/Range.ts +56 -56
- package/Result.ts +196 -196
- package/Seq.ts +1525 -1525
- package/Seq2.ts +129 -129
- package/Set.ts +1955 -1955
- package/System.Collections.Generic.ts +380 -380
- package/System.Text.ts +203 -197
- package/Types.ts +1 -1
- package/package.json +1 -1
package/MutableSet.ts
CHANGED
|
@@ -1,249 +1,249 @@
|
|
|
1
|
-
import { IMap, IEqualityComparer, IDisposable, disposeSafe, defaultOf, ISet, toIterator, IEnumerator, getEnumerator } from "./Util.js";
|
|
2
|
-
import { iterate, map, iterateIndexed, concat } from "./Seq.js";
|
|
3
|
-
import { setItem } from "./Array.js";
|
|
4
|
-
import { int32 } from "./Int32.js";
|
|
5
|
-
import { some, Option } from "./Option.js";
|
|
6
|
-
import { FSharpRef } from "./Types.js";
|
|
7
|
-
import { class_type, TypeInfo } from "./Reflection.js";
|
|
8
|
-
import { getItemFromDict, tryGetValue } from "./MapUtil.js";
|
|
9
|
-
|
|
10
|
-
export class HashSet<T> implements ISet<T>, Iterable<T>, Iterable<T> {
|
|
11
|
-
readonly comparer: IEqualityComparer<T>;
|
|
12
|
-
readonly hashMap: IMap<int32, T[]>;
|
|
13
|
-
"init@9": int32;
|
|
14
|
-
constructor(items: Iterable<T>, comparer: IEqualityComparer<T>) {
|
|
15
|
-
const this$: FSharpRef<HashSet<T>> = new FSharpRef<HashSet<T>>(defaultOf());
|
|
16
|
-
this.comparer = comparer;
|
|
17
|
-
this$.contents = this;
|
|
18
|
-
this.hashMap = (new Map<int32, T[]>([]));
|
|
19
|
-
this["init@9"] = 1;
|
|
20
|
-
const enumerator: IEnumerator<T> = getEnumerator(items);
|
|
21
|
-
try {
|
|
22
|
-
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
23
|
-
const item: T = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
24
|
-
HashSet__Add_2B595<T>(this$.contents, item);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
finally {
|
|
28
|
-
disposeSafe(enumerator as IDisposable);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
get [Symbol.toStringTag](): string {
|
|
32
|
-
return "HashSet";
|
|
33
|
-
}
|
|
34
|
-
toJSON(): any {
|
|
35
|
-
const this$: HashSet<T> = this;
|
|
36
|
-
return Array.from(this$);
|
|
37
|
-
}
|
|
38
|
-
"System.Collections.IEnumerable.GetEnumerator"(): IEnumerator<any> {
|
|
39
|
-
const this$: HashSet<T> = this;
|
|
40
|
-
return getEnumerator(this$);
|
|
41
|
-
}
|
|
42
|
-
GetEnumerator(): IEnumerator<T> {
|
|
43
|
-
const this$: HashSet<T> = this;
|
|
44
|
-
return getEnumerator(concat<T[], T>(this$.hashMap.values()));
|
|
45
|
-
}
|
|
46
|
-
[Symbol.iterator](): Iterator<T> {
|
|
47
|
-
return toIterator(getEnumerator(this));
|
|
48
|
-
}
|
|
49
|
-
"System.Collections.Generic.ICollection`1.Add2B595"(item: T): void {
|
|
50
|
-
const this$: HashSet<T> = this;
|
|
51
|
-
HashSet__Add_2B595<T>(this$, item);
|
|
52
|
-
}
|
|
53
|
-
"System.Collections.Generic.ICollection`1.Clear"(): void {
|
|
54
|
-
const this$: HashSet<T> = this;
|
|
55
|
-
HashSet__Clear<T>(this$);
|
|
56
|
-
}
|
|
57
|
-
"System.Collections.Generic.ICollection`1.Contains2B595"(item: T): boolean {
|
|
58
|
-
const this$: HashSet<T> = this;
|
|
59
|
-
return HashSet__Contains_2B595<T>(this$, item);
|
|
60
|
-
}
|
|
61
|
-
"System.Collections.Generic.ICollection`1.CopyToZ3B4C077E"(array: T[], arrayIndex: int32): void {
|
|
62
|
-
const this$: HashSet<T> = this;
|
|
63
|
-
iterateIndexed<T>((i: int32, e: T): void => {
|
|
64
|
-
setItem(array, arrayIndex + i, e);
|
|
65
|
-
}, this$);
|
|
66
|
-
}
|
|
67
|
-
"System.Collections.Generic.ICollection`1.get_Count"(): int32 {
|
|
68
|
-
const this$: HashSet<T> = this;
|
|
69
|
-
return HashSet__get_Count<T>(this$) | 0;
|
|
70
|
-
}
|
|
71
|
-
"System.Collections.Generic.ICollection`1.get_IsReadOnly"(): boolean {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
"System.Collections.Generic.ICollection`1.Remove2B595"(item: T): boolean {
|
|
75
|
-
const this$: HashSet<T> = this;
|
|
76
|
-
return HashSet__Remove_2B595<T>(this$, item);
|
|
77
|
-
}
|
|
78
|
-
get size(): int32 {
|
|
79
|
-
const this$: HashSet<T> = this;
|
|
80
|
-
return HashSet__get_Count<T>(this$) | 0;
|
|
81
|
-
}
|
|
82
|
-
add(k: T): ISet<T> {
|
|
83
|
-
const this$: HashSet<T> = this;
|
|
84
|
-
HashSet__Add_2B595<T>(this$, k);
|
|
85
|
-
return this$;
|
|
86
|
-
}
|
|
87
|
-
clear(): void {
|
|
88
|
-
const this$: HashSet<T> = this;
|
|
89
|
-
HashSet__Clear<T>(this$);
|
|
90
|
-
}
|
|
91
|
-
delete(k: T): boolean {
|
|
92
|
-
const this$: HashSet<T> = this;
|
|
93
|
-
return HashSet__Remove_2B595<T>(this$, k);
|
|
94
|
-
}
|
|
95
|
-
has(k: T): boolean {
|
|
96
|
-
const this$: HashSet<T> = this;
|
|
97
|
-
return HashSet__Contains_2B595<T>(this$, k);
|
|
98
|
-
}
|
|
99
|
-
keys(): Iterable<T> {
|
|
100
|
-
const this$: HashSet<T> = this;
|
|
101
|
-
return map<T, T>((x: T): T => x, this$);
|
|
102
|
-
}
|
|
103
|
-
values(): Iterable<T> {
|
|
104
|
-
const this$: HashSet<T> = this;
|
|
105
|
-
return map<T, T>((x: T): T => x, this$);
|
|
106
|
-
}
|
|
107
|
-
entries(): Iterable<[T, T]> {
|
|
108
|
-
const this$: HashSet<T> = this;
|
|
109
|
-
return map<T, [T, T]>((v: T): [T, T] => ([v, v] as [T, T]), this$);
|
|
110
|
-
}
|
|
111
|
-
forEach(f: ((arg0: T, arg1: T, arg2: ISet<T>) => void), thisArg?: Option<any>): void {
|
|
112
|
-
const this$: HashSet<T> = this;
|
|
113
|
-
iterate<T>((x: T): void => {
|
|
114
|
-
f(x, x, this$);
|
|
115
|
-
}, this$);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export function HashSet_$reflection(gen0: TypeInfo): TypeInfo {
|
|
120
|
-
return class_type("Fable.Collections.HashSet", [gen0], HashSet);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export function HashSet_$ctor_Z6150332D<T>(items: Iterable<T>, comparer: IEqualityComparer<T>): HashSet<T> {
|
|
124
|
-
return new HashSet(items, comparer);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function HashSet__TryFindIndex_2B595<T>(this$: HashSet<T>, k: T): [boolean, int32, int32] {
|
|
128
|
-
const h: int32 = this$.comparer.GetHashCode(k) | 0;
|
|
129
|
-
let matchValue: [boolean, T[]];
|
|
130
|
-
let outArg: T[] = defaultOf();
|
|
131
|
-
matchValue = ([tryGetValue(this$.hashMap, h, new FSharpRef<T[]>((): T[] => outArg, (v: T[]): void => {
|
|
132
|
-
outArg = v;
|
|
133
|
-
})), outArg] as [boolean, T[]]);
|
|
134
|
-
if (matchValue[0]) {
|
|
135
|
-
return [true, h, matchValue[1].findIndex((v_1: T): boolean => this$.comparer.Equals(k, v_1))] as [boolean, int32, int32];
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
return [false, h, -1] as [boolean, int32, int32];
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function HashSet__TryFind_2B595<T>(this$: HashSet<T>, k: T): Option<T> {
|
|
143
|
-
const matchValue: [boolean, int32, int32] = HashSet__TryFindIndex_2B595<T>(this$, k);
|
|
144
|
-
let matchResult: int32;
|
|
145
|
-
if (matchValue[0]) {
|
|
146
|
-
if (matchValue[2] > -1) {
|
|
147
|
-
matchResult = 0;
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
matchResult = 1;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
matchResult = 1;
|
|
155
|
-
}
|
|
156
|
-
switch (matchResult) {
|
|
157
|
-
case 0:
|
|
158
|
-
return some(getItemFromDict(this$.hashMap, matchValue[1])[matchValue[2]]);
|
|
159
|
-
default:
|
|
160
|
-
return undefined;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export function HashSet__get_Comparer<T>(this$: HashSet<T>): IEqualityComparer<T> {
|
|
165
|
-
return this$.comparer;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export function HashSet__Clear<T>(this$: HashSet<T>): void {
|
|
169
|
-
this$.hashMap.clear();
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export function HashSet__get_Count<T>(this$: HashSet<T>): int32 {
|
|
173
|
-
let count = 0;
|
|
174
|
-
let enumerator: any = getEnumerator(this$.hashMap.values());
|
|
175
|
-
try {
|
|
176
|
-
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
177
|
-
const items: T[] = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
178
|
-
count = ((count + items.length) | 0);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
finally {
|
|
182
|
-
disposeSafe(enumerator);
|
|
183
|
-
}
|
|
184
|
-
return count | 0;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export function HashSet__Add_2B595<T>(this$: HashSet<T>, k: T): boolean {
|
|
188
|
-
const matchValue: [boolean, int32, int32] = HashSet__TryFindIndex_2B595<T>(this$, k);
|
|
189
|
-
if (matchValue[0]) {
|
|
190
|
-
if (matchValue[2] > -1) {
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
const value: any = void (getItemFromDict(this$.hashMap, matchValue[1]).push(k));
|
|
195
|
-
return true;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
this$.hashMap.set(matchValue[1], [k]);
|
|
200
|
-
return true;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
export function HashSet__Contains_2B595<T>(this$: HashSet<T>, k: T): boolean {
|
|
205
|
-
const matchValue: [boolean, int32, int32] = HashSet__TryFindIndex_2B595<T>(this$, k);
|
|
206
|
-
let matchResult: int32;
|
|
207
|
-
if (matchValue[0]) {
|
|
208
|
-
if (matchValue[2] > -1) {
|
|
209
|
-
matchResult = 0;
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
matchResult = 1;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
matchResult = 1;
|
|
217
|
-
}
|
|
218
|
-
switch (matchResult) {
|
|
219
|
-
case 0:
|
|
220
|
-
return true;
|
|
221
|
-
default:
|
|
222
|
-
return false;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export function HashSet__Remove_2B595<T>(this$: HashSet<T>, k: T): boolean {
|
|
227
|
-
const matchValue: [boolean, int32, int32] = HashSet__TryFindIndex_2B595<T>(this$, k);
|
|
228
|
-
let matchResult: int32;
|
|
229
|
-
if (matchValue[0]) {
|
|
230
|
-
if (matchValue[2] > -1) {
|
|
231
|
-
matchResult = 0;
|
|
232
|
-
}
|
|
233
|
-
else {
|
|
234
|
-
matchResult = 1;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
matchResult = 1;
|
|
239
|
-
}
|
|
240
|
-
switch (matchResult) {
|
|
241
|
-
case 0: {
|
|
242
|
-
getItemFromDict(this$.hashMap, matchValue[1]).splice(matchValue[2], 1);
|
|
243
|
-
return true;
|
|
244
|
-
}
|
|
245
|
-
default:
|
|
246
|
-
return false;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
1
|
+
import { IMap, IEqualityComparer, IDisposable, disposeSafe, defaultOf, ISet, toIterator, IEnumerator, getEnumerator } from "./Util.js";
|
|
2
|
+
import { iterate, map, iterateIndexed, concat } from "./Seq.js";
|
|
3
|
+
import { setItem } from "./Array.js";
|
|
4
|
+
import { int32 } from "./Int32.js";
|
|
5
|
+
import { some, Option } from "./Option.js";
|
|
6
|
+
import { FSharpRef } from "./Types.js";
|
|
7
|
+
import { class_type, TypeInfo } from "./Reflection.js";
|
|
8
|
+
import { getItemFromDict, tryGetValue } from "./MapUtil.js";
|
|
9
|
+
|
|
10
|
+
export class HashSet<T> implements ISet<T>, Iterable<T>, Iterable<T> {
|
|
11
|
+
readonly comparer: IEqualityComparer<T>;
|
|
12
|
+
readonly hashMap: IMap<int32, T[]>;
|
|
13
|
+
"init@9": int32;
|
|
14
|
+
constructor(items: Iterable<T>, comparer: IEqualityComparer<T>) {
|
|
15
|
+
const this$: FSharpRef<HashSet<T>> = new FSharpRef<HashSet<T>>(defaultOf());
|
|
16
|
+
this.comparer = comparer;
|
|
17
|
+
this$.contents = this;
|
|
18
|
+
this.hashMap = (new Map<int32, T[]>([]));
|
|
19
|
+
this["init@9"] = 1;
|
|
20
|
+
const enumerator: IEnumerator<T> = getEnumerator(items);
|
|
21
|
+
try {
|
|
22
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
23
|
+
const item: T = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
24
|
+
HashSet__Add_2B595<T>(this$.contents, item);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
finally {
|
|
28
|
+
disposeSafe(enumerator as IDisposable);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
get [Symbol.toStringTag](): string {
|
|
32
|
+
return "HashSet";
|
|
33
|
+
}
|
|
34
|
+
toJSON(): any {
|
|
35
|
+
const this$: HashSet<T> = this;
|
|
36
|
+
return Array.from(this$);
|
|
37
|
+
}
|
|
38
|
+
"System.Collections.IEnumerable.GetEnumerator"(): IEnumerator<any> {
|
|
39
|
+
const this$: HashSet<T> = this;
|
|
40
|
+
return getEnumerator(this$);
|
|
41
|
+
}
|
|
42
|
+
GetEnumerator(): IEnumerator<T> {
|
|
43
|
+
const this$: HashSet<T> = this;
|
|
44
|
+
return getEnumerator(concat<T[], T>(this$.hashMap.values()));
|
|
45
|
+
}
|
|
46
|
+
[Symbol.iterator](): Iterator<T> {
|
|
47
|
+
return toIterator(getEnumerator(this));
|
|
48
|
+
}
|
|
49
|
+
"System.Collections.Generic.ICollection`1.Add2B595"(item: T): void {
|
|
50
|
+
const this$: HashSet<T> = this;
|
|
51
|
+
HashSet__Add_2B595<T>(this$, item);
|
|
52
|
+
}
|
|
53
|
+
"System.Collections.Generic.ICollection`1.Clear"(): void {
|
|
54
|
+
const this$: HashSet<T> = this;
|
|
55
|
+
HashSet__Clear<T>(this$);
|
|
56
|
+
}
|
|
57
|
+
"System.Collections.Generic.ICollection`1.Contains2B595"(item: T): boolean {
|
|
58
|
+
const this$: HashSet<T> = this;
|
|
59
|
+
return HashSet__Contains_2B595<T>(this$, item);
|
|
60
|
+
}
|
|
61
|
+
"System.Collections.Generic.ICollection`1.CopyToZ3B4C077E"(array: T[], arrayIndex: int32): void {
|
|
62
|
+
const this$: HashSet<T> = this;
|
|
63
|
+
iterateIndexed<T>((i: int32, e: T): void => {
|
|
64
|
+
setItem(array, arrayIndex + i, e);
|
|
65
|
+
}, this$);
|
|
66
|
+
}
|
|
67
|
+
"System.Collections.Generic.ICollection`1.get_Count"(): int32 {
|
|
68
|
+
const this$: HashSet<T> = this;
|
|
69
|
+
return HashSet__get_Count<T>(this$) | 0;
|
|
70
|
+
}
|
|
71
|
+
"System.Collections.Generic.ICollection`1.get_IsReadOnly"(): boolean {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
"System.Collections.Generic.ICollection`1.Remove2B595"(item: T): boolean {
|
|
75
|
+
const this$: HashSet<T> = this;
|
|
76
|
+
return HashSet__Remove_2B595<T>(this$, item);
|
|
77
|
+
}
|
|
78
|
+
get size(): int32 {
|
|
79
|
+
const this$: HashSet<T> = this;
|
|
80
|
+
return HashSet__get_Count<T>(this$) | 0;
|
|
81
|
+
}
|
|
82
|
+
add(k: T): ISet<T> {
|
|
83
|
+
const this$: HashSet<T> = this;
|
|
84
|
+
HashSet__Add_2B595<T>(this$, k);
|
|
85
|
+
return this$;
|
|
86
|
+
}
|
|
87
|
+
clear(): void {
|
|
88
|
+
const this$: HashSet<T> = this;
|
|
89
|
+
HashSet__Clear<T>(this$);
|
|
90
|
+
}
|
|
91
|
+
delete(k: T): boolean {
|
|
92
|
+
const this$: HashSet<T> = this;
|
|
93
|
+
return HashSet__Remove_2B595<T>(this$, k);
|
|
94
|
+
}
|
|
95
|
+
has(k: T): boolean {
|
|
96
|
+
const this$: HashSet<T> = this;
|
|
97
|
+
return HashSet__Contains_2B595<T>(this$, k);
|
|
98
|
+
}
|
|
99
|
+
keys(): Iterable<T> {
|
|
100
|
+
const this$: HashSet<T> = this;
|
|
101
|
+
return map<T, T>((x: T): T => x, this$);
|
|
102
|
+
}
|
|
103
|
+
values(): Iterable<T> {
|
|
104
|
+
const this$: HashSet<T> = this;
|
|
105
|
+
return map<T, T>((x: T): T => x, this$);
|
|
106
|
+
}
|
|
107
|
+
entries(): Iterable<[T, T]> {
|
|
108
|
+
const this$: HashSet<T> = this;
|
|
109
|
+
return map<T, [T, T]>((v: T): [T, T] => ([v, v] as [T, T]), this$);
|
|
110
|
+
}
|
|
111
|
+
forEach(f: ((arg0: T, arg1: T, arg2: ISet<T>) => void), thisArg?: Option<any>): void {
|
|
112
|
+
const this$: HashSet<T> = this;
|
|
113
|
+
iterate<T>((x: T): void => {
|
|
114
|
+
f(x, x, this$);
|
|
115
|
+
}, this$);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function HashSet_$reflection(gen0: TypeInfo): TypeInfo {
|
|
120
|
+
return class_type("Fable.Collections.HashSet", [gen0], HashSet);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function HashSet_$ctor_Z6150332D<T>(items: Iterable<T>, comparer: IEqualityComparer<T>): HashSet<T> {
|
|
124
|
+
return new HashSet(items, comparer);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function HashSet__TryFindIndex_2B595<T>(this$: HashSet<T>, k: T): [boolean, int32, int32] {
|
|
128
|
+
const h: int32 = this$.comparer.GetHashCode(k) | 0;
|
|
129
|
+
let matchValue: [boolean, T[]];
|
|
130
|
+
let outArg: T[] = defaultOf();
|
|
131
|
+
matchValue = ([tryGetValue(this$.hashMap, h, new FSharpRef<T[]>((): T[] => outArg, (v: T[]): void => {
|
|
132
|
+
outArg = v;
|
|
133
|
+
})), outArg] as [boolean, T[]]);
|
|
134
|
+
if (matchValue[0]) {
|
|
135
|
+
return [true, h, matchValue[1].findIndex((v_1: T): boolean => this$.comparer.Equals(k, v_1))] as [boolean, int32, int32];
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return [false, h, -1] as [boolean, int32, int32];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function HashSet__TryFind_2B595<T>(this$: HashSet<T>, k: T): Option<T> {
|
|
143
|
+
const matchValue: [boolean, int32, int32] = HashSet__TryFindIndex_2B595<T>(this$, k);
|
|
144
|
+
let matchResult: int32;
|
|
145
|
+
if (matchValue[0]) {
|
|
146
|
+
if (matchValue[2] > -1) {
|
|
147
|
+
matchResult = 0;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
matchResult = 1;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
matchResult = 1;
|
|
155
|
+
}
|
|
156
|
+
switch (matchResult) {
|
|
157
|
+
case 0:
|
|
158
|
+
return some(getItemFromDict(this$.hashMap, matchValue[1])[matchValue[2]]);
|
|
159
|
+
default:
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function HashSet__get_Comparer<T>(this$: HashSet<T>): IEqualityComparer<T> {
|
|
165
|
+
return this$.comparer;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function HashSet__Clear<T>(this$: HashSet<T>): void {
|
|
169
|
+
this$.hashMap.clear();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function HashSet__get_Count<T>(this$: HashSet<T>): int32 {
|
|
173
|
+
let count = 0;
|
|
174
|
+
let enumerator: any = getEnumerator(this$.hashMap.values());
|
|
175
|
+
try {
|
|
176
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
177
|
+
const items: T[] = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
178
|
+
count = ((count + items.length) | 0);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
finally {
|
|
182
|
+
disposeSafe(enumerator);
|
|
183
|
+
}
|
|
184
|
+
return count | 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export function HashSet__Add_2B595<T>(this$: HashSet<T>, k: T): boolean {
|
|
188
|
+
const matchValue: [boolean, int32, int32] = HashSet__TryFindIndex_2B595<T>(this$, k);
|
|
189
|
+
if (matchValue[0]) {
|
|
190
|
+
if (matchValue[2] > -1) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
const value: any = void (getItemFromDict(this$.hashMap, matchValue[1]).push(k));
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
this$.hashMap.set(matchValue[1], [k]);
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export function HashSet__Contains_2B595<T>(this$: HashSet<T>, k: T): boolean {
|
|
205
|
+
const matchValue: [boolean, int32, int32] = HashSet__TryFindIndex_2B595<T>(this$, k);
|
|
206
|
+
let matchResult: int32;
|
|
207
|
+
if (matchValue[0]) {
|
|
208
|
+
if (matchValue[2] > -1) {
|
|
209
|
+
matchResult = 0;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
matchResult = 1;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
matchResult = 1;
|
|
217
|
+
}
|
|
218
|
+
switch (matchResult) {
|
|
219
|
+
case 0:
|
|
220
|
+
return true;
|
|
221
|
+
default:
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function HashSet__Remove_2B595<T>(this$: HashSet<T>, k: T): boolean {
|
|
227
|
+
const matchValue: [boolean, int32, int32] = HashSet__TryFindIndex_2B595<T>(this$, k);
|
|
228
|
+
let matchResult: int32;
|
|
229
|
+
if (matchValue[0]) {
|
|
230
|
+
if (matchValue[2] > -1) {
|
|
231
|
+
matchResult = 0;
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
matchResult = 1;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
matchResult = 1;
|
|
239
|
+
}
|
|
240
|
+
switch (matchResult) {
|
|
241
|
+
case 0: {
|
|
242
|
+
getItemFromDict(this$.hashMap, matchValue[1]).splice(matchValue[2], 1);
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
default:
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
package/Native.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { int32 } from "./Int32.js";
|
|
2
|
-
|
|
3
|
-
export function Helpers_allocateArrayFromCons<T>(cons: any, len: int32): T[] {
|
|
4
|
-
if ((typeof cons) === "function") {
|
|
5
|
-
return new cons(len);
|
|
6
|
-
}
|
|
7
|
-
else {
|
|
8
|
-
return new Array(len);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
1
|
+
import { int32 } from "./Int32.js";
|
|
2
|
+
|
|
3
|
+
export function Helpers_allocateArrayFromCons<T>(cons: any, len: int32): T[] {
|
|
4
|
+
if ((typeof cons) === "function") {
|
|
5
|
+
return new cons(len);
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
return new Array(len);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|