puzzle-lib 1.6.0 → 1.8.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.
Files changed (153) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +44 -38
  3. package/build/src/Braille/BrailleCharacter.d.ts +15 -15
  4. package/build/src/Braille/BrailleCharacter.js +39 -38
  5. package/build/src/Braille/BrailleCharacter.js.map +1 -1
  6. package/build/src/Braille/BrailleData.d.ts +6 -6
  7. package/build/src/Braille/BrailleData.js +65 -65
  8. package/build/src/Braille/BrailleData.js.map +1 -1
  9. package/build/src/Braille/BrailleDot.d.ts +9 -9
  10. package/build/src/Braille/BrailleDot.js +13 -13
  11. package/build/src/Braille/BrailleDot.js.map +1 -1
  12. package/build/src/Braille/BrailleEncoding.d.ts +54 -54
  13. package/build/src/Braille/BrailleEncoding.js +66 -65
  14. package/build/src/Braille/BrailleEncoding.js.map +1 -1
  15. package/build/src/Braille/BrailleStream.d.ts +18 -18
  16. package/build/src/Braille/BrailleStream.js +75 -75
  17. package/build/src/Braille/BrailleStream.js.map +1 -1
  18. package/build/src/Cipher/AutoKeyString.d.ts +4 -4
  19. package/build/src/Cipher/AutoKeyString.js +34 -34
  20. package/build/src/Cipher/AutoKeyString.js.map +1 -1
  21. package/build/src/Cipher/CaesarString.d.ts +8 -8
  22. package/build/src/Cipher/CaesarString.js +32 -31
  23. package/build/src/Cipher/CaesarString.js.map +1 -1
  24. package/build/src/Cipher/CaesarUtils.d.ts +13 -13
  25. package/build/src/Cipher/CaesarUtils.js +57 -57
  26. package/build/src/Cipher/CaesarUtils.js.map +1 -1
  27. package/build/src/Cipher/KeyedCipherStringBase.d.ts +12 -12
  28. package/build/src/Cipher/KeyedCipherStringBase.js +30 -28
  29. package/build/src/Cipher/KeyedCipherStringBase.js.map +1 -1
  30. package/build/src/Cipher/VigenereString.d.ts +4 -4
  31. package/build/src/Cipher/VigenereString.js +21 -21
  32. package/build/src/Cipher/VigenereString.js.map +1 -1
  33. package/build/src/Common/CharacterImage.d.ts +6 -6
  34. package/build/src/Common/CharacterImage.js +12 -10
  35. package/build/src/Common/CharacterImage.js.map +1 -1
  36. package/build/src/Common/EncodingCategory.d.ts +8 -8
  37. package/build/src/Common/EncodingCategory.js +12 -12
  38. package/build/src/Common/EncodingCategory.js.map +1 -1
  39. package/build/src/Common/EncodingCharacterBase.d.ts +23 -23
  40. package/build/src/Common/EncodingCharacterBase.js +54 -52
  41. package/build/src/Common/EncodingCharacterBase.js.map +1 -1
  42. package/build/src/Common/EncodingDataBase.d.ts +7 -7
  43. package/build/src/Common/EncodingDataBase.js +27 -29
  44. package/build/src/Common/EncodingDataBase.js.map +1 -1
  45. package/build/src/Common/EncodingEntry.d.ts +8 -8
  46. package/build/src/Common/EncodingEntry.js +17 -14
  47. package/build/src/Common/EncodingEntry.js.map +1 -1
  48. package/build/src/Common/EncodingLookupResult.d.ts +6 -6
  49. package/build/src/Common/EncodingLookupResult.js +11 -13
  50. package/build/src/Common/EncodingLookupResult.js.map +1 -1
  51. package/build/src/Common/Helpers.d.ts +4 -4
  52. package/build/src/Common/Helpers.js +16 -16
  53. package/build/src/Common/Helpers.js.map +1 -1
  54. package/build/src/Common/InlineSvg.d.ts +7 -7
  55. package/build/src/Common/InlineSvg.js +17 -14
  56. package/build/src/Common/InlineSvg.js.map +1 -1
  57. package/build/src/Conversion/CharacterAutoConvert.d.ts +10 -10
  58. package/build/src/Conversion/CharacterAutoConvert.js +88 -88
  59. package/build/src/Conversion/CharacterAutoConvert.js.map +1 -1
  60. package/build/src/Conversion/CharacterConversion.d.ts +8 -8
  61. package/build/src/Conversion/CharacterConversion.js +50 -50
  62. package/build/src/Conversion/CharacterConversion.js.map +1 -1
  63. package/build/src/Conversion/CharacterEncoding.d.ts +9 -9
  64. package/build/src/Conversion/CharacterEncoding.js +13 -13
  65. package/build/src/Conversion/CharacterEncoding.js.map +1 -1
  66. package/build/src/Conversion/CharacterTableEntry.d.ts +10 -10
  67. package/build/src/Conversion/CharacterTableEntry.js +25 -19
  68. package/build/src/Conversion/CharacterTableEntry.js.map +1 -1
  69. package/build/src/Conversion/SignificantFigures.d.ts +7 -7
  70. package/build/src/Conversion/SignificantFigures.js +50 -50
  71. package/build/src/Conversion/SignificantFigures.js.map +1 -1
  72. package/build/src/Conversion/StringAutoConvert.d.ts +6 -6
  73. package/build/src/Conversion/StringAutoConvert.js +46 -46
  74. package/build/src/Conversion/StringAutoConvert.js.map +1 -1
  75. package/build/src/Morse/MorseCharacter.d.ts +22 -22
  76. package/build/src/Morse/MorseCharacter.js +97 -96
  77. package/build/src/Morse/MorseCharacter.js.map +1 -1
  78. package/build/src/Morse/MorseData.d.ts +6 -6
  79. package/build/src/Morse/MorseData.js +70 -70
  80. package/build/src/Morse/MorseData.js.map +1 -1
  81. package/build/src/Morse/MorseEncoding.d.ts +59 -59
  82. package/build/src/Morse/MorseEncoding.js +94 -94
  83. package/build/src/Morse/MorseEncoding.js.map +1 -1
  84. package/build/src/Morse/MorseString.d.ts +10 -10
  85. package/build/src/Morse/MorseString.js +67 -66
  86. package/build/src/Morse/MorseString.js.map +1 -1
  87. package/build/src/Nato/NatoCharacter.d.ts +5 -5
  88. package/build/src/Nato/NatoCharacter.js +12 -10
  89. package/build/src/Nato/NatoCharacter.js.map +1 -1
  90. package/build/src/Nato/NatoData.d.ts +7 -7
  91. package/build/src/Nato/NatoData.js +49 -51
  92. package/build/src/Nato/NatoData.js.map +1 -1
  93. package/build/src/NavalFlags/NavalFlags.d.ts +7 -7
  94. package/build/src/NavalFlags/NavalFlags.js +75 -77
  95. package/build/src/NavalFlags/NavalFlags.js.map +1 -1
  96. package/build/src/Resistor/Resistor.d.ts +24 -24
  97. package/build/src/Resistor/Resistor.js +86 -86
  98. package/build/src/Resistor/Resistor.js.map +1 -1
  99. package/build/src/Resistor/ResistorColorEntry.d.ts +12 -12
  100. package/build/src/Resistor/ResistorColorEntry.js +36 -31
  101. package/build/src/Resistor/ResistorColorEntry.js.map +1 -1
  102. package/build/src/Semaphore/SemaphoreCharacter.d.ts +20 -20
  103. package/build/src/Semaphore/SemaphoreCharacter.js +75 -75
  104. package/build/src/Semaphore/SemaphoreCharacter.js.map +1 -1
  105. package/build/src/Semaphore/SemaphoreData.d.ts +6 -6
  106. package/build/src/Semaphore/SemaphoreData.js +53 -53
  107. package/build/src/Semaphore/SemaphoreData.js.map +1 -1
  108. package/build/src/Semaphore/SemaphoreDegrees.d.ts +5 -5
  109. package/build/src/Semaphore/SemaphoreDegrees.js +26 -26
  110. package/build/src/Semaphore/SemaphoreDegrees.js.map +1 -1
  111. package/build/src/Semaphore/SemaphoreDirection.d.ts +11 -11
  112. package/build/src/Semaphore/SemaphoreDirection.js +15 -15
  113. package/build/src/Semaphore/SemaphoreDirection.js.map +1 -1
  114. package/build/src/Semaphore/SemaphoreEncoding.d.ts +40 -40
  115. package/build/src/Semaphore/SemaphoreEncoding.js +48 -47
  116. package/build/src/Semaphore/SemaphoreEncoding.js.map +1 -1
  117. package/build/src/Semaphore/SemaphoreStream.d.ts +17 -17
  118. package/build/src/Semaphore/SemaphoreStream.js +73 -72
  119. package/build/src/Semaphore/SemaphoreStream.js.map +1 -1
  120. package/build/src/WordSearch/Point.d.ts +4 -4
  121. package/build/src/WordSearch/Point.js +2 -2
  122. package/build/src/WordSearch/Result.d.ts +6 -6
  123. package/build/src/WordSearch/Result.js +12 -10
  124. package/build/src/WordSearch/Result.js.map +1 -1
  125. package/build/src/WordSearch/WordSearchDirection.d.ts +6 -6
  126. package/build/src/WordSearch/WordSearchDirection.js +10 -10
  127. package/build/src/WordSearch/WordSearchDirection.js.map +1 -1
  128. package/build/src/WordSearch/WordSearchSolver.d.ts +27 -27
  129. package/build/src/WordSearch/WordSearchSolver.js +232 -222
  130. package/build/src/WordSearch/WordSearchSolver.js.map +1 -1
  131. package/build/src/index.d.ts +35 -35
  132. package/build/src/index.js +72 -72
  133. package/package.json +40 -40
  134. package/src/Braille/BrailleCharacter.ts +1 -1
  135. package/src/Braille/BrailleData.ts +16 -16
  136. package/src/Cipher/AutoKeyString.ts +1 -1
  137. package/src/Cipher/CaesarUtils.ts +1 -1
  138. package/src/Cipher/VigenereString.ts +1 -1
  139. package/src/Common/EncodingDataBase.ts +1 -1
  140. package/src/Conversion/CharacterAutoConvert.ts +1 -1
  141. package/src/Conversion/CharacterConversion.ts +5 -5
  142. package/src/Conversion/SignificantFigures.ts +1 -1
  143. package/src/Conversion/StringAutoConvert.ts +2 -2
  144. package/src/Morse/MorseData.ts +18 -18
  145. package/src/Morse/MorseString.ts +12 -12
  146. package/src/Nato/NatoData.ts +1 -1
  147. package/src/NavalFlags/LICENSE +6 -6
  148. package/src/NavalFlags/NavalFlags.ts +52 -52
  149. package/src/Resistor/Resistor.ts +9 -9
  150. package/src/Resistor/ResistorColorEntry.ts +1 -1
  151. package/src/Semaphore/SemaphoreCharacter.ts +5 -5
  152. package/src/Semaphore/SemaphoreData.ts +1 -1
  153. package/src/WordSearch/WordSearchSolver.ts +1 -1
