forked from praeclarum/Netjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mscorlib.ts
executable file
·1767 lines (1591 loc) · 34.7 KB
/
mscorlib.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2014 Frank A. Krueger
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
class NObject
{
Equals(other: NObject): boolean
{
return this === other;
}
GetHashCode(): number
{
return NString.GetHashCode (this.toString ());
}
ToString(): string
{
return this.GetType ().Name;
}
toString(): string
{
return this.ToString ();
}
GetType(): Type
{
return new Type (this.constructor.toString().match(/function (\w*)/)[1]);
}
static ReferenceEquals(x: NObject, y: NObject): boolean
{
return x === y;
}
static GenericEquals(x: any, y: any): boolean
{
if (typeof x === "object") return x.Equals(y);
return x === y;
}
static GenericToString(x: any): string
{
if (typeof x === "object") return x.ToString();
return x.toString ();
}
static GenericGetHashCode(x: any): number
{
if (typeof x === "object") return x.GetHashCode();
return NString.GetHashCode (this.toString ());
}
}
class Exception extends NObject
{
Message: string;
constructor(message: string = "")
{
super();
this.Message = message;
}
ToString(): string
{
return "Exception: " + this.Message;
}
}
class NEvent<T>
{
private listeners: T[] = new Array<T> ();
Add(listener: T): void
{
this.listeners.push(listener);
}
Remove(listener: T): void
{
var index = this.listeners.indexOf(listener);
if (index < 0) return;
this.listeners.splice(index, 1);
}
ToMulticastFunction(): any
{
if (this.listeners.length === 0)
return null;
return function() {
for (var i in this.listeners) {
this.listeners[i].call (arguments);
}
};
}
}
class NArray
{
static IndexOf<T> (values: T[], value: T): number
{
var i, n = values.length;
for (i = 0; i < n; i++) {
if (values[i] === value)
return i;
}
return -1;
}
static ToEnumerable<T> (array: T[]): IEnumerable<T>
{
return new Array_Enumerable<T> (array);
}
static Resize<T> (parray: T[][], newLength: number): void
{
if (parray[0] === null) {
parray[0] = new Array<T> (newLength);
return;
}
if (parray[0].length === newLength) {
return;
}
throw new NotImplementedException ();
}
static ConvertAll<T, V> (array: T[], convertFunc: (T) => V): V[]
{
if (array == null) {
return null;
}
return array.map(convertFunc);
}
static Reverse<T>(array: T[]): void
{
array.reverse();
}
static FindAll<T>(array: T[], predicate: (T) => boolean): T[]
{
return array.filter(predicate);
}
}
class NNumber
{
static Parse(text: string): number
static Parse(text: string, style: NumberStyles, provider: IFormatProvider): number
static Parse(text: string, provider: IFormatProvider): number
static Parse(text: string, styleOrProvider?: any, provider?: IFormatProvider): number
{
return parseFloat(text);
}
static ToString(num: number): string
static ToString(num: number, provider: IFormatProvider): string
static ToString(num: number, format: string, provider: IFormatProvider): string
static ToString(num: number, providerOrFormat?: any, provider?: IFormatProvider): string
{
return num.toString();
}
static GetHashCode(num: number): number
{
return num;
}
static IsInfinity(num: number): boolean
{
return num === Infinity;
}
static TryParse(str: string, pvalue: number[]): boolean
{
try {
pvalue[0] = parseFloat (str);
return true;
}
catch (ex) {
pvalue[0] = 0;
return false;
}
}
static IsNaN(num: number): boolean
{
return isNaN (num);
}
}
class NBoolean
{
static TryParse(str: string, pbool: boolean[]): boolean
{
throw new NotImplementedException;
}
static GetHashCode(bool: boolean): number
{
return bool ? 1 : 0;
}
}
class NChar
{
static IsWhiteSpace(ch: number): boolean
{
return ch === 32 || (ch >= 9 && ch <= 13) || ch === 133 || ch === 160;
}
static IsLetter(ch: number): boolean
{
return (65 <= ch && ch <= 90) || (97 <= ch && ch <= 122) || (ch >= 128 && ch !== 133 && ch !== 160);
}
static IsLetterOrDigit(ch: number): boolean
{
return (48 <= ch && ch <= 57) || (65 <= ch && ch <= 90) || (97 <= ch && ch <= 122) || (ch >= 128 && ch !== 133 && ch !== 160);
}
static IsDigit(ch: number): boolean
static IsDigit(str: string, index: number): boolean
static IsDigit(chOrStr: any, index?: number): boolean
{
if (arguments.length == 1) {
return 48 <= chOrStr && chOrStr <= 57;
}
else {
var ch = chOrStr.charCodeAt(index);
return 48 <= ch && ch <= 57;
}
}
}
class NString
{
static Empty = "";
private static escapeRegExp(str: string){
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
reHasRegExpChar = RegExp(reRegExpChar.source);
return str && reHasRegExpChar.test(str)
? str.replace(reHasRegExpChar, '\\$&')
: str;
}
static IndexOf (str: string, ch: number): number
static IndexOf (str: string, ch: number, startIndex: number): number
static IndexOf (str: string, sub: string): number
static IndexOf (str: string, sub: string, startIndex: number): number
static IndexOf (str: string, chOrSub: any, startIndex?: number): number
{
var sub: string;
if (chOrSub.constructor == Number) {
sub = String.fromCharCode (chOrSub);
}
else {
sub = chOrSub;
}
return str.indexOf(sub);
}
static IndexOfAny (str: string, subs: number[]): number
{
for (var i = 0; i < str.length; ++i) {
var c = str.charCodeAt(i);
for (var j = 0; j < subs.length; ++j) {
if (c == subs[j])
return i;
}
}
return -1;
}
static GetHashCode(str: string): number
{
var hash = 0, i, l, ch;
if (str.length == 0) return hash;
for (i = 0, l = str.length; i < l; i++) {
ch = str.charCodeAt(i);
hash = ((hash<<5)-hash) + ch;
hash |= 0; // Convert to 32bit integer
}
return hash;
}
static Replace(str: string, pattern: number, replacement: number): string
static Replace(str: string, pattern: string, replacement: string): string
static Replace(str: string, pattern: any, replacement: any): string
{
var ps = (pattern.constructor === Number) ? String.fromCharCode (pattern) : pattern;
var rs = (replacement.constructor === Number) ? String.fromCharCode (replacement) : replacement;
return str.replace(ps, rs);
}
static Substring(str: string, startIndex: number): string
static Substring(str: string, startIndex: number, length: number): string
static Substring(str: string, startIndex: number, length: number = -1): string
{
return length < 0 ? str.substr(startIndex) : str.substr(startIndex, length);
}
/*static Remove(str: string, startIndex: number): string*/
static Remove(str: string, startIndex: number, length: number): string
{
if (typeof length === undefined)
{
return str.substring(0, startIndex);
}
else
{
return str.substring(0, startIndex) + str.substring(startIndex + length);
}
}
/*static Remove(str: string, startIndex: number, length?: number): string
{
throw new NotImplementedException(); // do we care that ts->js compiler will get rid of this syntactic sugar?
}*/
static Trim(str: string, trimChars: number[] = null): string
{
if(trimChars == null){
return str.trim();
}
return NString.TrimEnd(NString.TrimStart(str, trimChars), trimChars);
}
static TrimStart(str: string, trimChars: number[] = [32/*space*/]): string
{
var pattern = NString.escapeRegExp(String.fromCharCode(...trimChars));
return str.replace(new RegExp(`^[${pattern}]+`), '');
}
static TrimEnd(str: string, trimChars: number[] = [32/*space*/]): string
{
var pattern = NString.escapeRegExp(String.fromCharCode(...trimChars));
return str.replace(new RegExp(`[${pattern}]+$`), '');
}
static ToUpperInvariant(str: string): string
{
return str.toUpperCase ();
}
static ToLowerInvariant(str: string): string
{
return str.toLowerCase ();
}
static Contains(str: string, sub: string): boolean
{
return str.indexOf (sub) >= 0;
}
static StartsWith(str: string, sub: string): boolean
static StartsWith(str: string, sub: string, comp: StringComparison): boolean
static StartsWith(str: string, sub: string, comp?: StringComparison): boolean
{
return str.indexOf (sub) === 0;
}
static EndsWith(str: string, sub: string): boolean
static EndsWith(str: string, sub: string, comp: StringComparison): boolean
static EndsWith(str: string, sub: string, comp?: StringComparison): boolean
{
return str.indexOf (sub) === str.length - sub.length;
}
static Format(format: string, arg0?: any, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): string
{
if (arg0.constructor === Array)
{
var s = format,
i = arg0.length;
while (i--) {
s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arg0[i]);
}
return s;
}
else
{
var args = [arg0, arg1, arg2, arg3, arg4, arg5];
return NString.Format(format, args);
}
}
static IsNullOrEmpty(str: string): boolean
{
return !str;
}
static Join(separator: string, parts: string[]): string
{
return parts.join(separator);
}
static Concat(parts: any[]): string
{
throw new NotImplementedException();
}
static FromChars(ch: number, count: number): string
static FromChars(chars: number[]): string
static FromChars(chOrChars: any, count: number = 1): string
{
if (chOrChars.constructor === Number) {
var r = String.fromCharCode (chOrChars);
for (var i = 1; i < count; i++) {
r += String.fromCharCode (chOrChars);
}
return r;
}
throw new NotImplementedException ();
}
static Split(str: string, separators: number[]): string[]
{
var pattern = new RegExp(`[${NString.escapeRegExp(String.fromCharCode(...separators))}]`);
return str.split(pattern);
}
}
enum StringComparison
{
InvariantCultureIgnoreCase,
Ordinal,
}
class NMath extends NObject
{
static Truncate (value: number): number
{
return value >= 0 ? Math.floor(value) : Math.ceil(value);
}
static Log (a: number): number
static Log (a: number, newBase: number): number
static Log (a: number, newBase: number = Math.E): number
{
if (newBase === Math.E)
return Math.log (a);
return Math.log(a) / Math.log(newBase);
}
static Round (a: number): number
static Round (a: number, decimals: number): number
static Round (a: number, decimals: number = 0): number
{
if (decimals === 0)
return Math.round(a);
var s = Math.pow(10, decimals);
return Math.round(a * s) / s;
}
static Cosh (x: number): number
{
throw new NotImplementedException ();
}
static Sinh (x: number): number
{
throw new NotImplementedException ();
}
static Tanh (x: number): number
{
throw new NotImplementedException ();
}
}
//
// System
//
class Type extends NObject
{
constructor(public Name: string)
{
super();
}
Equals(obj: any): boolean
{
return (obj instanceof Type) && ((<Type>obj).Name === this.Name);
}
}
class Nullable<T> extends NObject
{
Value: T;
get HasValue(): boolean { return this.Value != null; }
constructor(value: T = null)
{
super();
this.Value = value;
}
}
enum DateTimeKind
{
Local,
Unspecified,
Utc
}
enum DayOfWeek {
Sunday = 0,
Monday = 1,
Tuesday = 2,
Wednesday = 3,
Thursday = 4,
Friday = 5,
Saturday = 6
}
class DateTime extends NObject
{
private dt: Date;
private kind: DateTimeKind;
get Kind(): DateTimeKind { return this.kind; }
get Year(): number { return this.kind === DateTimeKind.Utc ? this.dt.getUTCFullYear() : this.dt.getFullYear(); }
get Month(): number { return this.kind === DateTimeKind.Utc ? this.dt.getUTCMonth()+1 : this.dt.getMonth()+1; }
get Day(): number { return this.kind === DateTimeKind.Utc ? this.dt.getUTCDate() : this.dt.getDate(); }
get DayOfWeek(): DayOfWeek { return this.dt.getDay(); }
constructor()
constructor(year: number, month: number, day: number)
constructor(year: number = 1, month: number = 1, day: number = 1)
{
super();
this.dt = new Date(year, month-1, day);
this.kind = DateTimeKind.Unspecified;
}
ToString(): string
{
return this.kind === DateTimeKind.Utc ? this.dt.toUTCString() : this.dt.toString();
}
static get UtcNow(): DateTime
{
var d = new DateTime();
d.dt = new Date();
d.kind = DateTimeKind.Utc;
return d;
}
static get Now(): DateTime
{
var d = new DateTime();
d.dt = new Date();
d.kind = DateTimeKind.Local;
return d;
}
static op_Subtraction(x: DateTime, y: DateTime): TimeSpan
{
return TimeSpan.FromSeconds ((x.dt.getTime() - y.dt.getTime()) / 1000);
}
static op_GreaterThanOrEqual(x: DateTime, y: DateTime): boolean
{
return x.dt >= y.dt;
}
}
class TimeSpan extends NObject
{
private ticks: number;
constructor(ticks: number)
{
super();
this.ticks = ticks;
}
get TotalDays(): number
{
throw new NotImplementedException ();
}
get Days(): number
{
throw new NotImplementedException ();
}
get Hours(): number
{
throw new NotImplementedException ();
}
get Minutes(): number
{
throw new NotImplementedException ();
}
get Seconds(): number
{
throw new NotImplementedException ();
}
static FromSeconds(seconds: number): TimeSpan
{
return new TimeSpan (seconds * 100e9);
}
static FromDays(days: number): TimeSpan
{
var hours = days*24;
var minutes = 60*hours;
return TimeSpan.FromSeconds (60*minutes);
}
static op_GreaterThanOrEqual(x: TimeSpan, y: TimeSpan)
{
return x.ticks >= y.ticks;
}
}
class NConsole extends NObject
{
static WriteLine (line: string)
static WriteLine (format: string, arg0: any)
static WriteLine (lineOrFormat: string, arg0?: any)
{
console.log(lineOrFormat);
}
static Out: TextWriter;
}
class ArgumentException extends Exception
{
constructor(name: string)
constructor(message: string, name: string)
constructor(nameOrMessage: string, name?: string)
{
super();
}
}
class ArgumentNullException extends ArgumentException
{
constructor(name: string)
{
super(name);
}
}
class ArgumentOutOfRangeException extends ArgumentException
{
constructor(name: string)
{
super(name);
}
}
class EventArgs extends NObject
{
}
class EventHandler extends NObject
{
Invoke (sender: any, e: EventArgs): void
{
}
}
class InvalidOperationException extends Exception
{
}
class Environment
{
static NewLine: string = "\n";
}
class Convert extends NObject
{
static ToUInt16 (str: string) : number
{
var value = Number(str);
if (value < 0) value = 0;
if (value >= 0xFFFF) value = 0xFFFF;
return value;
}
static ToUInt32 (str: string) : number
{
var value = Number(str);
if (value < 0) value = 0;
if (value >= 0xFFFFFFFF) value = 0xFFFFFFFF;
return value;
}
static ToString (num: number, radix: number): string
static ToString (num: number, provider: IFormatProvider): string
static ToString (num: number, radixOrProvider: any): string
{
throw new NotImplementedException ();
}
}
class NumberFormatInfo extends NObject
{
NumberDecimalSeparator: string = ".";
NumberGroupSeparator: string = ",";
}
interface IFormatProvider
{
GetFormat(type: Type): any;
}
enum NumberStyles
{
HexNumber
}
class Encoding extends NObject
{
static UTF8: Encoding = new Encoding();
}
class CultureInfo extends NObject implements IFormatProvider
{
static InvariantCulture: CultureInfo = new CultureInfo("Invariant");
static CurrentCulture: CultureInfo = CultureInfo.InvariantCulture;
Name: string = "Invariant";
private nfi: NumberFormatInfo = new NumberFormatInfo ();
GetFormat(type: Type): any
{
if (type.Name === "NumberFormatInfo") {
return this.nfi;
}
return null;
}
constructor(name: string)
{
super();
}
}
class NotImplementedException extends Exception
{
constructor(message: string = "Not implemented")
{
super(message);
}
}
class NotSupportedException extends Exception
{
constructor(message: string = "Not supported")
{
super(message);
}
}
class OverflowException extends Exception
{
constructor()
{
super("Overflow");
}
}
//
// System.Collections.Generic
//
interface IEnumerable<T>
{
GetEnumerator(): IEnumerator<T>;
}
interface IEnumerator<T> extends IDisposable
{
MoveNext(): boolean;
Current: T;
}
interface IDisposable
{
Dispose(): void;
}
interface IList<T>
{
Count: number;
get_Item(index: number): T;
set_Item(index: number, value: T): void;
}
class List<T> extends NObject implements IList<T>, IEnumerable<T>
{
array: T[] = new Array<T> (); // Public to help the enumerator
constructor();
constructor(capactiy: number);
constructor(items: IEnumerable<T>);
constructor(itemsOrCapacity?: any)
{
super();
if (arguments.length == 1 && itemsOrCapacity.constructor !== Number) {
this.AddRange (itemsOrCapacity);
}
}
Add (item: T)
{
this.array.push(item);
}
AddRange (items: IEnumerable<T>)
{
var e = items.GetEnumerator ();
while (e.MoveNext ()) {
this.Add (e.Current);
}
}
get Count(): number
{
return this.array.length;
}
get_Item(index: number): T
{
return this.array[index];
}
set_Item(index: number, value: T): void
{
this.array[index] = value;
}
GetEnumerator(): List_Enumerator<T>
{
return new List_Enumerator<T> (this);
}
Remove(item: T): boolean
{
var index = this.IndexOf(item);
if (index >= 0) {
this.RemoveAt(index);
return true;
}
return false;
}
RemoveAt(index: number): void
{
this.array.splice(index, 1);
}
RemoveRange(index: number, count: number): void
{
throw new NotImplementedException ();
}
Insert(index: number, item: T): void
{
this.array.splice(index, 0, item);
}
Clear(): void
{
this.array = new Array<T> ();
}
Sort(compare: (a: T, b: T) => number = null): void
{
this.array.sort(compare);
}
ToArray(): T[]
{
return this.array.slice(0);
}
RemoveAll(predicate: (item: T)=>boolean): void
{
var newArray: T[] = new Array<T> ();
for (var i = 0; i < this.array.length; i++) {
if (!predicate(this.array[i]))
newArray.push(this.array[i]);
}
this.array = newArray;
}
FindAll(predicate: (item: T) => boolean): IEnumerable<T>
{
return new Array_Enumerable(this.array.filter(predicate));
}
Reverse(): void
{
throw new NotImplementedException ();
}
IndexOf(item: T): number
{
return this.array.indexOf(item);
}
ForEach(action: (T) => void): void
{
this.array.forEach(action);
}
}
class Array_Enumerator<T> extends NObject implements IEnumerator<T>, IDisposable
{
private array: T[];
private index: number = -1;
constructor (array: T[])
{
super();
this.array = array;
}
MoveNext(): boolean
{
this.index++;
return this.index < this.array.length;
}
get Current(): T
{
return this.array[this.index];
}
Dispose(): void
{
}
}
class Array_Enumerable<T> extends NObject implements IEnumerable<T>
{
private array: T[];
constructor (array: T[])
{
super();
this.array = array;
}
GetEnumerator(): Array_Enumerator<T>
{
return new Array_Enumerator<T> (this.array);
}
}
class List_Enumerator<T> extends Array_Enumerator<T>
{
constructor (list: List<T>)
{
super(list.array);
}
}
class Stack<T> extends List<T>
{
Push(item: T): void
{
this.Add(item);
}
Pop(): T
{
throw new NotImplementedException ();
}
}
class HashSet<T> extends NObject implements IEnumerable<T>
{
private store = {};
Add(item: T): void
{
throw new NotImplementedException ();
}
GetEnumerator(): HashSet_Enumerator<T>
{
throw new NotImplementedException ();
}
Contains(item: T): boolean
{
throw new NotImplementedException ();
}
get Count(): number
{
throw new NotImplementedException ();
}
}
class HashSet_Enumerator<T> extends NObject implements IEnumerator<T>, IDisposable
{
MoveNext(): boolean
{
throw new NotImplementedException ();
}
get Current(): T
{
throw new NotImplementedException ();
}
Dispose(): void
{
}
}
class KeyValuePair<K, V> extends NObject
{
Key: K;
Value: V;
constructor(key: K, value: V)
{
super();
this.Key = key;
this.Value = value;
}
}
interface IDictionary<K, V>
{
}
class Dictionary<K, V> extends NObject implements IDictionary<K, V>, IEnumerable<KeyValuePair<K, V>>
{
private keys = {};
private values = {};
constructor();
constructor(other: IDictionary<K, V>);
constructor(other?: IDictionary<K, V>)
{
super();
}