puzzle-lib 1.3.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +38 -39
- package/build/src/Braille/BrailleCharacter.d.ts +15 -15
- package/build/src/Braille/BrailleCharacter.js +38 -37
- package/build/src/Braille/BrailleCharacter.js.map +1 -1
- package/build/src/Braille/BrailleData.d.ts +6 -6
- package/build/src/Braille/BrailleData.js +65 -64
- package/build/src/Braille/BrailleData.js.map +1 -1
- package/build/src/Braille/BrailleDot.d.ts +9 -9
- package/build/src/Braille/BrailleDot.js +13 -12
- package/build/src/Braille/BrailleDot.js.map +1 -1
- package/build/src/Braille/BrailleEncoding.d.ts +54 -54
- package/build/src/Braille/BrailleEncoding.js +65 -64
- package/build/src/Braille/BrailleEncoding.js.map +1 -1
- package/build/src/Braille/BrailleStream.d.ts +18 -18
- package/build/src/Braille/BrailleStream.js +75 -74
- package/build/src/Braille/BrailleStream.js.map +1 -1
- package/build/src/Cipher/AutoKeyString.d.ts +4 -4
- package/build/src/Cipher/AutoKeyString.js +34 -33
- package/build/src/Cipher/AutoKeyString.js.map +1 -1
- package/build/src/Cipher/CaesarString.d.ts +8 -8
- package/build/src/Cipher/CaesarString.js +31 -30
- package/build/src/Cipher/CaesarString.js.map +1 -1
- package/build/src/Cipher/CaesarUtils.d.ts +13 -13
- package/build/src/Cipher/CaesarUtils.js +57 -56
- package/build/src/Cipher/CaesarUtils.js.map +1 -1
- package/build/src/Cipher/KeyedCipherStringBase.d.ts +12 -12
- package/build/src/Cipher/KeyedCipherStringBase.js +28 -27
- package/build/src/Cipher/KeyedCipherStringBase.js.map +1 -1
- package/build/src/Cipher/VigenereString.d.ts +4 -4
- package/build/src/Cipher/VigenereString.js +21 -20
- package/build/src/Cipher/VigenereString.js.map +1 -1
- package/build/src/Common/CharacterImage.d.ts +6 -6
- package/build/src/Common/CharacterImage.js +10 -9
- package/build/src/Common/CharacterImage.js.map +1 -1
- package/build/src/Common/EncodingCategory.d.ts +8 -8
- package/build/src/Common/EncodingCategory.js +12 -11
- package/build/src/Common/EncodingCategory.js.map +1 -1
- package/build/src/Common/EncodingCharacterBase.d.ts +23 -23
- package/build/src/Common/EncodingCharacterBase.js +52 -51
- package/build/src/Common/EncodingCharacterBase.js.map +1 -1
- package/build/src/Common/EncodingDataBase.d.ts +7 -7
- package/build/src/Common/EncodingDataBase.js +29 -28
- package/build/src/Common/EncodingDataBase.js.map +1 -1
- package/build/src/Common/EncodingEntry.d.ts +8 -8
- package/build/src/Common/EncodingEntry.js +14 -13
- package/build/src/Common/EncodingEntry.js.map +1 -1
- package/build/src/Common/EncodingLookupResult.d.ts +6 -6
- package/build/src/Common/EncodingLookupResult.js +13 -12
- package/build/src/Common/EncodingLookupResult.js.map +1 -1
- package/build/src/Common/Helpers.d.ts +4 -4
- package/build/src/Common/Helpers.js +16 -15
- package/build/src/Common/Helpers.js.map +1 -1
- package/build/src/Common/InlineSvg.d.ts +7 -7
- package/build/src/Common/InlineSvg.js +14 -13
- package/build/src/Common/InlineSvg.js.map +1 -1
- package/build/src/Conversion/CharacterAutoConvert.d.ts +10 -7
- package/build/src/Conversion/CharacterAutoConvert.js +88 -80
- package/build/src/Conversion/CharacterAutoConvert.js.map +1 -1
- package/build/src/Conversion/CharacterConversion.d.ts +8 -8
- package/build/src/Conversion/CharacterConversion.js +50 -49
- package/build/src/Conversion/CharacterConversion.js.map +1 -1
- package/build/src/Conversion/CharacterEncoding.d.ts +9 -8
- package/build/src/Conversion/CharacterEncoding.js +13 -11
- package/build/src/Conversion/CharacterEncoding.js.map +1 -1
- package/build/src/Conversion/CharacterTableEntry.d.ts +10 -10
- package/build/src/Conversion/CharacterTableEntry.js +19 -18
- package/build/src/Conversion/CharacterTableEntry.js.map +1 -1
- package/build/src/Conversion/SignificantFigures.d.ts +7 -7
- package/build/src/Conversion/SignificantFigures.js +50 -49
- package/build/src/Conversion/SignificantFigures.js.map +1 -1
- package/build/src/Conversion/StringAutoConvert.d.ts +6 -6
- package/build/src/Conversion/StringAutoConvert.js +46 -45
- package/build/src/Conversion/StringAutoConvert.js.map +1 -1
- package/build/src/Morse/MorseCharacter.d.ts +22 -22
- package/build/src/Morse/MorseCharacter.js +96 -95
- package/build/src/Morse/MorseCharacter.js.map +1 -1
- package/build/src/Morse/MorseData.d.ts +6 -6
- package/build/src/Morse/MorseData.js +70 -69
- package/build/src/Morse/MorseData.js.map +1 -1
- package/build/src/Morse/MorseEncoding.d.ts +59 -59
- package/build/src/Morse/MorseEncoding.js +94 -93
- package/build/src/Morse/MorseEncoding.js.map +1 -1
- package/build/src/Morse/MorseString.d.ts +10 -10
- package/build/src/Morse/MorseString.js +66 -65
- package/build/src/Morse/MorseString.js.map +1 -1
- package/build/src/Nato/NatoCharacter.d.ts +5 -5
- package/build/src/Nato/NatoCharacter.js +10 -9
- package/build/src/Nato/NatoCharacter.js.map +1 -1
- package/build/src/Nato/NatoData.d.ts +7 -7
- package/build/src/Nato/NatoData.js +51 -50
- package/build/src/Nato/NatoData.js.map +1 -1
- package/build/src/NavalFlags/NavalFlags.d.ts +7 -7
- package/build/src/NavalFlags/NavalFlags.js +52 -50
- package/build/src/NavalFlags/NavalFlags.js.map +1 -1
- package/build/src/Resistor/Resistor.d.ts +24 -24
- package/build/src/Resistor/Resistor.js +86 -85
- package/build/src/Resistor/Resistor.js.map +1 -1
- package/build/src/Resistor/ResistorColorEntry.d.ts +12 -12
- package/build/src/Resistor/ResistorColorEntry.js +31 -30
- package/build/src/Resistor/ResistorColorEntry.js.map +1 -1
- package/build/src/Semaphore/SemaphoreCharacter.d.ts +20 -20
- package/build/src/Semaphore/SemaphoreCharacter.js +75 -74
- package/build/src/Semaphore/SemaphoreCharacter.js.map +1 -1
- package/build/src/Semaphore/SemaphoreData.d.ts +6 -6
- package/build/src/Semaphore/SemaphoreData.js +53 -52
- package/build/src/Semaphore/SemaphoreData.js.map +1 -1
- package/build/src/Semaphore/SemaphoreDegrees.d.ts +5 -5
- package/build/src/Semaphore/SemaphoreDegrees.js +26 -25
- package/build/src/Semaphore/SemaphoreDegrees.js.map +1 -1
- package/build/src/Semaphore/SemaphoreDirection.d.ts +11 -11
- package/build/src/Semaphore/SemaphoreDirection.js +15 -14
- package/build/src/Semaphore/SemaphoreDirection.js.map +1 -1
- package/build/src/Semaphore/SemaphoreEncoding.d.ts +40 -40
- package/build/src/Semaphore/SemaphoreEncoding.js +47 -46
- package/build/src/Semaphore/SemaphoreEncoding.js.map +1 -1
- package/build/src/Semaphore/SemaphoreStream.d.ts +17 -17
- package/build/src/Semaphore/SemaphoreStream.js +72 -71
- package/build/src/Semaphore/SemaphoreStream.js.map +1 -1
- package/build/src/WordSearch/Point.d.ts +4 -4
- package/build/src/WordSearch/Point.js +2 -2
- package/build/src/WordSearch/Result.d.ts +6 -6
- package/build/src/WordSearch/Result.js +10 -9
- package/build/src/WordSearch/Result.js.map +1 -1
- package/build/src/WordSearch/WordSearchDirection.d.ts +6 -6
- package/build/src/WordSearch/WordSearchDirection.js +10 -9
- package/build/src/WordSearch/WordSearchDirection.js.map +1 -1
- package/build/src/WordSearch/WordSearchSolver.d.ts +27 -18
- package/build/src/WordSearch/WordSearchSolver.js +222 -171
- package/build/src/WordSearch/WordSearchSolver.js.map +1 -1
- package/build/src/index.d.ts +35 -35
- package/build/src/index.js +72 -70
- package/build/src/index.js.map +1 -1
- package/package.json +40 -39
- package/src/Braille/BrailleCharacter.ts +49 -0
- package/src/Braille/BrailleData.ts +131 -0
- package/src/Braille/BrailleDot.ts +9 -0
- package/src/Braille/BrailleEncoding.ts +144 -0
- package/src/Braille/BrailleStream.ts +87 -0
- package/src/Cipher/AutoKeyString.ts +35 -0
- package/src/Cipher/CaesarString.ts +38 -0
- package/src/Cipher/CaesarUtils.ts +69 -0
- package/src/Cipher/KeyedCipherStringBase.ts +35 -0
- package/src/Cipher/VigenereString.ts +21 -0
- package/src/Common/CharacterImage.ts +11 -0
- package/src/Common/EncodingCategory.ts +10 -0
- package/src/Common/EncodingCharacterBase.ts +72 -0
- package/src/Common/EncodingDataBase.ts +31 -0
- package/src/Common/EncodingEntry.ts +17 -0
- package/src/Common/EncodingLookupResult.ts +10 -0
- package/src/Common/Helpers.ts +13 -0
- package/src/Common/InlineSvg.ts +15 -0
- package/src/Conversion/CharacterAutoConvert.ts +108 -0
- package/src/Conversion/CharacterConversion.ts +89 -0
- package/src/Conversion/CharacterEncoding.ts +9 -0
- package/src/Conversion/CharacterTableEntry.ts +23 -0
- package/src/Conversion/SignificantFigures.ts +55 -0
- package/src/Conversion/StringAutoConvert.ts +56 -0
- package/src/Morse/MorseCharacter.ts +112 -0
- package/src/Morse/MorseData.ts +143 -0
- package/src/Morse/MorseEncoding.ts +98 -0
- package/src/Morse/MorseString.ts +106 -0
- package/src/Nato/NatoCharacter.ts +9 -0
- package/src/Nato/NatoData.ts +49 -0
- package/src/NavalFlags/LICENSE +7 -0
- package/src/NavalFlags/NavalFlags.ts +293 -0
- package/src/Resistor/Resistor.ts +135 -0
- package/src/Resistor/ResistorColorEntry.ts +43 -0
- package/src/Semaphore/SemaphoreCharacter.ts +107 -0
- package/src/Semaphore/SemaphoreData.ts +58 -0
- package/src/Semaphore/SemaphoreDegrees.ts +26 -0
- package/src/Semaphore/SemaphoreDirection.ts +11 -0
- package/src/Semaphore/SemaphoreEncoding.ts +48 -0
- package/src/Semaphore/SemaphoreStream.ts +89 -0
- package/src/WordSearch/Point.ts +4 -0
- package/src/WordSearch/Result.ts +10 -0
- package/src/WordSearch/WordSearchDirection.ts +6 -0
- package/src/WordSearch/WordSearchSolver.ts +271 -0
- package/src/index.ts +38 -0
- package/src/trie-prefix-tree.d.ts +70 -0
|
@@ -1,86 +1,87 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
value
|
|
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
|
-
Resistor.
|
|
61
|
-
Resistor.
|
|
62
|
-
Resistor.
|
|
63
|
-
Resistor.
|
|
64
|
-
Resistor.
|
|
65
|
-
Resistor.
|
|
66
|
-
Resistor.
|
|
67
|
-
Resistor.
|
|
68
|
-
Resistor.
|
|
69
|
-
Resistor.
|
|
70
|
-
Resistor.
|
|
71
|
-
Resistor.
|
|
72
|
-
|
|
73
|
-
Resistor.
|
|
74
|
-
Resistor.
|
|
75
|
-
Resistor.
|
|
76
|
-
Resistor.
|
|
77
|
-
Resistor.
|
|
78
|
-
Resistor.
|
|
79
|
-
Resistor.
|
|
80
|
-
Resistor.
|
|
81
|
-
Resistor.
|
|
82
|
-
Resistor.
|
|
83
|
-
Resistor.
|
|
84
|
-
|
|
85
|
-
|
|
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;
|
|
86
87
|
//# sourceMappingURL=Resistor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resistor.js","sourceRoot":"","sources":["../../../src/Resistor/Resistor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Resistor.js","sourceRoot":"","sources":["../../../src/Resistor/Resistor.ts"],"names":[],"mappings":";;;AAAA,6DAAwD;AAExD,MAAa,QAAQ;IA6EnB;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,MAA4B;QAC1C,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC1C,MAAM,IAAI,UAAU,CAAC,uBAAuB,CAAC,CAAC;SAC/C;QAED,4EAA4E;QAC5E,2EAA2E;QAC3E,sEAAsE;QACtE,WAAW;QAEX,yEAAyE;QACzE,SAAS;QACT,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;YAC1C,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,YAAY,CAAC,KAAK,KAAK,SAAS,EAAE;gBACpC,OAAO,QAAQ,CAAC,gBAAgB,CAAC;aAClC;YAED,KAAK,IAAI,EAAE,CAAC;YACZ,KAAK,IAAI,YAAY,CAAC,KAAK,CAAC;SAC7B;QAED,OAAO,QAAQ,CAAC,eAAe,CAC7B,KAAK,EACL,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,UAAU,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CACF,CAAC;AACc,cAAK,GAAG,IAAI,uCAAkB,CAC5C,OAAO,EACP,SAAS,EACT,MAAM,EACN,CAAC,EACD,GAAG,CACJ,CAAC;AACc,aAAI,GAAG,IAAI,uCAAkB,CAC3C,MAAM,EACN,SAAS,EACT,OAAO,EACP,CAAC,EACD,IAAI,CACL,CAAC;AACc,eAAM,GAAG,IAAI,uCAAkB,CAC7C,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,CAAC,EACD,GAAG,CACJ,CAAC;AACc,aAAI,GAAG,IAAI,uCAAkB,CAC3C,MAAM,EACN,SAAS,EACT,SAAS,EACT,CAAC,CACF,CAAC;AACc,cAAK,GAAG,IAAI,uCAAkB,CAC5C,OAAO,EACP,SAAS,EACT,UAAU,EACV,CAAC,CACF,CAAC;AACc,aAAI,GAAG,IAAI,uCAAkB,CAC3C,MAAM,EACN,SAAS,EACT,GAAG,EACH,SAAS,EACT,CAAC,CACF,CAAC;AACc,eAAM,GAAG,IAAI,uCAAkB,CAC7C,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,SAAS,EACT,EAAE,CACH,CAAC;AAEc,mBAAU,GAAyB;IACjD,QAAQ,CAAC,KAAK;IACd,QAAQ,CAAC,KAAK;IACd,QAAQ,CAAC,GAAG;IACZ,QAAQ,CAAC,MAAM;IACf,QAAQ,CAAC,MAAM;IACf,QAAQ,CAAC,KAAK;IACd,QAAQ,CAAC,IAAI;IACb,QAAQ,CAAC,MAAM;IACf,QAAQ,CAAC,IAAI;IACb,QAAQ,CAAC,KAAK;IACd,QAAQ,CAAC,IAAI;IACb,QAAQ,CAAC,MAAM;CAChB,CAAC;AAEc,yBAAgB,GAAG,CAAC,CAAC,CAAC"}
|
|
@@ -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,31 +1,32 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
this.
|
|
7
|
-
this.
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
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;
|
|
31
32
|
//# sourceMappingURL=ResistorColorEntry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResistorColorEntry.js","sourceRoot":"","sources":["../../../src/Resistor/ResistorColorEntry.ts"],"names":[],"mappings":"
|
|
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,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(): SemaphoreEncoding;
|
|
20
|
+
}
|
|
@@ -1,75 +1,76 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.
|
|
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
|
-
|
|
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;
|
|
75
76
|
//# sourceMappingURL=SemaphoreCharacter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SemaphoreCharacter.js","sourceRoot":"","sources":["../../../src/Semaphore/SemaphoreCharacter.ts"],"names":[],"mappings":"
|
|
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,mCAAgB,CAAC,GAAG;QAEjD,KAAK,CAAC,6BAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QANlC,gBAAW,GAAyB,EAAE,CAAC;QAQ7C,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;IAxBO,MAAM,CAAC,aAAa,CAC1B,QAAgD;QAEhD,MAAM,UAAU,GAAyB,EAAE,CAAC;QAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;YAC3B,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,CAAuB,CAAC;YACjD,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,KAAK,SAAS,EAAE;gBACxC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aAC5B;SACF;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;IAaD,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAI,UAAU,CAAC,KAA2B;QACxC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,KAAK,CAA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AC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE;YAChE,OAAO,IAAI,CAAC;SACb;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
|
+
}
|