@@ -1,24 +1,24 @@
1
- import { ResistorColorEntry } from './ResistorColorEntry';
2
- export declare class Resistor {
3
- static readonly BLACK: ResistorColorEntry;
4
- static readonly BROWN: ResistorColorEntry;
5
- static readonly RED: ResistorColorEntry;
6
- static readonly ORANGE: ResistorColorEntry;
7
- static readonly YELLOW: ResistorColorEntry;
8
- static readonly GREEN: ResistorColorEntry;
9
- static readonly BLUE: ResistorColorEntry;
10
- static readonly VIOLET: ResistorColorEntry;
11
- static readonly GREY: ResistorColorEntry;
12
- static readonly WHITE: ResistorColorEntry;
13
- static readonly GOLD: ResistorColorEntry;
14
- static readonly SILVER: ResistorColorEntry;
15
- static readonly colorTable: ResistorColorEntry[];
16
- static readonly INVALID_RESISTOR = -1;
17
- /**
18
- * getValue assumes there is no tolerance band, as tolerance is not part of
19
- * the value calculation
20
- */
21
- static getValue(colors: ResistorColorEntry[]): number;
22
- static getDisplayValue(value: number): string;
23
- private static applyMultiplier;
24
- }
1
+ import { ResistorColorEntry } from './ResistorColorEntry';
2
+ export declare class Resistor {
3
+ static readonly BLACK: ResistorColorEntry;
4
+ static readonly BROWN: ResistorColorEntry;
5
+ static readonly RED: ResistorColorEntry;
6
+ static readonly ORANGE: ResistorColorEntry;
7
+ static readonly YELLOW: ResistorColorEntry;
8
+ static readonly GREEN: ResistorColorEntry;
9
+ static readonly BLUE: ResistorColorEntry;
10
+ static readonly VIOLET: ResistorColorEntry;
11
+ static readonly GREY: ResistorColorEntry;
12
+ static readonly WHITE: ResistorColorEntry;
13
+ static readonly GOLD: ResistorColorEntry;
14
+ static readonly SILVER: ResistorColorEntry;
15
+ static readonly colorTable: ResistorColorEntry[];
16
+ static readonly INVALID_RESISTOR = -1;
17
+ /**
18
+ * getValue assumes there is no tolerance band, as tolerance is not part of
19
+ * the value calculation
20
+ */
21
+ static getValue(colors: ResistorColorEntry[]): number;
22
+ static getDisplayValue(value: number): string;
23
+ private static applyMultiplier;
24
+ }
@@ -1,87 +1,87 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Resistor = void 0;
4
- const ResistorColorEntry_1 = require("./ResistorColorEntry");
5
- class Resistor {
6
- /**
7
- * getValue assumes there is no tolerance band, as tolerance is not part of
8
- * the value calculation
9
- */
10
- static getValue(colors) {
11
- if (colors.length < 3 || colors.length > 4) {
12
- throw new RangeError('Invalid resistor size');
13
- }
14
- // Should we throw an error if the first color is black? In resistors, it's
15
- // technically not allowed, but in puzzle events who knows what they'll do.
16
- // The math works out fine (it's just a leading zero), so for now it's
17
- // allowed.
18
- // Iterate through all but the final band (the multipler) and extract the
19
- // values
20
- let value = 0;
21
- for (let i = 0; i < colors.length - 1; ++i) {
22
- const currentColor = colors[i];
23
- if (currentColor.value === undefined) {
24
- return Resistor.INVALID_RESISTOR;
25
- }
26
- value *= 10;
27
- value += currentColor.value;
28
- }
29
- return Resistor.applyMultiplier(value, colors[colors.length - 1].multiplier);
30
- }
31
- static getDisplayValue(value) {
32
- if (value >= 1000000000) {
33
- return `${value / 1000000000}G`;
34
- }
35
- else if (value >= 1000000) {
36
- return `${value / 1000000}M`;
37
- }
38
- else if (value >= 1000) {
39
- return `${value / 1000}k`;
40
- }
41
- else {
42
- return value.toString();
43
- }
44
- }
45
- static applyMultiplier(value, multipler) {
46
- if (multipler >= 1) {
47
- return value * multipler;
48
- }
49
- else if (multipler > 0) {
50
- // Avoid floating point multiplication issues
51
- return value / (1 / multipler);
52
- }
53
- else {
54
- throw new RangeError('Invalid multiplier');
55
- }
56
- }
57
- }
58
- exports.Resistor = Resistor;
59
- // Name, Color, Multiplier, Value, Tolerance
60
- Resistor.BLACK = new ResistorColorEntry_1.ResistorColorEntry('Black', '#000000', 1, 0);
61
- Resistor.BROWN = new ResistorColorEntry_1.ResistorColorEntry('Brown', '#8B4513', 10, 1, 1);
62
- Resistor.RED = new ResistorColorEntry_1.ResistorColorEntry('Red', '#FF0000', 100, 2, 2);
63
- Resistor.ORANGE = new ResistorColorEntry_1.ResistorColorEntry('Orange', '#EE7420', 1000, 3);
64
- Resistor.YELLOW = new ResistorColorEntry_1.ResistorColorEntry('Yellow', '#FFFF00', 10000, 4);
65
- Resistor.GREEN = new ResistorColorEntry_1.ResistorColorEntry('Green', '#008000', 100000, 5, 0.5);
66
- Resistor.BLUE = new ResistorColorEntry_1.ResistorColorEntry('Blue', '#0000FF', 1000000, 6, 0.25);
67
- Resistor.VIOLET = new ResistorColorEntry_1.ResistorColorEntry('Violet', '#800080', 10000000, 7, 0.1);
68
- Resistor.GREY = new ResistorColorEntry_1.ResistorColorEntry('Grey', '#808080', 100000000, 8);
69
- Resistor.WHITE = new ResistorColorEntry_1.ResistorColorEntry('White', '#FFFFFF', 1000000000, 9);
70
- Resistor.GOLD = new ResistorColorEntry_1.ResistorColorEntry('Gold', '#AB8D3F', 0.1, undefined, 5);
71
- Resistor.SILVER = new ResistorColorEntry_1.ResistorColorEntry('Silver', '#C0C0C0', 0.01, undefined, 10);
72
- Resistor.colorTable = [
73
- Resistor.BLACK,
74
- Resistor.BROWN,
75
- Resistor.RED,
76
- Resistor.ORANGE,
77
- Resistor.YELLOW,
78
- Resistor.GREEN,
79
- Resistor.BLUE,
80
- Resistor.VIOLET,
81
- Resistor.GREY,
82
- Resistor.WHITE,
83
- Resistor.GOLD,
84
- Resistor.SILVER,
85
- ];
86
- Resistor.INVALID_RESISTOR = -1;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Resistor = void 0;
4
+ const ResistorColorEntry_1 = require("./ResistorColorEntry");
5
+ class Resistor {
6
+ // Name, Color, Multiplier, Value, Tolerance
7
+ static BLACK = new ResistorColorEntry_1.ResistorColorEntry('Black', '#000000', 1, 0);
8
+ static BROWN = new ResistorColorEntry_1.ResistorColorEntry('Brown', '#8B4513', 10, 1, 1);
9
+ static RED = new ResistorColorEntry_1.ResistorColorEntry('Red', '#FF0000', 100, 2, 2);
10
+ static ORANGE = new ResistorColorEntry_1.ResistorColorEntry('Orange', '#EE7420', 1000, 3);
11
+ static YELLOW = new ResistorColorEntry_1.ResistorColorEntry('Yellow', '#FFFF00', 10000, 4);
12
+ static GREEN = new ResistorColorEntry_1.ResistorColorEntry('Green', '#008000', 100000, 5, 0.5);
13
+ static BLUE = new ResistorColorEntry_1.ResistorColorEntry('Blue', '#0000FF', 1000000, 6, 0.25);
14
+ static VIOLET = new ResistorColorEntry_1.ResistorColorEntry('Violet', '#800080', 10000000, 7, 0.1);
15
+ static GREY = new ResistorColorEntry_1.ResistorColorEntry('Grey', '#808080', 100000000, 8);
16
+ static WHITE = new ResistorColorEntry_1.ResistorColorEntry('White', '#FFFFFF', 1000000000, 9);
17
+ static GOLD = new ResistorColorEntry_1.ResistorColorEntry('Gold', '#AB8D3F', 0.1, undefined, 5);
18
+ static SILVER = new ResistorColorEntry_1.ResistorColorEntry('Silver', '#C0C0C0', 0.01, undefined, 10);
19
+ static colorTable = [
20
+ Resistor.BLACK,
21
+ Resistor.BROWN,
22
+ Resistor.RED,
23
+ Resistor.ORANGE,
24
+ Resistor.YELLOW,
25
+ Resistor.GREEN,
26
+ Resistor.BLUE,
27
+ Resistor.VIOLET,
28
+ Resistor.GREY,
29
+ Resistor.WHITE,
30
+ Resistor.GOLD,
31
+ Resistor.SILVER,
32
+ ];
33
+ static INVALID_RESISTOR = -1;
34
+ /**
35
+ * getValue assumes there is no tolerance band, as tolerance is not part of
36
+ * the value calculation
37
+ */
38
+ static getValue(colors) {
39
+ if (colors.length < 3 || colors.length > 4) {
40
+ throw new RangeError('Invalid resistor size');
41
+ }
42
+ // Should we throw an error if the first color is black? In resistors, it's
43
+ // technically not allowed, but in puzzle events who knows what they'll do.
44
+ // The math works out fine (it's just a leading zero), so for now it's
45
+ // allowed.
46
+ // Iterate through all but the final band (the multipler) and extract the
47
+ // values
48
+ let value = 0;
49
+ for (let i = 0; i < colors.length - 1; ++i) {
50
+ const currentColor = colors[i];
51
+ if (currentColor.value === undefined) {
52
+ return Resistor.INVALID_RESISTOR;
53
+ }
54
+ value *= 10;
55
+ value += currentColor.value;
56
+ }
57
+ return Resistor.applyMultiplier(value, colors[colors.length - 1].multiplier);
58
+ }
59
+ static getDisplayValue(value) {
60
+ if (value >= 1000000000) {
61
+ return `${value / 1000000000}G`;
62
+ }
63
+ else if (value >= 1000000) {
64
+ return `${value / 1000000}M`;
65
+ }
66
+ else if (value >= 1000) {
67
+ return `${value / 1000}k`;
68
+ }
69
+ else {
70
+ return value.toString();
71
+ }
72
+ }
73
+ static applyMultiplier(value, multipler) {
74
+ if (multipler >= 1) {
75
+ return value * multipler;
76
+ }
77
+ else if (multipler > 0) {
78
+ // Avoid floating point multiplication issues
79
+ return value / (1 / multipler);
80
+ }
81
+ else {
82
+ throw new RangeError('Invalid multiplier');
83
+ }
84
+ }
85
+ }
86
+ exports.Resistor = Resistor;
87
87
  //# sourceMappingURL=Resistor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Resistor.js","sourceRoot":"","sources":["../../../src/Resistor/Resistor.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AAC;IAEO,MAAM,CAAC,eAAe,CAAC,KAAa,EAAE,SAAiB;QAC7D,IAAI,SAAS,IAAI,CAAC,EAAE,CAAC;YACnB,OAAO,KAAK,GAAG,SAAS,CAAC;QAC3B,CAAC;aAAM,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YACzB,6CAA6C;YAC7C,OAAO,KAAK,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,UAAU,CAAC,oBAAoB,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;;AAnIH,4BAoIC"}
