All files / src/node-groups UnicodeArrayNodesGroup.js

95.83% Statements 23/24
90.91% Branches 10/11
100% Functions 1/1
95.65% Lines 22/23
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  1x 1x 1x 1x 1x 1x   20x   8x 8x 8x 4x   4x 2x           2x   4x 4x 4x 2x   4x     4x 2x       1x  
"use strict";
const NodesGroup_1 = require('./NodesGroup');
const UnicodeArrayCallsWrapper_1 = require("../custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper");
const UnicodeArrayDecodeNode_1 = require("../custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode");
const UnicodeArrayNode_1 = require('../custom-nodes/unicode-array-nodes/UnicodeArrayNode');
const UnicodeArrayRotateFunctionNode_1 = require('../custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode');
const Utils_1 = require('../Utils');
class UnicodeArrayNodesGroup extends NodesGroup_1.NodesGroup {
    constructor(options) {
        super(options);
        this.unicodeArrayName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
        this.unicodeArrayTranslatorName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
        if (!this.options.get('unicodeArray')) {
            return;
        }
        if (this.options.get('rotateUnicodeArray')) {
            this.unicodeArrayRotateValue = Utils_1.Utils.getRandomGenerator().integer({
                min: 100,
                max: 500
            });
        }
        else {
            this.unicodeArrayRotateValue = 0;
        }
        let unicodeArrayNode = new UnicodeArrayNode_1.UnicodeArrayNode(this.unicodeArrayName, this.unicodeArrayRotateValue, this.options), unicodeArray = unicodeArrayNode.getNodeData();
        this.nodes.set('unicodeArrayNode', unicodeArrayNode);
        if (this.options.get('wrapUnicodeArrayCalls')) {
            this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(this.unicodeArrayTranslatorName, this.unicodeArrayName, unicodeArray, this.options));
        }
        if (this.options.get('encodeUnicodeLiterals')) I{
            this.nodes.set('unicodeArrayDecodeNode', new UnicodeArrayDecodeNode_1.UnicodeArrayDecodeNode(this.unicodeArrayName, unicodeArray, this.options));
        }
        if (this.options.get('rotateUnicodeArray')) {
            this.nodes.set('unicodeArrayRotateFunctionNode', new UnicodeArrayRotateFunctionNode_1.UnicodeArrayRotateFunctionNode(this.unicodeArrayName, unicodeArray, this.unicodeArrayRotateValue, this.options));
        }
    }
}
exports.UnicodeArrayNodesGroup = UnicodeArrayNodesGroup;
//# sourceMappingURL=UnicodeArrayNodesGroup.js.map