-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTS-Base.js
More file actions
6418 lines (6418 loc) · 304 KB
/
TS-Base.js
File metadata and controls
6418 lines (6418 loc) · 304 KB
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
var TS;
(function (TS) {
"use strict";
/**
* @class TS.Exception
*
* @implements {Error}
*
* @description The base class of all exceptions defined in this framework. The Exception class has a public read only
* property called 'type' which returns the fully qualified type name of the exception class. This way you are able
* to create a finer granular error handling based on the exception type. Your are not longer forced to parse the
* error message string to infer the nature of the exception. Each subclass of the Exception class has to override
* the 'type' property to reflect the own type. The exception class has also a read only 'innerException' property
* which allows to create an exception stack which links back to the root exception.
*/
class Exception {
/**
* @constructor
*
* @param {string} message, An optional message string.
* @param {Exception} innerException, An optional inner exception.
*/
constructor(message = "", innerException) {
this.internalMessage = (message) ? message : "";
this.internalInnerException = (innerException) ? innerException : null;
}
/**
* @description Returns the inner exception if available or null.
*
* @public
*
* @get {TS.Exception | null} innerException
*/
get innerException() {
return this.internalInnerException;
}
/**
* @implements {Error}
*
* @description The error message.
*
* @get {string} message
*/
get message() {
return this.internalMessage;
}
/**
* @implements {Error}
*
* @description The error name. It's the same as the type.
*
* @get {string} name
*/
get name() {
return this.type;
}
/**
* @description Returns the fully qualified type name of the exception.
*
* @public
*
* @get {string} type
*/
get type() {
return "TS.Exception";
}
/**
* @description Returns a combination of the 'type' and 'message' of the exception as string.
*
* @override {Object}
*
* @returns {string}
*/
toString() {
return this.type + ((this.message.length > 0) ? " :: " + this.message : "");
}
/**
* @description Returns a string which is the concatenation of the 'toString' call results of the current exception and the inner exceptions.
* Call this function without any arguments on the top exception of the exception chain.
*
* @param {TS.Exception} exception
* @param {boolean} isInner, Defaults to false
* @param {string} offset, A string which is used to indent inner exception messages. Default to 2 spaces.
*
* @returns {string}
*/
stackTrace(exception = this, isInner = false, offset = " ") {
let returnString;
returnString = "";
returnString += exception.toString();
if (exception.innerException != null) {
returnString += "\r\n" + offset + this.stackTrace(exception.innerException, true, offset + " ");
} //END if
return returnString;
}
} //END class
TS.Exception = Exception;
//********************************************************************************
// AmbiguousResult exception
//********************************************************************************
/**
* @class TS.AmbiguousResultException
*
* @extends {TS.Exception}
*
* @description This exception signals a an error where an operation which is specified to deliver a single result
* fails because there are multiple possible results available.
*/
class AmbiguousResultException extends TS.Exception {
/**
* @constructor
*
* @param {string} argumentName, The name of the argument which caused the exception.
* @param {any} argumentValue, The value of the argument which caused the exception.
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(argumentName, argumentValue, message, innerException) {
super(message, innerException);
this.internalArgumentName = (argumentName) ? argumentName : "";
this.internalArgumentValue = argumentValue;
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.AmbiguousResultException";
}
/**
* @description The name of the argument which caused the exception.
*
* @get {string} argumentName
*/
get argumentName() {
return this.internalArgumentName;
}
/**
* @description The value of the argument which caused the exception.
*
* @get {any} argumentValue
*/
get argumentValue() {
return this.internalArgumentValue;
}
} //END class
TS.AmbiguousResultException = AmbiguousResultException;
//********************************************************************************
// Argument exception
//********************************************************************************
/**
* @class TS.ArgumentException
*
* @extends {TS.Exception}
*
* @description This exceptions signals a general error caused by an invalid argument.
*/
class ArgumentException extends TS.Exception {
/**
* @constructor
*
* @param {string} argumentName, The name of the argument which caused the exception.
* @param {any} argumentValue, The value of the argument which caused the exception.
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(argumentName, argumentValue, message, innerException) {
super(message, innerException);
this.internalArgumentName = (argumentName) ? argumentName : "";
this.internalArgumentValue = argumentValue;
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.ArgumentException";
}
/**
* @description The name of the argument which caused the exception.
*
* @get {string} argumentName
*/
get argumentName() {
return this.internalArgumentName;
}
/**
* @description The value of the argument which caused the exception.
*
* @get {any} argumentValue
*/
get argumentValue() {
return this.internalArgumentValue;
}
} //END class
TS.ArgumentException = ArgumentException;
/**
* @class TS.ArgumentNullException
*
* @extends {TS.ArgumentException}
*
* @description This exception signals an error caused by an unexpected null value in an argument.
*/
class ArgumentNullException extends TS.ArgumentException {
/**
* @constructor
*
* @param {string} argumentName, The name of the argument which caused the exception.
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(argumentName, message = "", innerException) {
super(message, null, message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.ArgumentNullException";
}
} //END class
TS.ArgumentNullException = ArgumentNullException;
/**
* @class TS.ArgumentNullOrUndefinedException
*
* @extends {TS.ArgumentException}
*
* @description This exceptions signals an error caused by an unexpected undefined or null value in an argument. The
* argument value of that exception will always be null and doesn't reflect the exact argument value which caused
* this exception.
*/
class ArgumentNullOrUndefinedException extends TS.ArgumentException {
/**
* @constructor
*
* @param {string} argumentName, The name of the argument which caused the exception.
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(argumentName, message = "", innerException) {
super(message, null, message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.ArgumentNullOrUndefinedException";
}
} //END class
TS.ArgumentNullOrUndefinedException = ArgumentNullOrUndefinedException;
/**
* @class TS.ArgumentNullUndefOrEmptyException
*
* @extends {TS.ArgumentException}
*
* @description This exception signals an error caused by an unexpected undefined or null value in an argument or
* an unexpected emptiness for an argument like an empty string or array. The argument value of that exception
* will always be null and doesn't reflect the exact argument value which caused this exception.
*/
class ArgumentNullUndefOrEmptyException extends TS.ArgumentException {
/**
* @constructor
*
* @param {string} argumentName, The name of the argument which caused the exception.
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(argumentName, message, innerException) {
super(argumentName, null, message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.ArgumentNullUndefOrEmptyException";
}
} //END class
TS.ArgumentNullUndefOrEmptyException = ArgumentNullUndefOrEmptyException;
/**
* @class TS.ArgumentNullUndefOrWhiteSpaceException
*
* @extends {TS.ArgumentException}
*
* @description This exceptions signals an unexpected emptiness of a string. The argument value of that exception
* will always be null and doesn't reflect the exact argument value which caused this exception.
*/
class ArgumentNullUndefOrWhiteSpaceException extends TS.ArgumentException {
/**
* @constructor
*
* @param {string} argumentName, The name of the argument which caused the exception.
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(argumentName, message, innerException) {
super(argumentName, null, message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.ArgumentNullUndefOrWhiteSpaceException";
}
} //END class
TS.ArgumentNullUndefOrWhiteSpaceException = ArgumentNullUndefOrWhiteSpaceException;
/**
* @class TS.ArgumentOutOfRangeException
*
* @extends {TS.ArgumentException}
*
* @description This exceptions signals that an argument exceeded the range of allowed values.
*/
class ArgumentOutOfRangeException extends TS.ArgumentException {
/**
* @constructor
*
* @param {string} argumentName, The name of the argument which caused the exception.
* @param {any} argumentValue, The value of the argument which caused the exception.
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(argumentName, argumentValue, message, innerException) {
super(argumentName, argumentValue, message, innerException);
}
/**
* @override {TS.ArgumentException}
*
* @get {string} type
*/
get type() {
return "TS.ArgumentOutOfRangeException";
}
} //END class
TS.ArgumentOutOfRangeException = ArgumentOutOfRangeException;
/**
* @class TS.ArgumentUndefinedException
*
* @extends {TS.ArgumentException}
*
* @description This exceptions signals an error caused by an unexpected undefined value in an argument.
*/
class ArgumentUndefinedException extends TS.ArgumentException {
/**
* @constructor
*
* @param {string} argumentName, The name of the argument which caused the exception.
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(argumentName, message, innerException) {
super(argumentName, undefined, message, innerException);
}
/**
* @override {TS.ArgumentException}
*
* @get {string} type
*/
get type() {
return "TS.ArgumentUndefinedException";
}
} //END class
TS.ArgumentUndefinedException = ArgumentUndefinedException;
//********************************************************************************
// Index exceptions
//********************************************************************************
/**
* @class TS.IndexOutOfRangeException
*
* @extends {TS.Exception}
*
* @description This exceptions signals that an index value exceeded the range of indexable elements.
*/
class IndexOutOfRangeException extends TS.Exception {
/**
* @constructor
*
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(message, innerException) {
super(message, innerException);
}
/**
* @public
*
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.IndexOutOfRangeException";
}
} //END class
TS.IndexOutOfRangeException = IndexOutOfRangeException;
//********************************************************************************
// Invalid invocation exceptions
//********************************************************************************
/**
* @class TS.InvalidInvokationException
*
* @extends {TS.Exception}
*
* @description This exceptions signals that a function was invoked in an unexpected or invalid way.
*/
class InvalidInvokationException extends TS.Exception {
/**
* @constructor
*
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(message, innerException) {
super(message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.InvalidInvokationException";
}
} //END class
TS.InvalidInvokationException = InvalidInvokationException;
//********************************************************************************
// Invalid operation exceptions
//********************************************************************************
/**
* @class TS.InvalidOperationException
*
* @extends {TS.Exception}
*
* @description This exceptions signals an attempt to start an operation which was not allowed to start in the current
* situation.
*/
class InvalidOperationException extends TS.Exception {
/**
* @constructor
*
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(message, innerException) {
super(message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.InvalidOperationException";
}
} //END class
TS.InvalidOperationException = InvalidOperationException;
//********************************************************************************
// Invalid cast exception
//********************************************************************************
/**
* @class TS.InvalidCastException
*
* @extends {TS.Exception}
*
* @description This exceptions signals that a casting operation failed.
*/
class InvalidCastException extends TS.Exception {
/**
* @constructor
*
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(message, innerException) {
super(message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.InvalidCastException";
}
} //END class
TS.InvalidCastException = InvalidCastException;
//********************************************************************************
// Invalid format exception
//********************************************************************************
/**
* @class TS.InvalidFormatException
*
* @extends {TS.Exception}
*
* @description This exceptions signals that an operation failed because of an invalid format of some data.
*/
class InvalidFormatException extends TS.Exception {
/**
* @constructor
*
* @param {string} argumentName, The name of the argument which caused the exception.
* @param {any} argumentValue, The value of the argument which caused the exception.
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(argumentName = "", argumentValue = "", message, innerException) {
super(message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.InvalidFormatException";
}
/**
* @description The name of the argument which caused the exception.
*
* @get {string} argumentName
*/
get argumentName() {
return this.internalArgumentName;
}
/**
* @description The value of the argument which caused the exception.
*
* @get {string} argumentValue
*/
get argumentValue() {
return this.internalArgumentValue;
}
} //END class
TS.InvalidFormatException = InvalidFormatException;
//********************************************************************************
// Invalid type exception
//********************************************************************************
/**
* @class TS.InvalidTypeException
*
* @extends {TS.Exception}
*
* @description This exceptions signals that an argument has an invalid type.
*/
class InvalidTypeException extends TS.Exception {
/**
* @constructor
*
* @param {string} argumentName, The name of the argument which caused the exception.
* @param {any} argumentValue, The value of the argument which caused the exception.
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(argumentName = "", argumentValue = "", message, innerException) {
super(message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.InvalidTypeException";
}
/**
* @description The name of the argument which caused the exception.
*
* @get {string} argumentName
*/
get argumentName() {
return this.internalArgumentName;
}
/**
* @description The value of the argument which caused the exception.
*
* @get {string} argumentValue
*/
get argumentValue() {
return this.internalArgumentValue;
}
} //END class
TS.InvalidTypeException = InvalidTypeException;
//********************************************************************************
// ArithmeticException
//********************************************************************************
/**
* @class TS.ArithmeticException
*
* @extends {TS.Exception}
*
* @description This exception signals an errors in an arithmetic, casting, or conversion operation.
* ArithmeticException is the base class for DivideByZeroException, NotFiniteNumberException, and OverflowException.
* Use one of the derived classes of ArithmeticException if appropriate to the exact nature of the error.
* Throw an ArithmeticException if there is no appropriate subclass to describe the nature of the error.
*/
class ArithmeticException extends TS.Exception {
/**
* @constructor
*
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(message, innerException) {
super(message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.ArithmeticException";
}
} //END class
TS.ArithmeticException = ArithmeticException;
/**
* @class TS.OverflowException
*
* @extends {TS.ArithmeticException}
*
* @description This exception signals that an arithmetic, casting, or conversion operation results in an overflow.
*/
class OverflowException extends ArithmeticException {
/**
* @constructor
*
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(message, innerException) {
super(message, innerException);
}
/**
* @override {TS.ArithmeticException}
*
* @get {string} type
*/
get type() {
return "TS.OverflowException";
}
} //END class
TS.OverflowException = OverflowException;
/**
* @class TS.DividedByZeroException
*
* @extends {TS.ArithmeticException}
*
* @description This exception signals an attempt to divide a number value by zero.
*/
class DividedByZeroException extends ArithmeticException {
/**
* @constructor
*
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(message, innerException) {
super(message, innerException);
}
/**
* @override {TS.ArithmeticException}
*
* @get {string} type
*/
get type() {
return "TS.DividedByZeroException";
}
} //END class
TS.DividedByZeroException = DividedByZeroException;
/**
* @class TS.NotFiniteNumberException
*
* @extends {TS.ArithmeticException}
*
* @description This exception signals an attempt to execute an arithmetic operation with a number value which is
* either infinite or Not-a-Number (NaN).
*/
class NotFiniteNumberException extends ArithmeticException {
/**
* @constructor
*
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(message, innerException) {
super(message, innerException);
}
/**
* @override {TS.ArithmeticException}
*
* @get {string} type
*/
get type() {
return "TS.NotFiniteNumberException";
}
} //END class
TS.NotFiniteNumberException = NotFiniteNumberException;
//********************************************************************************
// Infrastructure Exceptions
//********************************************************************************
/**
* @class TS.NotImplementedException
*
* @extends {TS.Exception}
*
* @description This exception signals that a function or class is not or not fully implemented and can't be used.
*/
class NotImplementedException extends TS.Exception {
/**
* @constructor
*
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(message, innerException) {
super(message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.NotImplementedException";
}
}
TS.NotImplementedException = NotImplementedException;
/**
* @class TS.DeprecatedException
*
* @extends {TS.Exception}
*
* @description This exception signals that a function or class should not longer be used.
*/
class DeprecatedException extends TS.Exception {
/**
* @constructor
*
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(message, innerException) {
super(message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.DeprecatedException";
}
}
TS.DeprecatedException = DeprecatedException;
//********************************************************************************
// File and directory exceptions
//********************************************************************************
/**
* @class TS.DirectoryNotFoundException
*
* @extends {TS.Exception}
*
* @description This exception signals if the file system is not able to locate the requested directory.
*/
class DirectoryNotFoundException extends TS.Exception {
/**
* @constructor
*
* @param {string} argumentName, The name of the argument which caused the exception. Typically the name of a directory variable.
* @param {any} argumentValue, The value of the argument which caused the exception. Typically the value of a directory variable.
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(argumentName = "", argumentValue = "", message, innerException) {
super(message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.DirectoryNotFoundException";
}
/**
* @description The name of the argument which caused the exception.
*
* @get {string} argumentName
*/
get argumentName() {
return this.internalArgumentName;
}
/**
* @description The value of the argument which caused the exception.
*
* @get {string} argumentValue
*/
get argumentValue() {
return this.internalArgumentValue;
}
}
TS.DirectoryNotFoundException = DirectoryNotFoundException;
//********************************************************************************
// IO exceptions
//********************************************************************************
/**
* @class TS.BufferOverrunException
*
* @extends {TS.Exception}
*
* @description This exception signals if the file system is not able to locate the requested directory.
*/
class BufferOverrunException extends TS.Exception {
/**
* @constructor
*
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(message, innerException) {
super(message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.BufferOverrunException";
}
}
TS.BufferOverrunException = BufferOverrunException;
//********************************************************************************
// Environment exceptions
//********************************************************************************
/**
* @class TS.EnvironmentNotSupportedException
*
* @extends {TS.Exception}
*
* @description This exception that some operation failed because the current environment is not supported. That may
* be the reason if a JavaScript VM lacks some functions, a Node.js script is running in a browser or vice versa or
* the operation system is not supported.
*/
class EnvironmentNotSupportedException extends TS.Exception {
/**
* @constructor
*
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(message, innerException) {
super(message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.EnvironmentNotSupportedException";
}
}
TS.EnvironmentNotSupportedException = EnvironmentNotSupportedException;
//********************************************************************************
// Timing exceptions
//********************************************************************************
/**
* @class TS.TimeoutException
*
* @extends {TS.Exception}
*
* @description This exception if thrown if a function or operation doesn't response in a timely manner.
*/
class TimeoutException extends TS.Exception {
/**
* @constructor
*
* @param {string} message?, An optional message string.
* @param {Exception} innerException?, An optional inner exception.
*/
constructor(message, innerException) {
super(message, innerException);
}
/**
* @override {TS.Exception}
*
* @get {string} type
*/
get type() {
return "TS.TimeoutException";
}
}
TS.TimeoutException = TimeoutException;
})(TS || (TS = {})); //END namespace
/// <reference path="../_references.ts" />
var TS;
(function (TS) {
/**
* @description The module 'Utils' combines some functions which offer solutions for common problems or
* reoccurring tasks which are not class specific. Since they are not class specific, they are also not part of a
* class. They are simply collected in this file and are part of the namespace. You can consider all of this
* functions as static if you like, because you can call them without a prior instantiation of an object.
*/
var Utils;
(function (Utils) {
/**
* @enum NodeTypeEnum,
*
* @description This enum is nothing more than a shorthand reference to the node types as defined in
* Node.prototype. See also the description at MDN.
*
* @see {@link https://developer.mozilla.org/en/docs/Web/API/Node/nodeType | MDN}
*/
var NodeTypeEnum;
(function (NodeTypeEnum) {
/**
* @description An Element node such as <p> or <div>
*/
NodeTypeEnum[NodeTypeEnum["ELEMENT_NODE"] = Node.prototype.ELEMENT_NODE] = "ELEMENT_NODE";
/**
* @description The actual Text of Element or Attr
*/
NodeTypeEnum[NodeTypeEnum["TEXT_NODE"] = Node.prototype.TEXT_NODE] = "TEXT_NODE";
/**
* @description A ProcessingInstruction of an XML document such as <?xml-stylesheet ... ?> declaration
*/
NodeTypeEnum[NodeTypeEnum["PROCESSING_INSTRUCTION_NODE"] = Node.prototype.PROCESSING_INSTRUCTION_NODE] = "PROCESSING_INSTRUCTION_NODE";
/**
* @description A Comment node
*/
NodeTypeEnum[NodeTypeEnum["COMMENT_NODE"] = Node.prototype.COMMENT_NODE] = "COMMENT_NODE";
/**
* @description A Document node
*/
NodeTypeEnum[NodeTypeEnum["DOCUMENT_NODE"] = Node.prototype.DOCUMENT_NODE] = "DOCUMENT_NODE";
/**
* @description A DocumentType node e.g. <!DOCTYPE html> for HTML5 documents
*/
NodeTypeEnum[NodeTypeEnum["DOCUMENT_TYPE_NODE"] = Node.prototype.DOCUMENT_TYPE_NODE] = "DOCUMENT_TYPE_NODE";
/**
* @description A DocumentFragment node
*/
NodeTypeEnum[NodeTypeEnum["DOCUMENT_FRAGMENT_NODE"] = Node.prototype.DOCUMENT_FRAGMENT_NODE] = "DOCUMENT_FRAGMENT_NODE";
/**
* @description An Attribute of an Element.
*
* @deprecated The element attributes are no longer implementing the Node interface in DOM4 specification
*/
NodeTypeEnum[NodeTypeEnum["ATTRIBUTE_NODE"] = Node.prototype.ATTRIBUTE_NODE] = "ATTRIBUTE_NODE";
/**
* @description A CDATASection.
*
* @deprecated Removed in DOM4 specification
*/
NodeTypeEnum[NodeTypeEnum["CDATA_SECTION_NODE"] = Node.prototype.CDATA_SECTION_NODE] = "CDATA_SECTION_NODE";
/**
* @description An XML Entity Reference node.
*
* @deprecated Removed in DOM4 specification
*/
NodeTypeEnum[NodeTypeEnum["ENTITY_REFERENCE_NODE"] = Node.prototype.ENTITY_REFERENCE_NODE] = "ENTITY_REFERENCE_NODE";
/**
* @description An XML <!ENTITY ...> node.
*
* @deprecated Removed in DOM4 specification
*/
NodeTypeEnum[NodeTypeEnum["ENTITY_NODE"] = Node.prototype.ENTITY_NODE] = "ENTITY_NODE";
/**
* @description An XML <!NOTATION ...> node.
*
* @deprecated Removed in DOM4 specification
*/
NodeTypeEnum[NodeTypeEnum["NOTATION_NODE"] = Node.prototype.NOTATION_NODE] = "NOTATION_NODE";
})(NodeTypeEnum = Utils.NodeTypeEnum || (Utils.NodeTypeEnum = {}));
/**
* @description An array of TS.Utils.ICurrency objects, as defined in ISO 4217
*
* @see {@link http://www.iso.org/iso/home/standards/currency_codes.htm | ISO}
* @see {TS.Utils.ICurrency}
*/
Utils.currencyArray = new Array({ Name: "United Arab Emirates Dirham", Code: "AED", Symbol: "" }, { Name: "Afghanistan Afghani", Code: "AFN", Symbol: "؋" }, { Name: "Albania Lek", Code: "ALL", Symbol: "" }, { Name: "Armenia Dram", Code: "AMD", Symbol: "" }, { Name: "Netherlands Antilles Guilder", Code: "ANG", Symbol: "ƒ" }, { Name: "Angola Kwanza", Code: "AOA", Symbol: "" }, { Name: "Argentina Peso", Code: "ARS", Symbol: "$" }, { Name: "Australia Dollar", Code: "AUD", Symbol: "$" }, { Name: "Aruba Guilder", Code: "AWG", Symbol: "ƒ" }, { Name: "Azerbaijan New Manat", Code: "AZN", Symbol: "ман" }, { Name: "Bosnia and Herzegovina Convertible Marka", Code: "BAM", Symbol: "KM" }, { Name: "Barbados Dollar", Code: "BBD", Symbol: "$" }, { Name: "Bangladesh Taka", Code: "BDT", Symbol: "" }, { Name: "Bulgaria Lev", Code: "BGN", Symbol: "лв" }, { Name: "Bahrain Dinar", Code: "BHD", Symbol: "" }, { Name: "Burundi Franc", Code: "BIF", Symbol: "" }, { Name: "Bermuda Dollar", Code: "BMD", Symbol: "$" }, { Name: "Brunei Darussalam Dollar", Code: "BND", Symbol: "$" }, { Name: "Bolivia Bolíviano", Code: "BOB", Symbol: "$b" }, { Name: "Brazil Real", Code: "BRL", Symbol: "R$" }, { Name: "Bahamas Dollar", Code: "BSD", Symbol: "$" }, { Name: "Bhutan Ngultrum", Code: "BTN", Symbol: "" }, { Name: "Botswana Pula", Code: "BWP", Symbol: "P" }, { Name: "Belarus Ruble", Code: "BYR", Symbol: "p." }, { Name: "Belize Dollar", Code: "BZD", Symbol: "BZ$" }, { Name: "Canada Dollar", Code: "CAD", Symbol: "$" }, { Name: "Congo/Kinshasa Franc", Code: "CDF", Symbol: "" }, { Name: "Switzerland Franc", Code: "CHF", Symbol: "CHF" }, { Name: "Chile Peso", Code: "CLP", Symbol: "$" }, { Name: "China Yuan Renminbi", Code: "CNY", Symbol: "¥" }, { Name: "Colombia Peso", Code: "COP", Symbol: "" }, { Name: "Costa Rica Colon", Code: "CRC", Symbol: "₡" }, { Name: "Cuba Convertible Peso", Code: "CUC", Symbol: "" }, { Name: "Cuba Peso", Code: "CUP", Symbol: "₱" }, { Name: "Cape Verde Escudo", Code: "CVE", Symbol: "" }, { Name: "Czech Republic Koruna", Code: "CZK", Symbol: "Kč" }, { Name: "Djibouti Franc", Code: "DJF", Symbol: "" }, { Name: "Denmark Krone", Code: "DKK", Symbol: "kr" }, { Name: "Dominican Republic Peso", Code: "DOP", Symbol: "RD$" }, { Name: "Algeria Dinar", Code: "DZD", Symbol: "" }, { Name: "Egypt Pound", Code: "EGP", Symbol: "£" }, { Name: "Eritrea Nakfa", Code: "ERN", Symbol: "" }, { Name: "Ethiopia Birr", Code: "ETB", Symbol: "" }, { Name: "European Union Euro", Code: "EUR", Symbol: "€" }, { Name: "Fiji Dollar", Code: "FJD", Symbol: "$" }, { Name: "Falkland Islands (Malvinas) Pound", Code: "FKP", Symbol: "£" }, { Name: "United Kingdom Pound", Code: "GBP", Symbol: "£" }, { Name: "Georgia Lari", Code: "GEL", Symbol: "" }, { Name: "Guernsey Pound", Code: "GGP", Symbol: "£" }, { Name: "Ghana Cedi", Code: "GHS", Symbol: "¢" }, { Name: "Gibraltar Pound", Code: "GIP", Symbol: "£" }, { Name: "Gambia Dalasi", Code: "GMD", Symbol: "" }, { Name: "Guinea Franc", Code: "GNF", Symbol: "" }, { Name: "Guatemala Quetzal", Code: "GTQ", Symbol: "Q" }, { Name: "Guyana Dollar", Code: "GYD", Symbol: "$" }, { Name: "Hong Kong Dollar", Code: "HKD", Symbol: "$" }, { Name: "Honduras Lempira", Code: "HNL", Symbol: "L" }, { Name: "Croatia Kuna", Code: "HRK", Symbol: "kn" }, { Name: "Haiti Gourde", Code: "HTG", Symbol: "" }, { Name: "Hungary Forint", Code: "HUF", Symbol: "Ft" }, { Name: "Indonesia Rupiah", Code: "IDR", Symbol: "Rp" }, { Name: "Israel Shekel", Code: "ILS", Symbol: "₪" }, { Name: "Isle of Man Pound", Code: "IMP", Symbol: "£" }, { Name: "India Rupee", Code: "INR", Symbol: "" }, { Name: "Iraq Dinar", Code: "IQD", Symbol: "" }, { Name: "Iran Rial", Code: "IRR", Symbol: "﷼" }, { Name: "Iceland Krona", Code: "ISK", Symbol: "kr" }, { Name: "Jersey Pound", Code: "JEP", Symbol: "£" }, { Name: "Jamaica Dollar", Code: "JMD", Symbol: "J$" }, { Name: "Jordan Dinar", Code: "JOD", Symbol: "" }, { Name: "Japan Yen", Code: "JPY", Symbol: "¥" }, { Name: "Kenya Shilling", Code: "KES", Symbol: "" }, { Name: "Kyrgyzstan Som", Code: "KGS", Symbol: "лв" }, { Name: "Cambodia Riel", Code: "KHR", Symbol: "៛" }, { Name: "Comoros Franc", Code: "KMF", Symbol: "" }, { Name: "Korea (North) Won", Code: "KPW", Symbol: "₩" }, { Name: "Korea (South) Won", Code: "KRW", Symbol: "₩" }, { Name: "Kuwait Dinar", Code: "KWD", Symbol: "" }, { Name: "Cayman Islands Dollar", Code: "KYD", Symbol: "$" }, { Name: "Kazakhstan Tenge", Code: "KZT", Symbol: "лв" }, { Name: "Laos Kip", Code: "LAK", Symbol: "₭" }, { Name: "Lebanon Pound", Code: "LBP", Symbol: "£" }, { Name: "Sri Lanka Rupee", Code: "LKR", Symbol: "₨" }, { Name: "Liberia Dollar", Code: "LRD", Symbol: "$" }, { Name: "Lesotho Loti", Code: "LSL", Symbol: "" }, { Name: "Libya Dinar", Code: "LYD", Symbol: "" }, { Name: "Morocco Dirham", Code: "MAD", Symbol: "" }, { Name: "Moldova Leu", Code: "MDL", Symbol: "" }, { Name: "Madagascar Ariary", Code: "MGA", Symbol: "" }, { Name: "Macedonia Denar", Code: "MKD", Symbol: "ден" }, { Name: "Myanmar (Burma) Kyat", Code: "MMK", Symbol: "" }, { Name: "Mongolia Tughrik", Code: "MNT", Symbol: "₮" }, { Name: "Macau Pataca", Code: "MOP", Symbol: "" }, { Name: "Mauritania Ouguiya", Code: "MRO", Symbol: "" }, { Name: "Mauritius Rupee", Code: "MUR", Symbol: "₨" }, { Name: "Maldives (Maldive Islands) Rufiyaa", Code: "MVR", Symbol: "" }, { Name: "Malawi Kwacha", Code: "MWK", Symbol: "" }, { Name: "Mexico Peso", Code: "MXN", Symbol: "$" }, { Name: "Malaysia Ringgit", Code: "MYR", Symbol: "RM" }, { Name: "Mozambique Metical", Code: "MZN", Symbol: "MT" }, { Name: "Namibia Dollar", Code: "NAD", Symbol: "$" }, { Name: "Nigeria Naira", Code: "NGN", Symbol: "₦" }, { Name: "Nicaragua Cordoba", Code: "NIO", Symbol: "C$" }, { Name: "Norway Krone", Code: "NOK", Symbol: "kr" }, { Name: "Nepal Rupee", Code: "NPR", Symbol: "₨" }, { Name: "New Zealand Dollar", Code: "NZD", Symbol: "$" }, { Name: "Oman Rial", Code: "OMR", Symbol: "﷼" }, { Name: "Panama Balboa", Code: "PAB", Symbol: "B/." }, { Name: "Peru Sol", Code: "PEN", Symbol: "S/." }, { Name: "Papua New Guinea Kina", Code: "PGK", Symbol: "" }, { Name: "Philippines Peso", Code: "PHP", Symbol: "₱" }, { Name: "Pakistan Rupee", Code: "PKR", Symbol: "₨" }, { Name: "Poland Zloty", Code: "PLN", Symbol: "zł" }, { Name: "Paraguay Guarani", Code: "PYG", Symbol: "Gs" }, { Name: "Qatar Riyal", Code: "QAR", Symbol: "﷼" }, { Name: "Romania New Leu", Code: "RON", Symbol: "lei" }, { Name: "Serbia Dinar", Code: "RSD", Symbol: "Дин." }, { Name: "Russia Ruble", Code: "RUB", Symbol: "руб" }, { Name: "Rwanda Franc", Code: "RWF", Symbol: "" }, { Name: "Saudi Arabia Riyal", Code: "SAR", Symbol: "﷼" }, { Name: "Solomon Islands Dollar", Code: "SBD", Symbol: "$" }, { Name: "Seychelles Rupee", Code: "SCR", Symbol: "₨" }, { Name: "Sudan Pound", Code: "SDG", Symbol: "" }, { Name: "Sweden Krona", Code: "SEK", Symbol: "kr" }, { Name: "Singapore Dollar", Code: "SGD", Symbol: "$" }, { Name: "Saint Helena Pound", Code: "SHP", Symbol: "£" }, { Name: "Sierra Leone Leone", Code: "SLL", Symbol: "" }, { Name: "Somalia Shilling", Code: "SOS", Symbol: "S" }, { Name: "Suriname Dollar", Code: "SRD", Symbol: "$" }, { Name: "São Tomé and Príncipe Dobra", Code: "STD", Symbol: "" }, { Name: "El Salvador Colon", Code: "SVC", Symbol: "$" }, { Name: "Syria Pound", Code: "SYP", Symbol: "£" }, { Name: "Swaziland Lilangeni", Code: "SZL", Symbol: "" }, { Name: "Thailand Baht", Code: "THB", Symbol: "฿" }, { Name: "Tajikistan Somoni", Code: "TJS", Symbol: "" }, { Name: "Turkmenistan Manat", Code: "TMT", Symbol: "" }, { Name: "Tunisia Dinar", Code: "TND", Symbol: "" }, { Name: "Tonga Pa'anga", Code: "TOP", Symbol: "" }, { Name: "Turkey Lira", Code: "TRY", Symbol: "" }, { Name: "Trinidad and Tobago Dollar", Code: "TTD", Symbol: "TT$" }, { Name: "Tuvalu Dollar", Code: "TVD", Symbol: "$" }, { Name: "Taiwan New Dollar", Code: "TWD", Symbol: "NT$" }, { Name: "Tanzania Shilling", Code: "TZS", Symbol: "" }, { Name: "Ukraine Hryvnia", Code: "UAH", Symbol: "₴" }, { Name: "Uganda Shilling", Code: "UGX", Symbol: "" }, { Name: "United States Dollar", Code: "USD", Symbol: "$" }, { Name: "Uruguay Peso", Code: "UYU", Symbol: "$U" }, { Name: "Uzbekistan Som", Code: "UZS", Symbol: "лв" }, { Name: "Venezuela Bolivar", Code: "VEF", Symbol: "Bs" }, { Name: "Viet Nam Dong", Code: "VND", Symbol: "₫" }, { Name: "Vanuatu Vatu", Code: "VUV", Symbol: "" }, { Name: "Samoa Tala", Code: "WST", Symbol: "" }, { Name: "Communauté Financière Africaine (BEAC) CFA Franc BEAC", Code: "XAF", Symbol: "" }, { Name: "East Caribbean Dollar", Code: "XCD", Symbol: "$" }, { Name: "International Monetary Fund (IMF) Special Drawing Rights", Code: "XDR", Symbol: "" }, { Name: "Communauté Financière Africaine (BCEAO) Franc", Code: "XOF", Symbol: "" }, { Name: "Comptoirs Français du Pacifique (CFP) Franc", Code: "XPF", Symbol: "" }, { Name: "Yemen Rial", Code: "YER", Symbol: "﷼" }, { Name: "South Africa Rand", Code: "ZAR", Symbol: "R" }, { Name: "Zambia Kwacha", Code: "ZMW", Symbol: "" }, { Name: "Zimbabwe Dollar", Code: "ZWD", Symbol: "Z$" });
/**
* @description Searches for all occurrences of 'searchString' in 'sourceString' and returns an array of the
* indexes where the search string occurred in the sourceString.
*
* @param {string} sourceString
* @param {string} searchString
*
* @returns {Array<number>}, An array of indexes where the searchString occurred in the sourceString.
*/