@@ -1,12 +1,12 @@
1
- export declare class ResistorColorEntry {
2
- readonly name: string;
3
- readonly colorCode: string;
4
- readonly multiplier: number;
5
- readonly value?: number;
6
- readonly toleranceInPercent?: number;
7
- constructor(name: string, colorCode: string, multiplier: number, value?: number, toleranceInPercent?: number);
8
- hasValue(): boolean;
9
- getDisplayValue(): string;
10
- hasTolerance(): boolean;
11
- getDisplayTolerance(): string;
12
- }
1
+ export declare class ResistorColorEntry {
2
+ readonly name: string;
3
+ readonly colorCode: string;
4
+ readonly multiplier: number;
5
+ readonly value?: number;
6
+ readonly toleranceInPercent?: number;
7
+ constructor(name: string, colorCode: string, multiplier: number, value?: number, toleranceInPercent?: number);
8
+ hasValue(): boolean;
9
+ getDisplayValue(): string;
10
+ hasTolerance(): boolean;
11
+ getDisplayTolerance(): string;
12
+ }
@@ -1,32 +1,37 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ResistorColorEntry = void 0;
4
- class ResistorColorEntry {
5
- constructor(name, colorCode, multiplier, value, toleranceInPercent) {
6
- this.name = name;
7
- this.value = value;
8
- this.colorCode = colorCode;
9
- this.multiplier = multiplier;
10
- this.toleranceInPercent = toleranceInPercent;
11
- }
12
- hasValue() {
13
- return this.value !== undefined;
14
- }
15
- getDisplayValue() {
16
- if (this.value === undefined) {
17
- return '';
18
- }
19
- return this.value.toString();
20
- }
21
- hasTolerance() {
22
- return this.toleranceInPercent !== undefined;
23
- }
24
- getDisplayTolerance() {
25
- if (this.toleranceInPercent === undefined) {
26
- return '';
27
- }
28
- return `${this.toleranceInPercent}%`;
29
- }
30
- }
31
- exports.ResistorColorEntry = ResistorColorEntry;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ResistorColorEntry = void 0;
4
+ class ResistorColorEntry {
5
+ name;
6
+ colorCode;
7
+ multiplier;
8
+ value;
9
+ toleranceInPercent;
10
+ constructor(name, colorCode, multiplier, value, toleranceInPercent) {
11
+ this.name = name;
12
+ this.value = value;
13
+ this.colorCode = colorCode;
14
+ this.multiplier = multiplier;
15
+ this.toleranceInPercent = toleranceInPercent;
16
+ }
17
+ hasValue() {
18
+ return this.value !== undefined;
19
+ }
20
+ getDisplayValue() {
21
+ if (this.value === undefined) {
22
+ return '';
23
+ }
24
+ return this.value.toString();
25
+ }
26
+ hasTolerance() {
27
+ return this.toleranceInPercent !== undefined;
28
+ }
29
+ getDisplayTolerance() {
30
+ if (this.toleranceInPercent === undefined) {
31
+ return '';
32
+ }
33
+ return `${this.toleranceInPercent}%`;
34
+ }
35
+ }
36
+ exports.ResistorColorEntry = ResistorColorEntry;
32
37
  //# sourceMappingURL=ResistorColorEntry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResistorColorEntry.js","sourceRoot":"","sources":["../../../src/Resistor/ResistorColorEntry.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAkB;IAO7B,YACE,IAAY,EACZ,SAAiB,EACjB,UAAkB,EAClB,KAAc,EACd,kBAA2B;QAE3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC/C,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC;IAClC,CAAC;IAED,eAAe;QACb,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;YAC5B,OAAO,EAAE,CAAC;SACX;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC/B,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,kBAAkB,KAAK,SAAS,CAAC;IAC/C,CAAC;IAED,mBAAmB;QACjB,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS,EAAE;YACzC,OAAO,EAAE,CAAC;SACX;QACD,OAAO,GAAG,IAAI,CAAC,kBAAkB,GAAG,CAAC;IACvC,CAAC;CACF;AA1CD,gDA0CC"}
