UnicodeArrayNodesGroup.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { ITreeNode } from '../interfaces/nodes/ITreeNode';
  2. import { INode } from '../interfaces/INode';
  3. import { NodesGroup } from './NodesGroup';
  4. import { UnicodeArrayNode } from '../nodes/unicodeArrayNodes/UnicodeArrayNode';
  5. import { UnicodeArrayRotateFunctionCallNode } from '../nodes/unicodeArrayNodes/UnicodeArrayRotateFunctionCallNode';
  6. import { UnicodeArrayRotateFunctionNode } from '../nodes/unicodeArrayNodes/UnicodeArrayRotateFunctionNode';
  7. import { Utils } from '../Utils';
  8. export class UnicodeArrayNodesGroup extends NodesGroup {
  9. /**
  10. * @type {string}
  11. */
  12. private unicodeArrayRotateFunctionIdentifier: string = Utils.getRandomVariableName();
  13. /**
  14. * @param astTree
  15. */
  16. constructor (astTree: ITreeNode) {
  17. super();
  18. let unicodeArrayName: string = Utils.getRandomVariableName(UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH),
  19. unicodeArrayRotateValue: number = Utils.getRandomInteger(100, 500);
  20. this.nodes = new Map <string, INode> ([
  21. [
  22. 'unicodeArrayNode',
  23. new UnicodeArrayNode(
  24. astTree,
  25. unicodeArrayName,
  26. unicodeArrayRotateValue
  27. )
  28. ],
  29. [
  30. 'unicodeArrayRotateFunctionNode',
  31. new UnicodeArrayRotateFunctionNode(
  32. astTree,
  33. this.unicodeArrayRotateFunctionIdentifier,
  34. unicodeArrayName
  35. )
  36. ],
  37. [
  38. 'unicodeArrayRotateFunctionCallNode',
  39. new UnicodeArrayRotateFunctionCallNode(
  40. astTree,
  41. this.unicodeArrayRotateFunctionIdentifier,
  42. unicodeArrayName,
  43. unicodeArrayRotateValue
  44. )
  45. ]
  46. ]);
  47. }
  48. }