1
+ {"version":3,"file":"ResistorColorEntry.js","sourceRoot":"","sources":["../../../src/Resistor/ResistorColorEntry.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAkB;IACpB,IAAI,CAAS;IACb,SAAS,CAAS;IAClB,UAAU,CAAS;IACnB,KAAK,CAAU;IACf,kBAAkB,CAAU;IAErC,YACE,IAAY,EACZ,SAAiB,EACjB,UAAkB,EAClB,KAAc,EACd,kBAA2B;QAE3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC/C,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC;IAClC,CAAC;IAED,eAAe;QACb,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC7B,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC/B,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,kBAAkB,KAAK,SAAS,CAAC;IAC/C,CAAC;IAED,mBAAmB;QACjB,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;YAC1C,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,OAAO,GAAG,IAAI,CAAC,kBAAkB,GAAG,CAAC;IACvC,CAAC;CACF;AA1CD,gDA0CC"}
@@ -1,20 +1,20 @@
1
- import { EncodingCategory } from '../Common/EncodingCategory';
2
- import { EncodingCharacterBase } from '../Common/EncodingCharacterBase';
3
- import { EncodingEntry } from '../Common/EncodingEntry';
4
- import { SemaphoreDirection } from './SemaphoreDirection';
5
- import { SemaphoreEncoding } from './SemaphoreEncoding';
6
- export declare class SemaphoreCharacter extends EncodingCharacterBase<SemaphoreEncoding> {
7
- private static parseEncoding;
8
- private _directions;
9
- constructor(encoding?: SemaphoreEncoding, category?: EncodingCategory);
10
- get directions(): SemaphoreDirection[];
11
- set directions(value: SemaphoreDirection[]);
12
- addDirection(direction: SemaphoreDirection | SemaphoreEncoding): void;
13
- removeDirection(direction: SemaphoreDirection | SemaphoreEncoding): void;
14
- hasDirection(direction: SemaphoreDirection): boolean;
15
- getDegrees(): number[];
16
- getPotentialMatch(other: SemaphoreDirection): EncodingEntry<SemaphoreEncoding> | null;
17
- protected onClear(): void;
18
- protected onEmpty(): boolean;
19
- protected getEncoding(): SemaphoreEncoding;
20
- }
1
+ import { EncodingCategory } from '../Common/EncodingCategory';
2
+ import { EncodingCharacterBase } from '../Common/EncodingCharacterBase';
3
+ import { EncodingEntry } from '../Common/EncodingEntry';
4
+ import { SemaphoreDirection } from './SemaphoreDirection';
5
+ import { SemaphoreEncoding } from './SemaphoreEncoding';
6
+ export declare class SemaphoreCharacter extends EncodingCharacterBase<SemaphoreEncoding> {
7
+ private static parseEncoding;
8
+ private _directions;
9
+ constructor(encoding?: SemaphoreEncoding, category?: EncodingCategory);
10
+ get directions(): SemaphoreDirection[];
11
+ set directions(value: SemaphoreDirection[]);
12
+ addDirection(direction: SemaphoreDirection | SemaphoreEncoding): void;
13
+ removeDirection(direction: SemaphoreDirection | SemaphoreEncoding): void;
14
+ hasDirection(direction: SemaphoreDirection): boolean;
15
+ getDegrees(): number[];
16
+ getPotentialMatch(other: SemaphoreDirection): EncodingEntry<SemaphoreEncoding> | null;
17
+ protected onClear(): void;
18
+ protected onEmpty(): boolean;
19
+ protected getEncoding(): number;
20
+ }
@@ -1,76 +1,76 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SemaphoreCharacter = void 0;
4
- const EncodingCategory_1 = require("../Common/EncodingCategory");
5
- const EncodingCharacterBase_1 = require("../Common/EncodingCharacterBase");
6
- const SemaphoreData_1 = require("./SemaphoreData");
7
- const SemaphoreDegrees_1 = require("./SemaphoreDegrees");
8
- const SemaphoreEncoding_1 = require("./SemaphoreEncoding");
9
- class SemaphoreCharacter extends EncodingCharacterBase_1.EncodingCharacterBase {
10
- constructor(encoding = SemaphoreEncoding_1.SemaphoreEncoding.None, category = EncodingCategory_1.EncodingCategory.All) {
11
- super(SemaphoreData_1.SemaphoreData.instance, category);
12
- this._directions = [];
13
- this.addDirection(encoding);
14
- }
15
- static parseEncoding(encoding) {
16
- const directions = [];
17
- for (let i = 1; i <= 8; i++) {
18
- const direction = (1 << i);
19
- if ((encoding & direction) === direction) {
20
- directions.push(direction);
21
- }
22
- }
23
- return directions;
24
- }
25
- get directions() {
26
- return this._directions;
27
- }
28
- set directions(value) {
29
- this._directions = value.slice(0, 2);
30
- this.invalidateLookup();
31
- }
32
- addDirection(direction) {
33
- for (const dir of SemaphoreCharacter.parseEncoding(direction)) {
34
- this._directions.push(dir);
35
- }
36
- if (this._directions.length > 2) {
37
- this._directions.splice(0, this._directions.length - 2);
38
- }
39
- this.invalidateLookup();
40
- }
41
- removeDirection(direction) {
42
- for (const dir of SemaphoreCharacter.parseEncoding(direction)) {
43
- const index = this._directions.indexOf(dir);
44
- if (index >= 0) {
45
- this._directions.splice(index, 1);
46
- }
47
- }
48
- this.invalidateLookup();
49
- }
50
- hasDirection(direction) {
51
- return this._directions.indexOf(direction) >= 0;
52
- }
53
- getDegrees() {
54
- return this._directions
55
- .map(value => SemaphoreDegrees_1.SemaphoreDegrees.ToDegrees(value))
56
- .sort((a, b) => a - b);
57
- }
58
- getPotentialMatch(other) {
59
- if (this.directions.length !== 1 || this.directions[0] === other) {
60
- return null;
61
- }
62
- const potentialMatch = this.getPotentialMatches().filter(value => (value.encoding & other) === other)[0];
63
- return potentialMatch || null;
64
- }
65
- onClear() {
66
- this._directions.length = 0;
67
- }
68
- onEmpty() {
69
- return this._directions.length === 0;
70
- }
71
- getEncoding() {
72
- return this._directions.reduce((previousValue, currentValue) => (previousValue |= currentValue), SemaphoreEncoding_1.SemaphoreEncoding.None);
73
- }
74
- }
75
- exports.SemaphoreCharacter = SemaphoreCharacter;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SemaphoreCharacter = void 0;
4
+ const EncodingCategory_1 = require("../Common/EncodingCategory");
5
+ const EncodingCharacterBase_1 = require("../Common/EncodingCharacterBase");
6
+ const SemaphoreData_1 = require("./SemaphoreData");
7
+ const SemaphoreDegrees_1 = require("./SemaphoreDegrees");
8
+ const SemaphoreEncoding_1 = require("./SemaphoreEncoding");
9
+ class SemaphoreCharacter extends EncodingCharacterBase_1.EncodingCharacterBase {
10
+ static parseEncoding(encoding) {
11
+ const directions = [];
12
+ for (let i = 1; i <= 8; i++) {
13
+ const direction = (1 << i);
14
+ if ((encoding & direction) === direction) {
15
+ directions.push(direction);
16
+ }
17
+ }
18
+ return directions;
19
+ }
20
+ _directions = [];
21
+ constructor(encoding = SemaphoreEncoding_1.SemaphoreEncoding.None, category = EncodingCategory_1.EncodingCategory.All) {
22
+ super(SemaphoreData_1.SemaphoreData.instance, category);
23
+ this.addDirection(encoding);
24
+ }
25
+ get directions() {
26
+ return this._directions;
27
+ }
28
+ set directions(value) {
29
+ this._directions = value.slice(0, 2);
30
+ this.invalidateLookup();
31
+ }
32
+ addDirection(direction) {
33
+ for (const dir of SemaphoreCharacter.parseEncoding(direction)) {
34
+ this._directions.push(dir);
35
+ }
36
+ if (this._directions.length > 2) {
37
+ this._directions.splice(0, this._directions.length - 2);
38
+ }
39
+ this.invalidateLookup();
40
+ }
41
+ removeDirection(direction) {
42
+ for (const dir of SemaphoreCharacter.parseEncoding(direction)) {
43
+ const index = this._directions.indexOf(dir);
44
+ if (index >= 0) {
45
+ this._directions.splice(index, 1);
46
+ }
47
+ }
48
+ this.invalidateLookup();
49
+ }
50
+ hasDirection(direction) {
51
+ return this._directions.indexOf(direction) >= 0;
52
+ }
53
+ getDegrees() {
54
+ return this._directions
55
+ .map(value => SemaphoreDegrees_1.SemaphoreDegrees.ToDegrees(value))
56
+ .sort((a, b) => a - b);
57
+ }
58
+ getPotentialMatch(other) {
59
+ if (this.directions.length !== 1 || this.directions[0] === other) {
60
+ return null;
61
+ }
62
+ const potentialMatch = this.getPotentialMatches().filter(value => (value.encoding & other) === other)[0];
63
+ return potentialMatch || null;
64
+ }
65
+ onClear() {
66
+ this._directions.length = 0;
67
+ }
68
+ onEmpty() {
69
+ return this._directions.length === 0;
70
+ }
71
+ getEncoding() {
72
+ return this._directions.reduce((previousValue, currentValue) => (previousValue |= currentValue), SemaphoreEncoding_1.SemaphoreEncoding.None);
73
+ }
74
+ }
75
+ exports.SemaphoreCharacter = SemaphoreCharacter;
76
76
  //# sourceMappingURL=SemaphoreCharacter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SemaphoreCharacter.js","sourceRoot":"","sources":["../../../src/Semaphore/SemaphoreCharacter.ts"],"names":[],"mappings":";;;AAAA,iEAA4D;AAC5D,2EAAsE;AAGtE,mDAA8C;AAC9C,yDAAoD;AAEpD,2DAAsD;AAEtD,MAAa,kBAAmB,SAAQ,6CAAwC;IAkB9E,YACE,WAA8B,qCAAiB,CAAC,IAAI,EACpD,WAA6B,mCAA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M,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC;YACjE,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,cAAc,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC,MAAM,CACtD,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,KAAK,KAAK,CAC5C,CAAC,CAAC,CAAC,CAAC;QAEL,OAAO,cAAc,IAAI,IAAI,CAAC;IAChC,CAAC;IAES,OAAO;QACf,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9B,CAAC;IAES,OAAO;QACf,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC;IACvC,CAAC;IAES,WAAW;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAC5B,CAAC,aAAa,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC,aAAa,IAAI,YAAY,CAAC,EAChE,qCAAiB,CAAC,IAAI,CACvB,CAAC;IACJ,CAAC;CACF;AAjGD,gDAiGC"}
@@ -1,6 +1,6 @@
1
- import { EncodingDataBase } from '../Common/EncodingDataBase';
2
- import { SemaphoreEncoding } from './SemaphoreEncoding';
3
- export declare class SemaphoreData extends EncodingDataBase<SemaphoreEncoding> {
4
- static readonly instance: SemaphoreData;
5
- constructor();
6
- }
1
+ import { EncodingDataBase } from '../Common/EncodingDataBase';
2
+ import { SemaphoreEncoding } from './SemaphoreEncoding';
3
+ export declare class SemaphoreData extends EncodingDataBase<SemaphoreEncoding> {
4
+ static readonly instance: SemaphoreData;
5
+ constructor();
6
+ }